-
Notifications
You must be signed in to change notification settings - Fork 238
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
[DO NOT REVIEW] Merge Contact Information Feature Branch #1250
Open
jaxdesmarais
wants to merge
5
commits into
main
Choose a base branch
from
contact-information-feature
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
26d6a65
Add Contact Information request object (#1224)
richherrera cdda934
Add contact information toggle (#1225)
richherrera acb1d2e
Merge branch 'main' into contact-information-feature
jaxdesmarais 45acd93
Merge branch 'main' into contact-information-feature
richherrera 028271a
PR feedback: add missing docstrings
jaxdesmarais File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
import com.braintreepayments.api.paypal.PayPalBillingInterval; | ||
import com.braintreepayments.api.paypal.PayPalBillingPricing; | ||
import com.braintreepayments.api.paypal.PayPalCheckoutRequest; | ||
import com.braintreepayments.api.paypal.PayPalContactInformation; | ||
import com.braintreepayments.api.paypal.PayPalLandingPageType; | ||
import com.braintreepayments.api.paypal.PayPalPaymentIntent; | ||
import com.braintreepayments.api.paypal.PayPalPaymentUserAction; | ||
|
@@ -112,7 +113,8 @@ public static PayPalCheckoutRequest createPayPalCheckoutRequest( | |
String amount, | ||
String buyerEmailAddress, | ||
String buyerPhoneCountryCode, | ||
String buyerPhoneNationalNumber | ||
String buyerPhoneNationalNumber, | ||
Boolean isContactInformationEnabled | ||
) { | ||
PayPalCheckoutRequest request = new PayPalCheckoutRequest(amount, true); | ||
|
||
|
@@ -159,6 +161,10 @@ public static PayPalCheckoutRequest createPayPalCheckoutRequest( | |
request.setShippingAddressOverride(shippingAddress); | ||
} | ||
|
||
if (isContactInformationEnabled) { | ||
request.setContactInformation(new PayPalContactInformation("[email protected]", new PayPalPhoneNumber("1", "1234567890"))); | ||
} | ||
|
||
return request; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
PayPal/src/main/java/com/braintreepayments/api/paypal/PayPalContactInformation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.braintreepayments.api.paypal | ||
|
||
import android.os.Parcelable | ||
import kotlinx.parcelize.Parcelize | ||
|
||
/** | ||
* Representation of a recipient Contact Information for the order. | ||
* | ||
* @property recipientEmail Email address of the recipient. | ||
* @property recipentPhoneNumber Phone number of the recipient. | ||
*/ | ||
@Parcelize | ||
data class PayPalContactInformation( | ||
val recipientEmail: String? = null, | ||
val recipentPhoneNumber: PayPalPhoneNumber? = null | ||
) : Parcelable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,4 +171,37 @@ public void createRequestBody_sets_userPhoneNumber_when_not_null() throws JSONEx | |
|
||
assertTrue(requestBody.contains("\"phone_number\":{\"country_code\":\"1\",\"national_number\":\"1231231234\"}")); | ||
} | ||
|
||
@Test | ||
public void createRequestBody_sets_contactInformation_when_not_null() throws JSONException { | ||
PayPalCheckoutRequest request = new PayPalCheckoutRequest("1.00", true); | ||
|
||
request.setContactInformation(new PayPalContactInformation("[email protected]", new PayPalPhoneNumber("1", "1234567890"))); | ||
String requestBody = request.createRequestBody( | ||
mock(Configuration.class), | ||
mock(Authorization.class), | ||
"success_url", | ||
"cancel_url", | ||
null | ||
); | ||
|
||
assertTrue(requestBody.contains("\"recipient_email\":\"[email protected]\"")); | ||
assertTrue(requestBody.contains("\"international_phone\":{\"country_code\":\"1\",\"national_number\":\"1234567890\"}")); | ||
} | ||
|
||
@Test | ||
public void createRequestBody_does_not_set_contactInformation_when_contactInformation_is_null() throws JSONException { | ||
PayPalCheckoutRequest request = new PayPalCheckoutRequest("1.00", true); | ||
|
||
String requestBody = request.createRequestBody( | ||
mock(Configuration.class), | ||
mock(Authorization.class), | ||
"success_url", | ||
"cancel_url", | ||
null | ||
); | ||
|
||
assertFalse(requestBody.contains("\"recipient_email\":\"[email protected]\"")); | ||
assertFalse(requestBody.contains("\"international_phone\":{\"country_code\":\"1\",\"national_number\":\"1234567890\"}")); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is the final PR not requiring review but realized we are missing the doc string for this property - iOS has
Optional: Contact information of the recipient for the order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, looks like we don't use the
Optional
part on Android based on the docstrings here, added the missing one here: 028271a