Skip to content

Commit

Permalink
Add Pay Later setting to demo app. (#1034)
Browse files Browse the repository at this point in the history
  • Loading branch information
sshropshire authored Jun 11, 2024
1 parent 24c9721 commit 1f14788
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public static PayPalCheckoutRequest createPayPalCheckoutRequest(
request.setUserAction(PayPalCheckoutRequest.USER_ACTION_COMMIT);
}

if (Settings.isPayPalPayLaterOffered(context)) {
request.setShouldOfferPayLater(true);
}

if (Settings.usePayPalAddressOverride(context)) {
PostalAddress shippingAddress = new PostalAddress();
shippingAddress.setRecipientName("Brian Tree");
Expand Down
4 changes: 4 additions & 0 deletions Demo/src/main/java/com/braintreepayments/demo/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ public static boolean isPayPalCreditOffered(Context context) {
return getPreferences(context).getBoolean("paypal_credit_offered", false);
}

public static boolean isPayPalPayLaterOffered(Context context) {
return getPreferences(context).getBoolean("paypal_pay_later_offered", false);
}

public static boolean isPayPalSignatureVerificationDisabled(Context context) {
return getPreferences(context).getBoolean("paypal_disable_signature_verification", true);
}
Expand Down
2 changes: 2 additions & 0 deletions Demo/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@
<string name="paypal_useraction_commit_summary">Sets the Payment User Action to Commit for Express Checkout Transactions</string>
<string name="paypal_address_override">Send a shipping address to PayPal</string>
<string name="paypal_address_override_summary">Sends a shipping address as an override option to PayPal for any PayPal request</string>
<string name="paypal_pay_later_offered">Offer PayPal Pay Later</string>
<string name="paypal_pay_later_offered_summary">Offers PayPal Pay Later prominently in the payment flow</string>

<!-- VenmoActivity -->
<string name="bt_descriptor_pay_with_venmo">Venmo</string>
Expand Down
6 changes: 6 additions & 0 deletions Demo/src/main/res/xml/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@
android:summary="@string/paypal_credit_offered_summary"
android:defaultValue="false" />

<CheckBoxPreference
android:key="paypal_pay_later_offered"
android:title="@string/paypal_pay_later_offered"
android:summary="@string/paypal_pay_later_offered_summary"
android:defaultValue="false" />

<ListPreference
android:key="paypal_landing_page_type"
android:title="@string/paypal_landing_page_type"
Expand Down

0 comments on commit 1f14788

Please sign in to comment.