Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
feat: added transaction_declined error handler (#756)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrazadar authored Jun 5, 2023
1 parent 3e206d6 commit f709549
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/feedback/data/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export function* handleSubscriptionErrors(e, clearExistingMessages) {
'basket_changed_error',
'program_unavailable',
'ineligible_program',
'payment_attachment_error',
];
if (error.code !== 'empty_subscription') {
if (customErrors.includes(error.code)) {
Expand Down
7 changes: 5 additions & 2 deletions src/subscription/alerts/SubscriptionAlerts.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react';
import AlertList from '../../feedback/AlertList';

import { BasketChangedError } from '../../payment/AlertCodeMessages';
import {
BasketChangedError,
TransactionDeclined,
} from '../../payment/AlertCodeMessages';

import {
EmbargoErrorMessage,
Expand All @@ -21,6 +23,7 @@ export const SubscriptionAlerts = () => (
basket_changed_error: (<BasketChangedError />),
program_unavailable: (<ProgramUnavailableMessage />),
ineligible_program: (<IneligibleProgramErrorMessage />),
payment_attachment_error: (<TransactionDeclined />),
}}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions src/subscription/data/details/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function* handleFetchSubscriptionDetails() {
}
}

export function* handleSubmitPayment({ payload }) {
export function* handleSubmitSubscription({ payload }) {
if (yield isSubscriptionDetailsProcessing()) {
return;
}
Expand Down Expand Up @@ -126,4 +126,4 @@ export function* handleSubmitPayment({ payload }) {
}
}

export default handleSubmitPayment;
export default handleSubmitSubscription;
4 changes: 2 additions & 2 deletions src/subscription/data/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {

// details
import { fetchSubscriptionDetails, submitSubscription } from './details/actions';
import { handleFetchSubscriptionDetails, handleSubmitPayment } from './details/sagas';
import { handleFetchSubscriptionDetails, handleSubmitSubscription } from './details/sagas';

export default function* saga() {
yield takeLatest(submitSubscription.TRIGGER, handleSubmitPayment);
yield takeLatest(submitSubscription.TRIGGER, handleSubmitSubscription);
yield takeLatest(fetchSubscriptionDetails.TRIGGER, handleFetchSubscriptionDetails);
}

0 comments on commit f709549

Please sign in to comment.