Skip to content

Commit 62480f6

Browse files
committed
change Customer to Codable for reuse for Vault customer decoding
1 parent f07d0bc commit 62480f6

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

Demo/Demo/Models/CreateOrderParams.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ struct VaultCard: Encodable {
6262
struct Attributes: Encodable {
6363

6464
let vault: Vault
65-
let customer: VaultCustomer?
65+
let customer: Customer?
6666

67-
init(vault: Vault, customer: VaultCustomer? = nil) {
67+
init(vault: Vault, customer: Customer? = nil) {
6868
self.vault = vault
6969
self.customer = customer
7070
}
@@ -77,12 +77,6 @@ struct Vault: Encodable {
7777
let customerType: String?
7878
}
7979

80-
struct VaultCustomer: Encodable {
81-
82-
let id: String
83-
}
84-
85-
8680
struct PurchaseUnit: Encodable {
8781

8882
var shipping: Shipping?

Demo/Demo/Models/PaymentTokenResponse.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ struct PaymentTokenResponse: Decodable, Equatable {
77
let paymentSource: PaymentSource
88
}
99

10-
struct Customer: Decodable, Equatable {
11-
10+
struct Customer: Codable, Equatable {
11+
1212
let id: String
1313
}
1414

Demo/Demo/ViewModels/CardPaymentViewModel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class CardPaymentViewModel: ObservableObject, CardDelegate {
2323

2424
var vaultCardPaymentSource: VaultCardPaymentSource?
2525
if shouldVault {
26-
var customer: VaultCustomer?
26+
var customer: Customer?
2727
if let customerID {
28-
customer = VaultCustomer(id: customerID)
28+
customer = Customer(id: customerID)
2929
}
3030
let attributes = Attributes(vault: Vault(storeInVault: "ON_SUCCESS", usageType: nil, customerType: nil), customer: customer)
3131
let card = VaultCard(attributes: attributes)

0 commit comments

Comments
 (0)