Commit a1e88434 authored by Liquan (Max) Gu's avatar Liquan (Max) Gu Committed by Commit Bot

[WebLayer] Reorder continueShow()

Reorders CPRService#continueShow() so that the method can be separated
into two parts: the part that will stay in CPRService and the part that
will be moved into PRService.

Bug: 1131059

Change-Id: I93c57a3b7b8ee957b4fd5695243f05ad65e040ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2533024Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826422}
parent 2da3fe20
...@@ -509,22 +509,12 @@ public class ChromePaymentRequestService implements BrowserPaymentRequest, ...@@ -509,22 +509,12 @@ public class ChromePaymentRequestService implements BrowserPaymentRequest,
// mSpec.updateWith() can be used only when mSpec has not been destroyed. // mSpec.updateWith() can be used only when mSpec has not been destroyed.
assert !mSpec.isDestroyed(); assert !mSpec.isDestroyed();
ChromeActivity chromeActivity = ChromeActivity.fromWebContents(mWebContents);
if (chromeActivity == null) {
mJourneyLogger.setNotShown(NotShownReason.OTHER);
disconnectFromClientWithDebugMessage(ErrorStrings.ACTIVITY_NOT_FOUND);
return;
}
if (!PaymentValidator.validatePaymentDetails(details) if (!PaymentValidator.validatePaymentDetails(details)
|| !parseAndValidateDetailsFurtherIfNeeded(details)) { || !parseAndValidateDetailsFurtherIfNeeded(details)) {
mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER); mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER);
disconnectFromClientWithDebugMessage(ErrorStrings.INVALID_PAYMENT_DETAILS); disconnectFromClientWithDebugMessage(ErrorStrings.INVALID_PAYMENT_DETAILS);
return; return;
} }
mSpec.updateWith(details);
mPaymentUiService.updateDetailsOnPaymentRequestUI(
mSpec.getPaymentDetails(), mSpec.getRawTotal(), mSpec.getRawLineItems());
if (!TextUtils.isEmpty(details.error)) { if (!TextUtils.isEmpty(details.error)) {
mJourneyLogger.setNotShown(NotShownReason.OTHER); mJourneyLogger.setNotShown(NotShownReason.OTHER);
...@@ -532,6 +522,20 @@ public class ChromePaymentRequestService implements BrowserPaymentRequest, ...@@ -532,6 +522,20 @@ public class ChromePaymentRequestService implements BrowserPaymentRequest,
return; return;
} }
mSpec.updateWith(details);
mPaymentRequestService.resetWaitingForUpdatedDetails();
ChromeActivity chromeActivity = ChromeActivity.fromWebContents(mWebContents);
if (chromeActivity == null) {
mJourneyLogger.setNotShown(NotShownReason.OTHER);
disconnectFromClientWithDebugMessage(ErrorStrings.ACTIVITY_NOT_FOUND);
return;
}
mPaymentUiService.updateDetailsOnPaymentRequestUI(
mSpec.getPaymentDetails(), mSpec.getRawTotal(), mSpec.getRawLineItems());
// Do not create shipping section When UI is not built yet. This happens when the show // Do not create shipping section When UI is not built yet. This happens when the show
// promise gets resolved before all apps are ready. // promise gets resolved before all apps are ready.
if (mPaymentUiService.getPaymentRequestUI() != null if (mPaymentUiService.getPaymentRequestUI() != null
...@@ -539,7 +543,6 @@ public class ChromePaymentRequestService implements BrowserPaymentRequest, ...@@ -539,7 +543,6 @@ public class ChromePaymentRequestService implements BrowserPaymentRequest,
mPaymentUiService.createShippingSectionForPaymentRequestUI(chromeActivity); mPaymentUiService.createShippingSectionForPaymentRequestUI(chromeActivity);
} }
mPaymentRequestService.resetWaitingForUpdatedDetails();
// Triggered transaction amount gets recorded when both of the following conditions are met: // Triggered transaction amount gets recorded when both of the following conditions are met:
// 1- Either Event.Shown or Event.SKIPPED_SHOW bits are set showing that transaction is // 1- Either Event.Shown or Event.SKIPPED_SHOW bits are set showing that transaction is
// triggered (mDidRecordShowEvent == true). 2- The total amount in details won't change // triggered (mDidRecordShowEvent == true). 2- The total amount in details won't change
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment