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

Adding imageUrl, upcType, upcCode to PayPalLineItem #871

Merged
merged 10 commits into from
Jan 11, 2024

Conversation

vankads
Copy link
Contributor

@vankads vankads commented Dec 26, 2023

Thank you for your contribution to Braintree.

Before submitting this PR, note that we cannot accept language translation PRs. We support the same languages that are supported by PayPal, and have a dedicated localization team to provide the translations. If there is an error in a specific translation, you may open an issue and we will escalate it to the localization team.

Summary of changes

  • Added the ability for merchants to pass imageUrl, upcCode, upcType in PayPalLineItem.

Checklist

  • Added a changelog entry

Authors

List GitHub usernames for everyone who contributed to this pull request.

@vankads vankads requested a review from a team as a code owner December 26, 2023 06:00
@vankads vankads marked this pull request as draft December 26, 2023 06:03
*
* @param upcType The UPC type.
*/
public void setUpcType(@NonNull String upcType) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public void setUpcType(@NonNull String upcType) {
public void setUpcType(@Nullable String upcType) {

I'd actually go for @Nullable for these properties to align the getter/setter annotations. upcType: String? makes sense since it's initially null.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently all the existing properties have @nonnull for setters and @nullable for getters, as these are not required fields and merchant may or may not use setter methods. We didn't see any issues so far.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that must have been an oversight when those properties were added. When these annotations don't match up, the Kotlin property setters don't seem to work as expected (ex: lineItem.upcType = "some type" won't work in Kotlin, they would have to set lineItem.setUpcType("some type")), which isn't the ideal Kotlin integration experience. Although I'm not certain if newer versions of Kotlin have resolved this issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh cool yeah if it does work in newer versions of Kotlin i'm 👍 . We should check though. The way it's written now makes total sense to me, but I have seen Kotlin get weird when the annotations aren't aligned.

Copy link
Contributor

Choose a reason for hiding this comment

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

I just confirmed with the v5 branch that uses the latest Kotlin that this issue still exists 😞 - I created a ticket to update the annotations in v5 where they don't currently align, but we should add these new properties with matching annotations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated setter method annotation from @NonNull to @nullable to keep it consistent with getter method annotations

@vankads vankads changed the title WIP: Adding imageUrl, upc, upcCode to PayPalLineItem Adding imageUrl, upc, upcCode to PayPalLineItem Jan 3, 2024
@vankads vankads marked this pull request as ready for review January 3, 2024 23:50
@vankads vankads changed the title Adding imageUrl, upc, upcCode to PayPalLineItem Adding imageUrl, upcType, upcCode to PayPalLineItem Jan 4, 2024
Copy link

@ragavi98 ragavi98 left a comment

Choose a reason for hiding this comment

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

Looks good to me! Would approve if I could

CHANGELOG.md Outdated
Comment on lines 5 to 9
* BraintreePayPal
* Add following properties to PayPalLineItem
* imageUrl
* upcCode
* upcType
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* BraintreePayPal
* Add following properties to PayPalLineItem
* imageUrl
* upcCode
* upcType
* PayPal
* Add `imageUrl`, `upcCode`, and `upcType` to `PayPalLineItem`

Nitpick but keeps the changelog a little more concise

*
* @param upcType The UPC type.
*/
public void setUpcType(@NonNull String upcType) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public void setUpcType(@NonNull String upcType) {
public void setUpcType(@NonNull @PayPalLineItemUpcType String upcType) {

This type should be added here and in the getter right (and in doc string too probably)? Or is that interface used somewhere else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added interface type to setter and getter annotations

Copy link
Contributor

@sshropshire sshropshire left a comment

Choose a reason for hiding this comment

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

🌊

CHANGELOG.md Outdated Show resolved Hide resolved
@sarahkoop sarahkoop merged commit 666233c into braintree:main Jan 11, 2024
3 checks passed
tdchow added a commit that referenced this pull request Feb 5, 2024
* v5:
  Remove LocalPaymentBrowserSwitchRequest (#900)
  Remove SEPADirectDebitBrowserSwitchRequest and Kotlin Conversion (#901)
  Remove PayPalBrowserSwitchRequest and Kotlin Conversion (#899)
  Update LocalPaymentLauncher for Browser Switch v3 (#897)
  Drop -m drop FPTI v1/tracking/batch/events URL (#896)
  PayPalLauncher with v3 BrowserSwitchClient (#883)
  SEPADirectDebitLauncher with v3 BrowserSwitchClient (#893)
  Prepare for development
  Release 4.41.0
  Update Venmo demo to send MULTI_USE when vault is enabled (#890)
  BraintreeClient Method Cleanup (#887)
  Update PULL_REQUEST_TEMPLATE.MD
  Adding imageUrl, upcType, upcCode to PayPalLineItem (#871)
  Update mxo 1.2.1 (#881)
  Update README.md

# Conflicts:
#	LocalPayment/src/main/java/com/braintreepayments/api/LocalPaymentClient.java
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.

4 participants