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] Add Encodable protocol for PayPal Vault #1492

Open
wants to merge 27 commits into
base: paypal-checkout-encodable
Choose a base branch
from

Conversation

richherrera
Copy link
Contributor

@richherrera richherrera commented Jan 3, 2025

Summary of changes

  • Add encodable types for: BTPostalAddress, BTPayPalBillingCycle, BTPayPalBillingPricing, BTPayPalRecurringBillingDetails, BTPayPalRecurringBillingPlanType and BTPayPalLineItem.
  • Remove unnecessary BTPayPalRequest concrete class.
  • Move the UTs from the concrete class BTPayPalRequest to the classes BTPayPalCheckout and BTPayPalVault since both classes previously inherited from it.
  • A method encodedPostBodyWith was added to the PayPalRequest interface to create POSTBody models.
  • Rename the PayPalRequest protocol to BTPayPalRequest.
  • Since the ExperienceProfile model is essentially the same in both the Checkout and Vault flows, I created the PayPalExperienceProfile model.
  • Add encodable types for post bodies used in the PayPal Vault flow.
  • PayPalVault has been tested in the Demo app to ensure the dictionaries are still constructed as expected.

Checklist

  • [ ] Added a changelog entry
  • Tested and confirmed payment flows affected by this change are functioning as expected

Authors

@richherrera richherrera self-assigned this Jan 3, 2025
@richherrera richherrera requested a review from a team as a code owner January 3, 2025 20:43
@richherrera richherrera marked this pull request as draft January 3, 2025 20:43
@richherrera richherrera marked this pull request as ready for review January 6, 2025 20:55
@richherrera richherrera marked this pull request as draft January 6, 2025 21:01
Sources/BraintreePayPal/BTPayPalClient.swift Outdated Show resolved Hide resolved
Sources/BraintreePayPal/BTPayPalClient.swift Outdated Show resolved Hide resolved
Sources/BraintreePayPal/BTPayPalError.swift Outdated Show resolved Hide resolved
Sources/BraintreePayPal/BTPayPalClient.swift Show resolved Hide resolved
@richherrera richherrera marked this pull request as ready for review January 13, 2025 19:39
Copy link
Contributor

@jaxdesmarais jaxdesmarais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 this is super clean, nice work on this!


// MARK: - Private Properties

private let userPhoneNumber: BTPayPalPhoneNumber?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nit, can we put this optional after the required order wise?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants