Skip to content

Commit dc0c32e

Browse files
committed
remove customerID entry for PP vault with purchase
1 parent e7abc8e commit dc0c32e

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

Demo/Demo/SwiftUIComponents/PayPalWebViews/CreateOrderPayPalWebView.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ struct CreateOrderPayPalWebView: View {
55
@ObservedObject var paypalWebViewModel: PayPalWebViewModel
66

77
@State private var selectedIntent: Intent = .authorize
8-
@State private var vaultCustomerID: String = ""
98
@State var shouldVaultSelected = false
109

1110
let selectedMerchantIntegration: MerchantIntegration
@@ -28,7 +27,6 @@ struct CreateOrderPayPalWebView: View {
2827
Toggle("Should Vault with Purchase", isOn: $shouldVaultSelected)
2928
Spacer()
3029
}
31-
FloatingLabelTextField(placeholder: "Vault Customer ID (Optional)", text: $vaultCustomerID)
3230
ZStack {
3331
Button("Create an Order") {
3432
Task {
@@ -38,8 +36,7 @@ struct CreateOrderPayPalWebView: View {
3836
amount: "10.00",
3937
selectedMerchantIntegration: DemoSettings.merchantIntegration,
4038
intent: selectedIntent.rawValue,
41-
shouldVault: shouldVaultSelected,
42-
customerID: vaultCustomerID.isEmpty ? nil : vaultCustomerID
39+
shouldVault: shouldVaultSelected
4340
)
4441
} catch {
4542
print("Error in getting setup token. \(error.localizedDescription)")

Demo/Demo/ViewModels/PayPalWebViewModel.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ class PayPalWebViewModel: ObservableObject, PayPalWebCheckoutDelegate {
1414
amount: String,
1515
selectedMerchantIntegration: MerchantIntegration,
1616
intent: String,
17-
shouldVault: Bool,
18-
customerID: String? = nil
17+
shouldVault: Bool
1918
) async throws {
2019
// might need to pass in payee as payee object or as auth header
2120

@@ -24,17 +23,13 @@ class PayPalWebViewModel: ObservableObject, PayPalWebCheckoutDelegate {
2423

2524
var vaultPayPalPaymentSource: VaultPayPalPaymentSource?
2625
if shouldVault {
27-
var customer: VaultCustomer?
28-
if let customerID {
29-
customer = VaultCustomer(id: customerID)
30-
}
3126
let attributes = Attributes(
3227
vault: Vault(
3328
storeInVault: "ON_SUCCESS",
3429
usageType: "MERCHANT",
3530
customerType: "CONSUMER"
3631
),
37-
customer: customer
32+
customer: nil as VaultCustomer?
3833
)
3934
let paypal = VaultPayPal(attributes: attributes, experienceContext: ExperienceContext(returnURL: "https://example.com/returnUrl", cancelURL: "https://example.com/cancelUrl"))
4035
vaultPayPalPaymentSource = VaultPayPalPaymentSource(paypal: paypal)

0 commit comments

Comments
 (0)