From bbf8ab12c1898b6ff20a0eb5e4026907a4c21afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Wed, 18 Dec 2024 16:27:03 +0000 Subject: [PATCH] chore: Remove redundant `getPayNode()` function (#586) --- src/requests/payment-request.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/requests/payment-request.ts b/src/requests/payment-request.ts index e74c04b7..b1f20865 100644 --- a/src/requests/payment-request.ts +++ b/src/requests/payment-request.ts @@ -102,7 +102,7 @@ export async function createPaymentRequest( console.error(`Unable to generate fee breakdown for session ${sessionId}`); } - const paymentAmountPounds = await getPaymentAmount(payNode, session); + const paymentAmountPounds = await getPaymentAmount(session); if (!paymentAmountPounds) throw new Error("Payment amount not found in passport"); @@ -225,19 +225,11 @@ async function getPayNode( /** * Find the payment amount from the the passport */ -async function getPaymentAmount( - payNode: PayNode, - session: Session, -): Promise { - const amountKey = getPaymentAmountKey(payNode); +async function getPaymentAmount(session: Session): Promise { + const amountKey = "application.fee.payable"; return new Passport(session.data.passport).number([amountKey]); } -function getPaymentAmountKey(payNode: PayNode) { - const defaultPaymentKey = "application.fee.payable"; - return payNode.data.fn || defaultPaymentKey; -} - export async function _markPaymentRequestAsPaid( client: GraphQLClient, paymentRequestId: string,