Skip to content

Commit

Permalink
change Customer to Codable for reuse for Vault customer decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
KunJeongPark committed Nov 27, 2023
1 parent f07d0bc commit 62480f6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
10 changes: 2 additions & 8 deletions Demo/Demo/Models/CreateOrderParams.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ struct VaultCard: Encodable {
struct Attributes: Encodable {

let vault: Vault
let customer: VaultCustomer?
let customer: Customer?

init(vault: Vault, customer: VaultCustomer? = nil) {
init(vault: Vault, customer: Customer? = nil) {
self.vault = vault
self.customer = customer
}
Expand All @@ -77,12 +77,6 @@ struct Vault: Encodable {
let customerType: String?
}

struct VaultCustomer: Encodable {

let id: String
}


struct PurchaseUnit: Encodable {

var shipping: Shipping?
Expand Down
4 changes: 2 additions & 2 deletions Demo/Demo/Models/PaymentTokenResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ struct PaymentTokenResponse: Decodable, Equatable {
let paymentSource: PaymentSource
}

struct Customer: Decodable, Equatable {
struct Customer: Codable, Equatable {

let id: String
}

Expand Down
4 changes: 2 additions & 2 deletions Demo/Demo/ViewModels/CardPaymentViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class CardPaymentViewModel: ObservableObject, CardDelegate {

var vaultCardPaymentSource: VaultCardPaymentSource?
if shouldVault {
var customer: VaultCustomer?
var customer: Customer?
if let customerID {
customer = VaultCustomer(id: customerID)
customer = Customer(id: customerID)
}
let attributes = Attributes(vault: Vault(storeInVault: "ON_SUCCESS", usageType: nil, customerType: nil), customer: customer)
let card = VaultCard(attributes: attributes)
Expand Down

0 comments on commit 62480f6

Please sign in to comment.