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.
124 lines
2.8 KiB
124 lines
2.8 KiB
//
|
|
// APITest.swift
|
|
// GMERemittanceTests
|
|
//
|
|
// Created by InKwon Devik Kim on 03/05/2019.
|
|
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import XCTest
|
|
@testable import GME_Remit
|
|
|
|
class APITest: XCTestCase {
|
|
func testProductList() {
|
|
let service = RewardService()
|
|
let expt = expectation(description: "ProductList")
|
|
service.fetchProductList(success: {
|
|
print("success: \($0?.count ?? 0)")
|
|
expt.fulfill()
|
|
}, failure: {
|
|
print("Error: \($0.localizedDescription)")
|
|
expt.fulfill()
|
|
})
|
|
|
|
wait(for: [expt], timeout: 5.0)
|
|
}
|
|
|
|
func testFetchBankList() {
|
|
let service = AddAccountService()
|
|
let expt = expectation(description: "testFetchBankList")
|
|
|
|
service.fetchBankList(
|
|
success: {
|
|
print("banks: \($0)")
|
|
expt.fulfill()
|
|
},
|
|
failure: {
|
|
print("error: \($0)")
|
|
expt.fulfill()
|
|
}
|
|
)
|
|
|
|
wait(for: [expt], timeout: 5.0)
|
|
}
|
|
|
|
func testRealName() {
|
|
let service = AddAccountService()
|
|
let expt = expectation(description: "testRealName")
|
|
|
|
var params = ["CustomerId": "85074"]
|
|
params["BankCode"] = "034"
|
|
params["AccountNumber"] = "1234512345"
|
|
|
|
service.verifyAccountService(
|
|
params: params,
|
|
success: {
|
|
expt.fulfill()
|
|
},
|
|
failure: {
|
|
print("error: \($0)")
|
|
expt.fulfill()
|
|
}
|
|
)
|
|
wait(for: [expt], timeout: 5.0)
|
|
}
|
|
|
|
func testFetchOrderHistory() {
|
|
let service = OrderHistoryService()
|
|
let expt = expectation(description: "testFetchOrderHistory")
|
|
|
|
service.fetchOrderHistory(
|
|
from: "2019-05-01",
|
|
to: "2019-05-11",
|
|
success: { _ in
|
|
expt.fulfill()
|
|
},
|
|
failure: { _ in
|
|
expt.fulfill()
|
|
}
|
|
)
|
|
|
|
wait(for: [expt], timeout: 5.0)
|
|
}
|
|
|
|
func testFetchHotLines() {
|
|
// let service = HomeService()
|
|
// service.fetchHotLines()
|
|
}
|
|
|
|
func testKFTCRefrsh() {
|
|
let service = AutoDebitService()
|
|
let service2 = AddAccountService()
|
|
|
|
let expt = expectation(description: "Test KFTC Refresh")
|
|
service.refreshTokenStep1(
|
|
username: "maxkim@gmeremit.com",
|
|
success: {
|
|
let url = "\($0?.url?.replacingOccurrences(of: "&lang=", with: "&lang=kor") ?? "")"
|
|
var header = [String: String]()
|
|
$0?.header?.forEach({
|
|
header[$0.key ?? ""] = $0.value ?? ""
|
|
})
|
|
|
|
service2.fetchKftcUrlService(
|
|
url: url,
|
|
header: header,
|
|
success: {
|
|
print("Fetched URL: \($0 ?? "URL IS NULL")")
|
|
expt.fulfill()
|
|
},
|
|
failure: {
|
|
print("Fetch URL Error: \($0)")
|
|
expt.fulfill()
|
|
}
|
|
)
|
|
},
|
|
failure: {
|
|
print("Error: \($0)")
|
|
expt.fulfill()
|
|
}
|
|
)
|
|
|
|
wait(for: [expt], timeout: 60)
|
|
}
|
|
}
|