File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,6 +63,13 @@ export function buildPaymentInfo(
6363 }
6464}
6565
66+ /**
67+ * @param {number } amount
68+ */
69+ export function convertPenceToPounds ( amount ) {
70+ return `${ amount / 100 } `
71+ }
72+
6673/**
6774 * @import { Request } from '@hapi/hapi'
6875 * @import { GetPaymentResponse, PaymentSessionData } from '~/src/server/plugins/payment/types.js'
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { createLogger } from '~/src/server/common/helpers/logging/logger.js'
66import { EXTERNAL_STATE_APPENDAGE } from '~/src/server/constants.js'
77import {
88 buildPaymentInfo ,
9+ convertPenceToPounds ,
910 getPaymentContext
1011} from '~/src/server/plugins/engine/routes/payment-helper.js'
1112
@@ -64,7 +65,7 @@ function logPaymentSuccess(session, paymentStatus) {
6465 buildPaymentInfo (
6566 'pre-auth' ,
6667 'success' ,
67- `${ paymentStatus . state . status } amount=${ paymentStatus . amount / 100 } ` ,
68+ `${ paymentStatus . state . status } amount=${ convertPenceToPounds ( paymentStatus . amount ) } ` ,
6869 session . isLivePayment ,
6970 paymentStatus . paymentId
7071 ) ,
@@ -82,7 +83,7 @@ function logPaymentFailure(session, paymentStatus) {
8283 buildPaymentInfo (
8384 'pre-auth' ,
8485 'failed/cancelled' ,
85- `${ paymentStatus . state . status } amount=${ paymentStatus . amount / 100 } ` ,
86+ `${ paymentStatus . state . status } amount=${ convertPenceToPounds ( paymentStatus . amount ) } ` ,
8687 session . isLivePayment ,
8788 paymentStatus . paymentId
8889 ) ,
Original file line number Diff line number Diff line change 11import { StatusCodes } from 'http-status-codes'
22
33import { createLogger } from '~/src/server/common/helpers/logging/logger.js'
4- import { buildPaymentInfo } from '~/src/server/plugins/engine/routes/payment-helper.js'
4+ import {
5+ buildPaymentInfo ,
6+ convertPenceToPounds
7+ } from '~/src/server/plugins/engine/routes/payment-helper.js'
58import { get , post , postJson } from '~/src/server/services/httpService.js'
69
710const PAYMENT_BASE_URL = 'https://publicapi.payments.service.gov.uk'
@@ -60,7 +63,7 @@ export class PaymentService {
6063 buildPaymentInfo (
6164 'create-payment' ,
6265 'success' ,
63- `amount=${ amount / 100 } ` ,
66+ `amount=${ convertPenceToPounds ( amount ) } ` ,
6467 isLivePayment ,
6568 response . payment_id
6669 ) ,
@@ -156,7 +159,7 @@ export class PaymentService {
156159 category : 'payment' ,
157160 action : 'capture-payment' ,
158161 outcome : 'success' ,
159- reason : `amount=${ amount / 100 } ` ,
162+ reason : `amount=${ convertPenceToPounds ( amount ) } ` ,
160163 reference : paymentId
161164 }
162165 } ,
You can’t perform that action at this time.
0 commit comments