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

Pass GooglePayLauncher arguments to DefaultGooglePayRepository #4157

Merged
merged 5 commits into from
Sep 9, 2021
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
1 change: 1 addition & 0 deletions example/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<activity android:name=".activity.CreateCardPaymentMethodActivity" />
<activity android:name=".activity.PaymentSessionActivity" />
<activity android:name=".activity.GooglePayLauncherIntegrationActivity" />
<activity android:name=".activity.GooglePayLauncherPlaygroundActivity" />
<activity android:name=".activity.GooglePayPaymentMethodLauncherIntegrationActivity" />
<activity android:name=".activity.PaymentAuthActivity" />
<activity android:name=".activity.FragmentExamplesActivity" />
Expand Down
232 changes: 232 additions & 0 deletions example/res/layout/google_pay_activity_playground.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
<?xml version="1.0" encoding="utf-8"?>

<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress_bar"
style="@style/Widget.MaterialComponents.LinearProgressIndicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true" />

<RadioGroup
android:id="@+id/google_pay_environment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="8dp">

<TextView
android:text="@string/google_pay_environment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />

<RadioButton
android:id="@+id/google_pay_environment_test"
android:text="@string/google_pay_environment_test"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true" />

<RadioButton
android:id="@+id/google_pay_environment_production"
android:text="@string/google_pay_environment_production"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RadioGroup>


<RadioGroup
android:id="@+id/google_pay_billing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="8dp">

<TextView
android:text="@string/google_pay_billing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />

<RadioButton
android:id="@+id/google_pay_billing_min"
android:text="@string/google_pay_billing_min"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true" />

<RadioButton
android:id="@+id/google_pay_billing_full"
android:text="@string/google_pay_billing_full"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RadioGroup>

<RadioGroup
android:id="@+id/google_pay_existing_pm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="8dp">

<TextView
android:text="@string/google_pay_existing_payment_method"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />

<RadioButton
android:id="@+id/google_pay_existing_pm_true"
android:text="@string/google_pay_existing_payment_method_true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true" />

<RadioButton
android:id="@+id/google_pay_existing_pm_false"
android:text="@string/google_pay_existing_payment_method_false"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RadioGroup>

<RadioGroup
android:id="@+id/google_pay_phone_required"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="8dp">

<TextView
android:text="@string/google_pay_phone_required"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />

<RadioButton
android:id="@+id/google_pay_phone_required_true"
android:text="@string/google_pay_phone_required_true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true" />

<RadioButton
android:id="@+id/google_pay_phone_required_false"
android:text="@string/google_pay_phone_required_false"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RadioGroup>

<RadioGroup
android:id="@+id/google_pay_billing_required"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="8dp">

<TextView
android:text="@string/google_pay_billing_required"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />

<RadioButton
android:id="@+id/google_pay_billing_required_true"
android:text="@string/google_pay_billing_required_true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true" />

<RadioButton
android:id="@+id/google_pay_billing_required_false"
android:text="@string/google_pay_billing_required_false"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RadioGroup>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView
android:text="@string/google_pay_merchant_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:labelFor="@+id/google_pay_merchant_name"
android:layout_weight=".4" />

<EditText
android:id="@+id/google_pay_merchant_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="text"
android:text="@string/google_pay_merchant_name_default"
android:importantForAutofill="no" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView
android:text="@string/google_pay_merchant_country_code"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:labelFor="@+id/google_pay_merchant_country_code"
android:layout_weight=".4" />

<EditText
android:id="@+id/google_pay_merchant_country_code"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="text"
android:text="@string/google_pay_merchant_country_code_default"
android:importantForAutofill="no" />
</LinearLayout>

<com.stripe.example.activity.GooglePayButton
android:id="@+id/google_pay_button"
android:layout_width="200dp"
android:layout_height="48sp"
android:layout_gravity="center_horizontal" />

<TextView
android:id="@+id/google_pay_result"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:fontFamily="monospace"
android:textSize="12sp" />

</LinearLayout>
</ScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
20 changes: 20 additions & 0 deletions example/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<string name="customer_payment_data_example">Customer Payment Selection</string>
<string name="launch_customer_session">Customer Session</string>
<string name="googlepaylauncher_example">Confirm payment with GooglePayLauncher</string>
<string name="googlepayplayground_example">Test GooglePayLauncher Configurations</string>
<string name="googlepaypaymentmethodlauncher_example">Create payment method with GooglePayPaymentMethodLauncher</string>
<string name="launch_payment_session">Payment Session</string>
<string name="launch_payment_session_from_fragment">Fragment Examples</string>
Expand Down Expand Up @@ -96,5 +97,24 @@
<!-- <UPI> -->
<string name="vpa_layout_hint">Virtual Payment Address (VPA)</string>
<string name="vpa_input_hint">something@stripeupi</string>
<string name="google_pay_environment_test">Test</string>
<string name="google_pay_environment_production">Production *charges apply</string>
<string name="google_pay_environment">Environment</string>
<string name="google_pay_billing">Billing</string>
<string name="google_pay_billing_min">Min</string>
<string name="google_pay_billing_full">Full</string>
<string name="google_pay_existing_payment_method">Existing Payment Method</string>
<string name="google_pay_existing_payment_method_true">True</string>
<string name="google_pay_existing_payment_method_false">False</string>
<string name="google_pay_phone_required">Phone Required</string>
<string name="google_pay_phone_required_true">True</string>
<string name="google_pay_phone_required_false">False</string>
<string name="google_pay_billing_required">Billing Required</string>
<string name="google_pay_billing_required_true">True</string>
<string name="google_pay_billing_required_false">False</string>
<string name="google_pay_merchant_name">Merchant Name</string>
<string name="google_pay_merchant_name_default">Widget Store</string>
<string name="google_pay_merchant_country_code">Merchant Country Code</string>
<string name="google_pay_merchant_country_code_default">US</string>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class GooglePayLauncherIntegrationActivity : StripeIntentActivity() {
isRequired = true,
format = GooglePayLauncher.BillingAddressConfig.Format.Full,
isPhoneNumberRequired = true
)
),
existingPaymentMethodRequired = true
),
readyCallback = ::onGooglePayReady,
resultCallback = ::onGooglePayResult
Expand Down
Loading