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.
72 lines
2.3 KiB
72 lines
2.3 KiB
//
|
|
// AutoDebitService.swift
|
|
// GME Remit
|
|
//
|
|
// Created by Mac on 12/19/18.
|
|
//Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import Alamofire
|
|
|
|
class AutoDebitService: AutoDebitServiceType {
|
|
|
|
// MARK: Properties
|
|
|
|
// MARK: Initialization
|
|
|
|
// MARK: Data management
|
|
}
|
|
|
|
|
|
|
|
protocol FetchAccountList: ApiServiceType {
|
|
func fetchAccountList(username: String, success: @escaping (KFTCModel?) -> (), failure: @escaping (Error) -> ())
|
|
}
|
|
|
|
// kftc/GetKftcParameters/
|
|
extension FetchAccountList {
|
|
func fetchAccountList(username: String, success: @escaping (KFTCModel?) -> (), failure: @escaping (Error) -> ()) {
|
|
|
|
let url = "http://gmeuat.gmeremit.com:5012/api/v2/" + "kftc/GetKftcParameters/" + username
|
|
|
|
auth.request(method: .get, url: url, params: nil, encoding: URLEncoding.default, success: { (response: KftcAccountContainer) in
|
|
if (response.errorCode ?? "") == "1" {
|
|
let error = NSError.init(domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""])
|
|
failure(error)
|
|
}else {
|
|
let model = response.data
|
|
success(model)
|
|
}
|
|
}) { (error) in
|
|
failure(error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//http://localhost:9500/api/v1/mobile/receiver/remove/sisir@mailinator.com/?receiverId=143313
|
|
|
|
protocol DeleteAccountService: ApiServiceType {
|
|
func deleteAccount(username: String, account: Account, success: @escaping () -> (), failure: @escaping (Error) -> ())
|
|
}
|
|
|
|
extension DeleteAccountService {
|
|
func deleteAccount(username: String, account: Account, success: @escaping () -> (), failure: @escaping (Error) -> ()) {
|
|
let url = "http://gmeuat.gmeremit.com:5022/api/v2/kftc/DeleteAccount/\(username)"
|
|
|
|
auth.request(method: .post, url: url, params: nil, encoding: URLEncoding.default, success: { (response: KftcAccountContainer) in
|
|
if (response.errorCode ?? "") == "1" {
|
|
let error = NSError.init(domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""])
|
|
failure(error)
|
|
}else {
|
|
success()
|
|
}
|
|
}) { (error) in
|
|
failure(error)
|
|
}
|
|
}
|
|
}
|
|
|
|
|