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

Shopper insights rp1 feature include session #1235

Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove DEMO UI updates
  • Loading branch information
warmkesselj committed Dec 6, 2024
commit 737f16fe0ce9b1375d1b3669290cd0d00da1c24c
Original file line number Diff line number Diff line change
@@ -49,7 +49,6 @@ class ShopperInsightsFragment : BaseFragment() {
private lateinit var nationalNumberInput: TextInputLayout
private lateinit var emailNullSwitch: SwitchMaterial
private lateinit var phoneNullSwitch: SwitchMaterial
private lateinit var shopperInsightsSessionIdInput: TextInputLayout
private lateinit var shopperInsightsSessionIdNullSwitch: SwitchMaterial

private lateinit var shopperInsightsClient: ShopperInsightsClient
@@ -62,12 +61,14 @@ class ShopperInsightsFragment : BaseFragment() {
private lateinit var venmoStartedPendingRequest: VenmoPendingRequest.Started
private lateinit var paypalStartedPendingRequest: PayPalPendingRequest.Started

private var sessionId: String = "test-shopper-session-id"

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
shopperInsightsClient = ShopperInsightsClient(requireContext(), authStringArg, "test-shopper-session-id")
shopperInsightsClient = ShopperInsightsClient(requireContext(), authStringArg, sessionId)

venmoClient = VenmoClient(requireContext(), super.getAuthStringArg(), null)
payPalClient = PayPalClient(
@@ -97,13 +98,9 @@ class ShopperInsightsFragment : BaseFragment() {
nationalNumberInput = view.findViewById(R.id.nationalNumberInput)
emailNullSwitch = view.findViewById(R.id.emailNullSwitch)
phoneNullSwitch = view.findViewById(R.id.phoneNullSwitch)
shopperInsightsSessionIdInput = view.findViewById(R.id.shopperInsightsSessionIdInput)
shopperInsightsSessionIdNullSwitch = view.findViewById(R.id.shopperInsightsSessionIdNullSwitch)


emailInput.editText?.setText("PR1_merchantname@personal.example.com")
nationalNumberInput.editText?.setText("4082321001")
shopperInsightsSessionIdInput.editText?.setText("shopperSessionId")
countryCodeInput.editText?.setText("1")
}

@@ -229,18 +226,14 @@ class ShopperInsightsFragment : BaseFragment() {
private fun launchPayPalVault() {
shopperInsightsClient.sendPayPalSelectedEvent()

val shopperSessionId =
if (shopperInsightsSessionIdNullSwitch.isChecked) null
else shopperInsightsSessionIdInput.editText?.text.toString()

payPalClient.createPaymentAuthRequest(
requireContext(),
PayPalRequestFactory.createPayPalVaultRequest(
activity,
emailInput.editText?.text.toString(),
countryCodeInput.editText?.text.toString(),
nationalNumberInput.editText?.text.toString(),
shopperSessionId
sessionId

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

)
) { authRequest ->
29 changes: 1 addition & 28 deletions Demo/src/main/res/layout/fragment_shopping_insights.xml
Original file line number Diff line number Diff line change
@@ -79,23 +79,6 @@
android:hint="@string/insights_text_input_national_number" />
</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/shopperInsightsSessionIdInput"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintEnd_toStartOf="@+id/shopperInsightsSessionIdNullSwitch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/countryCodeInput">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Session Id" />
</com.google.android.material.textfield.TextInputLayout>

<TextView
android:id="@+id/responseTextView"
android:layout_width="0dp"
@@ -118,7 +101,7 @@
android:text="@string/insights_action_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/shopperInsightsSessionIdInput" />
app:layout_constraintTop_toBottomOf="@+id/countryCodeInput" />

<Button
android:id="@+id/payPalVaultButton"
@@ -166,16 +149,6 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/nationalNumberInput" />

<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/shopperInsightsSessionIdNullSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:text="@string/insights_null_switch"
app:layout_constraintBottom_toBottomOf="@+id/shopperInsightsSessionIdInput"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/shopperInsightsSessionIdInput" />

<View
android:id="@+id/view3"
android:layout_width="match_parent"
Loading