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.
283 lines
7.6 KiB
283 lines
7.6 KiB
//
|
|
// TotalManageAccountsService.swift
|
|
// GME Remit
|
|
//
|
|
// Created by InKwon James Kim on 2019/11/15.
|
|
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
class TotalManageAccountsService: TotalManageAccountsServiceType {
|
|
func fetchAutodebitAccounts(
|
|
username: String,
|
|
success: @escaping (KFTCModel?) -> Void,
|
|
failure: @escaping (Error) -> Void
|
|
) {
|
|
let test =
|
|
"""
|
|
{
|
|
"Id" : "",
|
|
"Extra" : "",
|
|
"Extra2" : "",
|
|
"Data" : {
|
|
"URL" : "https://testapi.open-platform.or.kr/oauth/2.0/authorize2?response_type=code&client_id=l7xx9a67eaeb6a684f15b441769931d582b3&redirect_uri=http://gmeuat.gmeremit.com:5013/Dashboard/AutoDebit&scope=login+inquiry+transfer&client_info=mobile_40154&auth_type=1&bg_color=%23F4F8FB&txt_color=%23000000&btn1_color=%23EF343B&btn2_color=%2322246B&edit_option=off&invoke_type=ajax",
|
|
"Header" : [
|
|
{
|
|
"Key" : "Kftc-Bfop-UserSeqNo",
|
|
"Value" : "1100033843"
|
|
},
|
|
{
|
|
"Key" : "Kftc-Bfop-UserCI",
|
|
"Value" : "mAjbMK7hXiDfv2mUMEfocsYaYUyOKVzzAIwPo8pcVI/3Iqy+LVkkTM8PGJkcpsaVzqh03TBn0HkryMdGXkb6xg=="
|
|
},
|
|
{
|
|
"Key" : "Kftc-Bfop-UserName",
|
|
"Value" : "김한성"
|
|
},
|
|
{
|
|
"Key" : "Kftc-Bfop-UserInfo",
|
|
"Value" : ""
|
|
},
|
|
{
|
|
"Key" : "Kftc-Bfop-UserCellNo",
|
|
"Value" : ""
|
|
},
|
|
{
|
|
"Key" : "Kftc-Bfop-PhoneCarrier",
|
|
"Value" : ""
|
|
},
|
|
{
|
|
"Key" : "Kftc-Bfop-UserEmail",
|
|
"Value" : ""
|
|
}
|
|
],
|
|
"Language" : [
|
|
{
|
|
"Key" : "eng",
|
|
"Value" : "English"
|
|
},
|
|
{
|
|
"Key" : "kor",
|
|
"Value" : "Korean"
|
|
},
|
|
{
|
|
"Key" : "vnm",
|
|
"Value" : "Vietnamese"
|
|
},
|
|
{
|
|
"Key" : "idn",
|
|
"Value" : "Indonesia"
|
|
},
|
|
{
|
|
"Key" : "khm",
|
|
"Value" : "Khmer"
|
|
},
|
|
{
|
|
"Key" : "phl",
|
|
"Value" : "Philippines"
|
|
},
|
|
{
|
|
"Key" : "npl",
|
|
"Value" : "Nepalese"
|
|
},
|
|
{
|
|
"Key" : "bgd",
|
|
"Value" : "Bangladesh"
|
|
},
|
|
{
|
|
"Key" : "pak",
|
|
"Value" : "Pakistan"
|
|
},
|
|
{
|
|
"Key" : "rus",
|
|
"Value" : "Russian"
|
|
},
|
|
{
|
|
"Key" : "uzb",
|
|
"Value" : "Uzbekistan"
|
|
},
|
|
{
|
|
"Key" : "mng",
|
|
"Value" : "Mongolia"
|
|
},
|
|
{
|
|
"Key" : "lka",
|
|
"Value" : "Sri Lanka"
|
|
}
|
|
],
|
|
"AccountList" : [
|
|
{
|
|
"BankCode" : "034",
|
|
"UserCi" : null,
|
|
"AccountNum" : null,
|
|
"BankName" : "광주은행",
|
|
"WalletName" : null,
|
|
"AutoDebit" : null,
|
|
"Type" : null,
|
|
"FintechUseNo" : "101055699969776524847629",
|
|
"AccountNumMasked" : "11111111***",
|
|
"FullAccountName" : null,
|
|
"IsApproved" : null,
|
|
"AccHolderInfoType" : null,
|
|
"Scope" : null,
|
|
"UserSeqNo" : null,
|
|
"KftcAccountId" : "seExx5jztZNXJh+76iUiKA==",
|
|
"CustomerId" : null,
|
|
"BankCodeStd" : "034",
|
|
"IsShowRefresh" : "N",
|
|
"AccessToken" : null,
|
|
"AccHolderInfo" : null,
|
|
"AccountName" : null,
|
|
"IsInboundPennyTestRequested" : true,
|
|
"TokenType" : null
|
|
},
|
|
{
|
|
"BankCode" : "088",
|
|
"UserCi" : null,
|
|
"AccountNum" : null,
|
|
"BankName" : "신한은행",
|
|
"WalletName" : null,
|
|
"AutoDebit" : null,
|
|
"Type" : null,
|
|
"FintechUseNo" : "101055699969776524847629",
|
|
"AccountNumMasked" : "22222222***",
|
|
"FullAccountName" : null,
|
|
"IsApproved" : null,
|
|
"AccHolderInfoType" : null,
|
|
"Scope" : null,
|
|
"UserSeqNo" : null,
|
|
"KftcAccountId" : "seExx5jztZNXJh+76iUiKA==",
|
|
"CustomerId" : null,
|
|
"BankCodeStd" : "034",
|
|
"IsShowRefresh" : "N",
|
|
"AccessToken" : null,
|
|
"AccHolderInfo" : null,
|
|
"AccountName" : null,
|
|
"IsInboundPennyTestRequested" : true,
|
|
"TokenType" : null
|
|
},
|
|
{
|
|
"BankCode" : "081",
|
|
"UserCi" : null,
|
|
"AccountNum" : null,
|
|
"BankName" : "KEB 하나은행",
|
|
"WalletName" : null,
|
|
"AutoDebit" : null,
|
|
"Type" : null,
|
|
"FintechUseNo" : "101055699969776524847629",
|
|
"AccountNumMasked" : "33333333***",
|
|
"FullAccountName" : null,
|
|
"IsApproved" : null,
|
|
"AccHolderInfoType" : null,
|
|
"Scope" : null,
|
|
"UserSeqNo" : null,
|
|
"KftcAccountId" : "seExx5jztZNXJh+76iUiKA==",
|
|
"CustomerId" : null,
|
|
"BankCodeStd" : "034",
|
|
"IsShowRefresh" : "N",
|
|
"AccessToken" : null,
|
|
"AccHolderInfo" : null,
|
|
"AccountName" : null,
|
|
"IsInboundPennyTestRequested" : false,
|
|
"TokenType" : null
|
|
},
|
|
]
|
|
},
|
|
"ErrorCode" : "0",
|
|
"Msg" : "Success"
|
|
}
|
|
"""
|
|
guard let data = ResponseContainerObject<KFTCModel>(JSONString: test)?.data else {
|
|
return
|
|
}
|
|
|
|
success(data)
|
|
}
|
|
|
|
func fetchInboundAccounts(
|
|
success: @escaping ([InboundAccount]) -> Void,
|
|
failure: @escaping (Error) -> Void
|
|
) {
|
|
//APIRouter.fetchInboundAccounts.json(success: success, failure: failure)
|
|
|
|
//FIXME: TEST
|
|
|
|
let test =
|
|
"""
|
|
{
|
|
"Id" : "",
|
|
"Extra" : "",
|
|
"Extra2" : "",
|
|
"Data" : [
|
|
{
|
|
"AccountNo" : "11111111***",
|
|
"Bank" : "Kwangju Bank(KJ)",
|
|
"IsPennyTestSuccess" : false,
|
|
"BankCode" : "034",
|
|
"IsPrimary" : false
|
|
},
|
|
{
|
|
"AccountNo" : "22222222***",
|
|
"Bank" : "Shinhan Bank",
|
|
"IsPennyTestSuccess" : true,
|
|
"BankCode" : "088",
|
|
"IsPrimary" : false
|
|
},
|
|
{
|
|
"AccountNo" : "40790204056295",
|
|
"Bank" : "Kookmin-Bank(KB)",
|
|
"IsPennyTestSuccess" : true,
|
|
"BankCode" : "004",
|
|
"IsPrimary" : true
|
|
},
|
|
{
|
|
"AccountNo" : "549237567203123",
|
|
"Bank" : "Industrial Bank of Korea(IBK)",
|
|
"IsPennyTestSuccess" : true,
|
|
"BankCode" : "003",
|
|
"IsPrimary" : false
|
|
},
|
|
{
|
|
"AccountNo" : "110223458102",
|
|
"Bank" : "Suhyup Local Cooperatives",
|
|
"IsPennyTestSuccess" : false,
|
|
"BankCode" : "007",
|
|
"IsPrimary" : false
|
|
}
|
|
],
|
|
"ErrorCode" : "0",
|
|
"Msg" : "Success"
|
|
}
|
|
"""
|
|
guard let data = ResponseContainerArray<InboundAccount>(JSONString: test)?.data else {
|
|
return
|
|
}
|
|
|
|
success(data)
|
|
}
|
|
|
|
func refreshTokenStep1(
|
|
username: String,
|
|
success: @escaping (KFTCModel?) -> Void,
|
|
failure: @escaping (Error) -> Void
|
|
) {
|
|
APIRouter.renewalToken(username: username)
|
|
.request(
|
|
success: { (response: KftcAccountContainer) in
|
|
if (response.errorCode ?? "") == "1" {
|
|
let error = NSError(
|
|
domain: "Network",
|
|
code: 0,
|
|
userInfo: [NSLocalizedDescriptionKey : response.message ?? ""]
|
|
)
|
|
failure(error)
|
|
} else {
|
|
let model = response.data
|
|
success(model)
|
|
}
|
|
},
|
|
failure: failure
|
|
)
|
|
}
|
|
}
|