From effb1eda1fbb697b0e7fb420f89a9cf14181a443 Mon Sep 17 00:00:00 2001 From: julianajlk Date: Wed, 24 Apr 2024 09:56:46 -0400 Subject: [PATCH 1/4] refactor: DPM loading change to fix lag when payment is succeeded but receipt is not loaded yet --- src/payment/PageLoading.jsx | 20 ++++++++++++++++++++ src/payment/PaymentPage.jsx | 31 +++++++++++++++---------------- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/src/payment/PageLoading.jsx b/src/payment/PageLoading.jsx index de61fb2b7..15e55c167 100644 --- a/src/payment/PageLoading.jsx +++ b/src/payment/PageLoading.jsx @@ -1,5 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; +import { getConfig } from '@edx/frontend-platform'; +import { logInfo } from '@edx/frontend-platform/logging'; export default class PageLoading extends Component { renderSrMessage() { @@ -15,6 +17,17 @@ export default class PageLoading extends Component { } render() { + const { shouldRedirectToReceipt, orderNumber } = this.props; + + if (shouldRedirectToReceipt) { + logInfo(`Dynamic Payment Methods payment succeeded for edX order number ${orderNumber}, redirecting to ecommerce receipt page.`); + const queryParams = `order_number=${orderNumber}&disable_back_button=${Number(true)}&dpm_enabled=${true}`; + if (getConfig().ENVIRONMENT !== 'test') { + /* istanbul ignore next */ + global.location.assign(`${getConfig().ECOMMERCE_BASE_URL}/checkout/receipt/?${queryParams}`); + } + } + return (
+ ); + } + // In all other cases, we want to render the basket content. This is used before we've loaded // anything, during loading, and after we've loaded a basket with a product in it. From 923636c27c3c5ddb8dddcd7a84cab7afd994196e Mon Sep 17 00:00:00 2001 From: julianajlk Date: Wed, 24 Apr 2024 10:01:10 -0400 Subject: [PATCH 2/4] fix: Silence old warning on CouponForm --- src/payment/cart/CouponForm.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/payment/cart/CouponForm.jsx b/src/payment/cart/CouponForm.jsx index d65ad2469..a79619a8f 100644 --- a/src/payment/cart/CouponForm.jsx +++ b/src/payment/cart/CouponForm.jsx @@ -44,7 +44,7 @@ class CouponForm extends Component { return (
- +