Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
SynchronyFinancialWatchApp/SynchronyFinancial/SynchronyFinancial/Defaults.swift
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
111 lines (93 sloc)
4.61 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Defaults.swift | |
// SynchronyFinancial | |
// | |
// Created by Alan Maynard on 3/12/19. | |
// Copyright © 2019 Alan Maynard. All rights reserved. | |
// | |
import Foundation | |
final class Defaults { | |
// MARK: - Request URLs | |
static let LOGIN_URL = "https://syf-paysol-mocks.getsandbox.com/paysol/login/api/rest/v1_0/login" | |
static let MULTI_ACCT_URL = "https://syf-paysol-mocks.getsandbox.com/paysol/account/api/rest/v1_0/multi_account_summary_details" | |
static let FETCH_BANKS_URL = "https://syf-paysol-mocks.getsandbox.com/paysol/payment/api/rest/v1_0/fetch_banks" | |
static let TRANS_HISTORY_URL = "https://syf-paysol-mocks.getsandbox.com/paysol/account/api/rest/v1_0/transaction_history" | |
static let CANCEL_PAYMENT_URL = "https://syf-paysol-mocks.getsandbox.com/paysol/payment/api/rest/v1_0/cancel_payment" | |
static let MAKE_PAYMENT_URL = "https://syf-paysol-mocks.getsandbox.com/paysol/payment/api/rest/v1_0/make_payment" | |
static let defaultHeader = ["channel": "AW", "device_id": "apple_watch", "trans_id": "apple_watch"] | |
static let token = UserDefaults.standard.string(forKey: "access_token") ?? "" | |
static let authHeader = ["Authorization": "Bearer \(token)"] | |
// MARK: - Wellness Detail Blurbs | |
static let UTIL = "Credit utilization is the ratio of credit used compared to total credit. Ideally, this value should be 30% or below." | |
static let UTIL_TRENDS = "Lowering your utilization over time can help reduce the amount of interest accrued on your accounts." | |
static let AVG_UTIL = "Average Utilization shows the mean credit utilization across all of your CareCredit accounts" | |
static let LAST_PAYMENT = "Making monthly payments at this rate (excluding interest), you can eliminate your balance in the noted time period." | |
static let HEALTHY_ACCTS = "Healthy accounts shows how many of your CareCredit accounts stand with a utilization at 30% or below." | |
static let careCreditDateFormatter: DateFormatter = { | |
var formatter = DateFormatter() | |
formatter.dateFormat = "yyyyMMdd" | |
formatter.locale = Locale.current | |
return formatter | |
}() | |
static var headerForLogin: [String: Any] = { | |
return ["client_id": "carecredit", | |
"client_secret": "", | |
"grant_type": "password", | |
"header": defaultHeader, | |
"iovation": ["device_fingerprint": "apple_watch", | |
"ip_address": "0.0.0.0", | |
"mobile_latitude": 0.0, | |
"mobile_longitude": 0.0], | |
"password": "Test12test", | |
"scope": "default", | |
"username": "carecredit"] | |
}() | |
// this header is used for multi-account and fetch banks resources | |
static var headerForMulti: [String: Any] = { | |
return ["header": defaultHeader, | |
"username": "carecredit"] | |
}() | |
static var headerForTransaction: [String: Any] = { | |
// get account alias | |
var account_alias = "" | |
// Dates | |
// for now lets get transactions from the past 2 weeks | |
let start_date = careCreditDateFormatter.string(from: Calendar.current.date(byAdding: .day, value: -14, to: Date()) ?? Date()) | |
let end_date = careCreditDateFormatter.string(from: Date()) | |
return ["account_alias": account_alias, | |
"begin_sequence": "1", | |
"end_date": end_date, | |
"end_sequence": "30", | |
"header": defaultHeader, | |
"scope_indicator": "B", | |
"start_date": start_date, | |
"username": "carecredit"] | |
}() | |
static var headerForCancelPmt: [String: Any] = { | |
// get account_alias | |
var account_alias = "" | |
// get payment confirmation number | |
var pmt_confirmation = "" | |
// get payment id | |
var payment_id = "" | |
return ["account_alias": account_alias, | |
"header": defaultHeader, | |
"scope_indicator": "B", | |
"payment_confirmation_number": pmt_confirmation, | |
"payment_id": payment_id, | |
"username": "carecredit"] | |
}() | |
static var headerForPmt: [String: Any] = { | |
// get account alias | |
var account_alias = "" | |
// get bank account id to pay from | |
var bank_acct_id = "" | |
return ["account_alias": account_alias, | |
"bank_account_id": bank_acct_id, | |
"header": defaultHeader, | |
"payment_amount": 123.45, | |
"payment_amount_type": "CBL", | |
"scheduled_payment_post_date": "20190306", | |
"username": "carecredit"] | |
}() | |
} |