You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
// // RecipientsService.swift // GME Remit // // Created by InKwon James Kim on 08/08/2019. //Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. //
import Foundation import Alamofire
class RecipientsService: RecipientsServiceType { func fetchRecipients( success: @escaping (FetchRecipientsModel) -> Void, failure: @escaping (Error) -> Void ) { let senderID = GMEDB.shared.user.string(.senderId) ?? "" APIRouter .fetchRecipients(senderID: senderID) .json(success: success, failure: failure) } func fetchReciepientList( username: String, success: @escaping (RecipientListWrapperContainer?) -> Void, failure: @escaping (Error) -> Void ) { let url = baseUrl + "/mobile/" + username + "/receivers" let params = ["search": ""] auth.request( method: .get, url: url, params: params, encoding: URLEncoding.default, success: { (response: RecipientListContainer) in if (response.errorCode ?? "") == "1" { let error = NSError(domain: "Network", code: 0, message: response.message ?? "") failure(error) } else { let model = response.data success(model) } }, failure: {failure($0)} ) } func deleteRecipient( username: String, reciepient: Recipient, success: @escaping () -> Void, failure: @escaping (Error) -> Void ) { let url = baseUrl + "/mobile/receiver/remove/" + username + "/?receiverId=\(reciepient.id ?? "")" auth.request( method: .post, url: url, params: nil, encoding: URLEncoding.default, success: { (response: RecipientContainer) in if (response.errorCode ?? "") == "1" { let error = NSError(domain: "Nextwork", code: 0, message: response.message ?? "") failure(error) } else { //let model = response.data success() } }, failure: {failure($0)} ) } }
|