Skip to content

Commit

Permalink
fix: Removal of PAYMENT_STATE.PROCESSING, this state is internal to…
Browse files Browse the repository at this point in the history
… the Titan backend.
  • Loading branch information
grmartin committed Jun 29, 2023
1 parent e3f4f48 commit bdd666e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/payment/PaymentProcessingModal.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const basketStoreGenerator = (paymentState = PAYMENT_STATE.DEFAULT, keepPolling
}
);

const shouldPoll = (payState) => payState === PAYMENT_STATE.PENDING || payState === PAYMENT_STATE.PROCESSING;
const shouldPoll = (payState) => payState === PAYMENT_STATE.PENDING;

const buildDescription = (tp) => `is ${shouldPoll(tp.status) ? '' : 'NOT '}shown (status == '${tp.status}')`;

Expand Down Expand Up @@ -80,7 +80,6 @@ describe('<PaymentProcessingModal />', () => {

/* eslint-disable no-multi-spaces */
const tests = [
{ expect: true, status: PAYMENT_STATE.PROCESSING },
{ expect: true, status: PAYMENT_STATE.PENDING },
{ expect: false, status: PAYMENT_STATE.FAILED },
{ expect: false, status: PAYMENT_STATE.DEFAULT },
Expand Down
6 changes: 1 addition & 5 deletions src/payment/data/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ export const PAYMENT_STATE = (((webserviceEnum = {
* Payment is Pending
*/
PENDING: 'pending',
/**
* Async Processing of payment is ongoing.
*/
PROCESSING: 'processing',
}) => ({
...webserviceEnum,

Expand All @@ -64,6 +60,6 @@ export const PAYMENT_STATE = (((webserviceEnum = {
* @see PAYMENT_STATE
*/
export const POLLING_PAYMENT_STATES = [
PAYMENT_STATE.PROCESSING,
PAYMENT_STATE.PENDING,
PAYMENT_STATE.HTTP_ERROR,
];
6 changes: 3 additions & 3 deletions src/payment/data/redux.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ describe('redux tests', () => {
{
basket: {
foo: 'bar',
paymentState: PAYMENT_STATE.PROCESSING,
paymentState: PAYMENT_STATE.PENDING,
basketId: 7,
payments: [
{ paymentNumber: 7 },
Expand All @@ -254,15 +254,15 @@ describe('redux tests', () => {

triggerStore.dispatch(updatePaymentState());
expect(triggerStore.getState().payment.basket.paymentStatePolling.keepPolling).toBe(true);
expect(triggerStore.getState().payment.basket.paymentState).toBe(PAYMENT_STATE.PROCESSING);
expect(triggerStore.getState().payment.basket.paymentState).toBe(PAYMENT_STATE.PENDING);

triggerStore.dispatch({ type: PAYMENT_STATE_DATA_RECEIVED, payload: { state: PAYMENT_STATE.COMPLETED } });
expect(triggerStore.getState().payment.basket.paymentStatePolling.keepPolling).toBe(false);
expect(triggerStore.getState().payment.basket.paymentState).toBe(PAYMENT_STATE.COMPLETED);

triggerStore.dispatch(updatePaymentState.fulfill());
expect(triggerStore.getState().payment.basket.paymentStatePolling.keepPolling).toBe(false);
expect(triggerStore.getState().payment.basket.paymentState === PAYMENT_STATE.PROCESSING).toBe(false);
expect(triggerStore.getState().payment.basket.paymentState === PAYMENT_STATE.PENDING).toBe(false);
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/payment/data/sagas.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ describe('saga tests', () => {
payment: {
basket: {
foo: 'bar',
paymentState: PAYMENT_STATE.PROCESSING,
paymentState: PAYMENT_STATE.PENDING,
basketId: 7,
payments: [
{ paymentNumber: 7 },
Expand Down

0 comments on commit bdd666e

Please sign in to comment.