Browse Source

service to fetch recipt added

pull/1/head
gme_2 6 years ago
parent
commit
e50db96bc7
  1. 3
      GMERemittance/Model/SendMoneyReciept.swift
  2. 25
      GMERemittance/Module/SendMoneyReceipt/Application Logic/Service/SendMoneyReceiptServiceType.swift

3
GMERemittance/Model/SendMoneyReciept.swift

@ -9,6 +9,7 @@
import Foundation
import ObjectMapper
class SendMoneyReciept: Mappable {
var payMode: String?
var paymentMode: String?
@ -78,7 +79,7 @@ class SendMoneyRecieptContainer: Mappable {
var errorCode: String?
var message: String?
var id: String?
var data: [SendMoneyReciept]?
var data: SendMoneyReciept?
required init?(map: Map) {

25
GMERemittance/Module/SendMoneyReceipt/Application Logic/Service/SendMoneyReceiptServiceType.swift

@ -13,6 +13,27 @@ protocol SendMoneyReceiptServiceType: class {
}
protocol FetchRecieptList {
// func fetch(transactionId: String, )
protocol FetchRecieptList: ApiServiceType {
func fetch(transactionId: String, success: @escaping (SendMoneyReciept?) -> (), failure: @escaping (Error) -> ())
}
extension FetchRecieptList {
func fetch(transactionId: String, success: @escaping (SendMoneyReciept?) -> (), failure: @escaping (Error) -> ()) {
let url = baseUrl + "mobile/receipt/" + transactionId
self.auth.request(method: .get, url: url, params: nil, success: { (response: SendMoneyRecieptContainer) 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/receipt/123455
Loading…
Cancel
Save