Skip to content

Commit

Permalink
fix(Bonus Pagamenti Digitali): [#175396286] Handle 404 for bpd paymen…
Browse files Browse the repository at this point in the history
…t activation status (#2309)

* [#175396286] handle 404 for bpd payment activation status

* fix
  • Loading branch information
fabriziofff authored Oct 22, 2020
1 parent af65bdf commit 011489c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ts/features/bonus/bpd/saga/networking/paymentMethod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ const convertNetworkPayload = (
deactivationDate: networkPayload.deactivationDate
});

// return BpdPaymentMethodActivation when network response is conflict (409)
/**
* return {@link BpdPaymentMethodActivation} when network response is conflict (409)
*/
const whenConflict = (hPan: HPan): BpdPaymentMethodActivation => ({
hPan,
activationStatus: "notActivable"
Expand Down Expand Up @@ -70,6 +72,14 @@ export function* bpdLoadPaymentMethodActivationSaga(
bpdPaymentMethodActivation.success(whenConflict(action.payload))
);
return;
} else if (findPaymentMethodResult.value.status === 404) {
yield put(
bpdPaymentMethodActivation.success({
hPan: action.payload,
activationStatus: "inactive"
})
);
return;
}
throw new Error(
`response status ${findPaymentMethodResult.value.status}`
Expand Down

0 comments on commit 011489c

Please sign in to comment.