Skip to content

Swe 12 enable payment suite #13

Merged
merged 14 commits into from Apr 8, 2019

Merge branch 'master' into SWE-12-enable-payment-suite

# Conflicts:
#	SynchronyFinancial/SynchronyFinancial WatchKit Extension/FetchData.swift
#	SynchronyFinancial/SynchronyFinancial.xcodeproj/project.pbxproj
  • Loading branch information
ahm11003 committed Apr 4, 2019
commit 534958fde7bb5fc77083552dde111b4294c45996
@@ -125,6 +125,53 @@ class FetchData {
}
}
}

static func getBankInfo(completion: @escaping ([BankAcct], Error?) -> Void) {
var bankIds: [BankAcct] = []
Alamofire.request(Defaults.FETCH_BANKS_URL, method: .post, parameters: Defaults.headerForMulti, encoding: JSONEncoding.default, headers: Defaults.authHeader).responseJSON { payload in
switch payload.result {
case .success(let value):
let dict = JSON(value).dictionaryValue
//print(dict)
guard dict["status"]?.dictionaryValue["response_code"]?.string == "0" else {return }
//"fetch_bank_account_details"
dict["fetch_bank_account_details"]?.arrayValue.forEach {
if let bankId = $0["bank_account_id"].string,
let accttype: AccountType = $0["bank_account_type"].stringValue ==
"C" ? .checkings : .savings {
//print(bankId)
//print(accttype)
bankIds.append(BankAcct(bankAcctId: bankId, acctType: accttype))
}
}
completion(bankIds, nil)
case .failure(let error):
NSLog("Error: %s", error.localizedDescription)
completion([], error)
}
}
}

static func cancelPayment(accountAlias: String, confirmationNum: String, paymentId: Int, completion: @escaping (String, Error?) -> Void){

var paymentHeader = Defaults.headerForCancelPmt
paymentHeader["account_alias"] = accountAlias
paymentHeader["payment_confirmation_number"] = confirmationNum
paymentHeader["payment_id"] = paymentId

Alamofire.request(Defaults.CANCEL_PAYMENT_URL, method: .post, parameters: paymentHeader, encoding: JSONEncoding.default, headers: Defaults.authHeader).responseJSON { payload in
switch payload.result {
case .success(let value):
let dict = JSON(value).dictionaryValue
guard dict["status"]?.dictionaryValue["response_code"]?.string == "0" else { return }
if let paymentCancelNum = dict["cancellation_confirmation_number"]?.stringValue {
completion(paymentCancelNum, nil)
}
case .failure(let error):
NSLog("Error: \(error.localizedDescription)")
}
}
}

static func submitPayment(for alias: String, type: String, amount: Double, bankID: String, completion: @escaping (String, String, Error?) -> Void) {
var paymentHeader = Defaults.headerForPmt
@@ -473,6 +473,8 @@
674BD1532239A39D0076AFD6 /* PayBillInterfaceController.swift in Sources */,
48F2430D2214CBF700B9C894 /* Account.swift in Sources */,
678C388622309F7D00FEAAF6 /* AccountCell.swift in Sources */,
481864A8224802BB0059CF7A /* PaymentDetailInterfaceController.swift in Sources */,
11E6ADB92253FA050009922E /* BankAcct.swift in Sources */,
48F2430E2214CBF700B9C894 /* Transaction.swift in Sources */,
67BAC269219E254700713FEF /* AppDelegate.swift in Sources */,
);
You are viewing a condensed version of this merge commit. You can view the full changes here.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.