Skip to content

Commit

Permalink
chore: add activiation failure generation
Browse files Browse the repository at this point in the history
  • Loading branch information
mastro993 committed Jan 8, 2024
1 parent 3483834 commit d149962
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
18 changes: 14 additions & 4 deletions src/features/wallet/routers/payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,21 @@ addPaymentHandler("post", "/transactions", (req, res) =>
() => res.sendStatus(400),
({ paymentNotices }) =>
pipe(
paymentNotices,
getNewTransactionResponsePayload,
ioDevServerConfig.features.wallet?.activationFailure,
WalletPaymentFailure.decode,
O.fromEither,
O.fold(
() => res.sendStatus(404),
transaction => res.status(200).json(transaction)
() =>
pipe(
paymentNotices,
getNewTransactionResponsePayload,
O.fold(
() => res.sendStatus(404),
transaction => res.status(200).json(transaction)
)
),
failure =>
res.status(getStatusCodeForWalletFailure(failure)).json(failure)
)
)
)
Expand Down
3 changes: 2 additions & 1 deletion src/features/wallet/types/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import * as t from "io-ts";
import { WalletPaymentFailure } from "./failure";

export const WalletConfiguration = t.partial({
verificationFailure: WalletPaymentFailure
verificationFailure: WalletPaymentFailure,
activationFailure: WalletPaymentFailure
});

export type WalletConfiguration = t.TypeOf<typeof WalletConfiguration>;

0 comments on commit d149962

Please sign in to comment.