Skip to content

Commit

Permalink
fix: Misc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
julianajlk committed Apr 23, 2024
1 parent 7216e10 commit f03dd90
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/how_tos/feedback.rst
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ pre-built APIs that do not follow the format of the feedback module in the:
* `feedback/data/sagas.js`_

* ``basket-changed-error-message``
* ``dynamic-payment-methods-country-not-compatible``
* ``transaction-declined-message``
* ``error_message`` in URL parameters

Expand Down
15 changes: 10 additions & 5 deletions src/payment/PaymentPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { AppContext } from '@edx/frontend-platform/react';
import { sendPageEvent } from '@edx/frontend-platform/analytics';

import messages from './PaymentPage.messages';
import { handleApiError } from './data/handleRequestError';
import handleRequestError from './data/handleRequestError';

// Actions
import { fetchBasket } from './data/actions';
Expand Down Expand Up @@ -80,13 +80,18 @@ class PaymentPage extends React.Component {
// Get Payment Intent to retrieve the payment status and order number associated with this DPM payment.
// If this is not a Stripe dynamic payment methods (BNPL), URL will not contain any params
// and should not retrieve the Payment Intent.
// TODO: depending on if we'll use this MFE in the future, refactor to follow the redux pattern with actions
// and reducers for getting the Payment Intent is more appropriate.
const searchParams = new URLSearchParams(global.location.search);
const clientSecretId = searchParams.get('payment_intent_client_secret');
if (clientSecretId) {
const { paymentIntent, error } = await this.state.stripe.retrievePaymentIntent(clientSecretId);
if (error) { handleApiError(error); }
this.setState({ orderNumber: paymentIntent.description });
this.setState({ paymentStatus: paymentIntent.status });
try {
const { paymentIntent } = await this.state.stripe.retrievePaymentIntent(clientSecretId);
this.setState({ orderNumber: paymentIntent?.description });
this.setState({ paymentStatus: paymentIntent?.status });
} catch (error) {
handleRequestError(error);
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/payment/checkout/Checkout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ Checkout.propTypes = {
paymentMethod: PropTypes.oneOf(['paypal', 'apple-pay', 'cybersource', 'stripe']),
orderType: PropTypes.oneOf(Object.values(ORDER_TYPES)),
enableStripePaymentProcessor: PropTypes.bool,
stripe: PropTypes.func,
stripe: PropTypes.object, // eslint-disable-line react/forbid-prop-types
clientSecretId: PropTypes.string,
};

Expand Down

0 comments on commit f03dd90

Please sign in to comment.