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.
64 lines
1.7 KiB
64 lines
1.7 KiB
//
|
|
// DomesticRemitService.swift
|
|
// GME Remit
|
|
//
|
|
// Created by InKwon James Kim on 17/09/2019.
|
|
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
class DomesticRemitService: DomesticRemitServiceType {
|
|
func fetchInformation(
|
|
success: @escaping (DomesticRemitModel) -> Void,
|
|
failure: @escaping (Error) -> Void
|
|
) {
|
|
APIRouter.domesticRemitStart.json(success: success, failure: failure)
|
|
}
|
|
|
|
func getRecipientName(
|
|
account: String,
|
|
bankCode: String,
|
|
success: @escaping (RecipientNameModel) -> Void,
|
|
failure: @escaping (Error) -> Void
|
|
) {
|
|
APIRouter.fetchRecipientName(bankCode: bankCode, accountNumber: account)
|
|
.json(success: success, failure: failure)
|
|
|
|
}
|
|
|
|
func fetchBalance(
|
|
type: String,
|
|
fintechUseNumber: String,
|
|
success: @escaping (BalanceModel) -> Void,
|
|
failure: @escaping (Error) -> Void
|
|
) {
|
|
APIRouter.fetchBalace(
|
|
type: type,
|
|
fintechUseNumber: fintechUseNumber
|
|
).json(success: success, failure: failure)
|
|
|
|
}
|
|
|
|
func send(
|
|
with model: DomesticRemitRequestModel,
|
|
success: @escaping (ResponseContainerObject<DomesticRemitResponseModel>) -> Void,
|
|
failure: @escaping (Error) -> Void
|
|
) {
|
|
APIRouter.sendDomesticRemit(model: model)
|
|
.request(
|
|
success: {(response: ResponseContainerObject<DomesticRemitResponseModel>) in
|
|
if response.errorCode != "0" {
|
|
let error = NSError(
|
|
domain: "Network",
|
|
code: 0,
|
|
message: response.message ?? "Failed Send Money"
|
|
)
|
|
failure(error)
|
|
}
|
|
success(response)
|
|
},
|
|
failure: failure
|
|
)
|
|
}
|
|
}
|