@@ -31,7 +31,7 @@ import {
3131} from '~/src/server/plugins/engine/types.js'
3232import {
3333 createPaymentService ,
34- formatPaymentAmount
34+ formatCurrency
3535} from '~/src/server/plugins/payment/helper.js'
3636
3737export class PaymentField extends FormComponent {
@@ -94,7 +94,7 @@ export class PaymentField extends FormComponent {
9494 return ''
9595 }
9696
97- return `${ formatPaymentAmount ( value . amount ) } - ${ value . description } `
97+ return `${ formatCurrency ( value . amount ) } - ${ value . description } `
9898 }
9999
100100 getViewModel ( payload : FormPayload , errors ?: FormSubmissionError [ ] ) {
@@ -108,14 +108,9 @@ export class PaymentField extends FormComponent {
108108 // When user initially visits the payment page, there is no payment state yet so the amount is read form the form definition.
109109 const amount = paymentState ?. amount ?? this . options . amount
110110
111- const formattedAmount = new Intl . NumberFormat ( 'en-GB' , {
112- minimumFractionDigits : 2 ,
113- maximumFractionDigits : 2
114- } ) . format ( amount )
115-
116111 return {
117112 ...viewModel ,
118- amount : formattedAmount ,
113+ amount : formatCurrency ( amount ) ,
119114 description : this . options . description ,
120115 paymentState
121116 }
@@ -159,7 +154,7 @@ export class PaymentField extends FormComponent {
159154
160155 getContextValueFromState ( state : FormSubmissionState ) {
161156 return this . isPaymentState ( state )
162- ? `Reference: ${ state . reference } \nAmount: ${ formatPaymentAmount ( state . amount ) } `
157+ ? `Reference: ${ state . reference } \nAmount: ${ formatCurrency ( state . amount ) } `
163158 : ''
164159 }
165160
0 commit comments