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 (