Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v7] Remove BTPayPalVaultBaseRequest #1462

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions Braintree.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@
BE349113294B798300D2CF68 /* BTPayPalRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE349112294B798300D2CF68 /* BTPayPalRequest.swift */; };
BE48CE4829D5DDA600F0825C /* BTThreeDSecureV2TextBoxCustomization.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE82E74029C4A1330059FE97 /* BTThreeDSecureV2TextBoxCustomization.swift */; };
BE549F112BF5445F00B6F441 /* BTPayPalReturnURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE6BC22D2BA9CFFC00C3E321 /* BTPayPalReturnURL.swift */; };
BE549F122BF5449E00B6F441 /* BTPayPalVaultBaseRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE6BC22B2BA9C67600C3E321 /* BTPayPalVaultBaseRequest.swift */; };
BE549F142BF6576300B6F441 /* BTAnalyticsEventsStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE549F132BF6576300B6F441 /* BTAnalyticsEventsStorage.swift */; };
BE54C0332912B68E009C6CEE /* BTHTTP_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE54C0322912B68E009C6CEE /* BTHTTP_Tests.swift */; };
BE54C0352912B6BC009C6CEE /* BTHTTPTestProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE54C0342912B6BC009C6CEE /* BTHTTPTestProtocol.swift */; };
Expand Down Expand Up @@ -937,7 +936,6 @@
BE698EA328AD2C10001D9B10 /* BTCoreConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTCoreConstants.swift; sourceTree = "<group>"; };
BE698EA528B3CDAD001D9B10 /* ConfigurationCache_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurationCache_Tests.swift; sourceTree = "<group>"; };
BE698EAA28B50F41001D9B10 /* BTClientToken_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTClientToken_Tests.swift; sourceTree = "<group>"; };
BE6BC22B2BA9C67600C3E321 /* BTPayPalVaultBaseRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTPayPalVaultBaseRequest.swift; sourceTree = "<group>"; };
BE6BC22D2BA9CFFC00C3E321 /* BTPayPalReturnURL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTPayPalReturnURL.swift; sourceTree = "<group>"; };
BE70A962284FA3F000F6D3F7 /* BTDataCollectorError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTDataCollectorError.swift; sourceTree = "<group>"; };
BE70A964284FA9DE00F6D3F7 /* MockBTDataCollector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockBTDataCollector.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1086,13 +1084,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
9CE51798282D54030013C740 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
A76D7BFC1BB1CAB00000FA6A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -1309,7 +1300,6 @@
57D9436D2968A8080079EAB1 /* BTPayPalLocaleCode.swift */,
BE349112294B798300D2CF68 /* BTPayPalRequest.swift */,
BE6BC22D2BA9CFFC00C3E321 /* BTPayPalReturnURL.swift */,
BE6BC22B2BA9C67600C3E321 /* BTPayPalVaultBaseRequest.swift */,
BE349110294B77E100D2CF68 /* BTPayPalVaultRequest.swift */,
62A659A32B98CB23008DFD67 /* PrivacyInfo.xcprivacy */,
807D22F32C29ADA8009FFEA4 /* RecurringBillingMetadata */,
Expand Down Expand Up @@ -2659,9 +2649,6 @@
8046983D2B27C5530090878E = {
CreatedOnToolsVersion = 15.0.1;
};
9CE5179A282D54030013C740 = {
CreatedOnToolsVersion = 13.2.1;
};
A76D7BFF1BB1CAB00000FA6A = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 1340;
Expand Down Expand Up @@ -2821,13 +2808,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
9CE51799282D54030013C740 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
A76D7BFE1BB1CAB00000FA6A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -3120,7 +3100,6 @@
BE349113294B798300D2CF68 /* BTPayPalRequest.swift in Sources */,
BE549F112BF5445F00B6F441 /* BTPayPalReturnURL.swift in Sources */,
57544F5C295254A500DEB7B0 /* BTJSON+PayPal.swift in Sources */,
BE549F122BF5449E00B6F441 /* BTPayPalVaultBaseRequest.swift in Sources */,
3B7A261129C0CAA40087059D /* BTPayPalAnalytics.swift in Sources */,
BE8E5CEF294B6937001BF017 /* BTPayPalCheckoutRequest.swift in Sources */,
807D22F02C29A93A009FFEA4 /* BTPayPalBillingCycle.swift in Sources */,
Expand Down Expand Up @@ -3221,13 +3200,6 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
9CE51797282D54030013C740 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
A76D7BFB1BB1CAB00000FA6A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down
56 changes: 0 additions & 56 deletions Sources/BraintreePayPal/BTPayPalVaultBaseRequest.swift

This file was deleted.

38 changes: 31 additions & 7 deletions Sources/BraintreePayPal/BTPayPalVaultRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ import BraintreeCore
#endif

/// Options for the PayPal Vault flow.
@objcMembers public class BTPayPalVaultRequest: BTPayPalVaultBaseRequest {
@objcMembers public class BTPayPalVaultRequest: BTPayPalRequest {

// MARK: - Public Properties

/// Optional: User email to initiate a quicker authentication flow in cases where the user has a PayPal Account with the same email.
public var userAuthenticationEmail: String?

/// Optional: Offers PayPal Credit if the customer qualifies. Defaults to `false`.
public var offerCredit: Bool

// MARK: - Internal Properties

/// Optional: Used to determine if the customer will use the PayPal app switch flow.
Expand Down Expand Up @@ -55,10 +58,11 @@ import BraintreeCore
recurringBillingPlanType: BTPayPalRecurringBillingPlanType? = nil,
userAuthenticationEmail: String? = nil
) {
self.offerCredit = offerCredit
self.recurringBillingDetails = recurringBillingDetails
self.recurringBillingPlanType = recurringBillingPlanType
self.userAuthenticationEmail = userAuthenticationEmail
super.init(offerCredit: offerCredit)
super.init(hermesPath: "v1/paypal_hermes/setup_billing_agreement", paymentType: .vault)
}

public override func parameters(
Expand All @@ -68,7 +72,7 @@ import BraintreeCore
) -> [String: Any] {
var baseParameters = super.parameters(with: configuration)

if let userAuthenticationEmail {
if let userAuthenticationEmail, !userAuthenticationEmail.isEmpty {
baseParameters["payer_email"] = userAuthenticationEmail
}

Expand All @@ -79,18 +83,38 @@ import BraintreeCore
"os_type": UIDevice.current.systemName,
"merchant_app_return_url": universalLink.absoluteString
]

return baseParameters.merging(appSwitchParameters) { $1 }
}

if let recurringBillingPlanType {
baseParameters["plan_type"] = recurringBillingPlanType.rawValue
}

if let recurringBillingDetails {
baseParameters["plan_metadata"] = recurringBillingDetails.parameters()
}

return baseParameters
var vaultParameters: [String: Any] = ["offer_paypal_credit": offerCredit]

if let billingAgreementDescription {
vaultParameters["description"] = billingAgreementDescription
}

if let shippingAddressOverride {
let shippingAddressParameters: [String: String?] = [
"line1": shippingAddressOverride.streetAddress,
"line2": shippingAddressOverride.extendedAddress,
"city": shippingAddressOverride.locality,
"state": shippingAddressOverride.region,
"postal_code": shippingAddressOverride.postalCode,
"country_code": shippingAddressOverride.countryCodeAlpha2,
"recipient_name": shippingAddressOverride.recipientName
]

vaultParameters["shipping_address"] = shippingAddressParameters
}

return baseParameters.merging(vaultParameters) { $1 }
}
}
Loading