Skip to content

Commit 2dae959

Browse files
authored
[VGS-EBANX] Enable VGS fields in production (#107842)
* enable vgs fields prod * localize some strings
1 parent 40c0ac6 commit 2dae959

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

client/my-sites/checkout/src/hooks/use-vgs-form-validation.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { useVGSCollectFormInstance } from '@vgs/collect-js-react';
77
import { useCallback } from '@wordpress/element';
8+
import { __ } from '@wordpress/i18n';
89
import type { VGS } from '@vgs/collect-js';
910

1011
/**
@@ -53,28 +54,28 @@ export function getVgsFormValidationError( formData: VGS.FormData ): string | nu
5354
if ( fieldName === 'card_number' || fieldName === 'card-number' ) {
5455
switch ( errorCode ) {
5556
case 1001:
56-
return 'Card number is required.';
57+
return __( 'Card number is required.', 'calypso' );
5758
case 1011:
58-
return 'Card number is invalid.';
59+
return __( 'Card number is invalid.', 'calypso' );
5960
}
6061
} else if ( fieldName === 'card_exp' || fieldName === 'card-expiration-date' ) {
6162
switch ( errorCode ) {
6263
case 1001:
63-
return 'Expiration date is required.';
64+
return __( 'Expiration date is required.', 'calypso' );
6465
case 1015:
65-
return 'Expiration date is invalid.';
66+
return __( 'Expiration date is invalid.', 'calypso' );
6667
}
6768
} else if ( fieldName === 'card_cvc' || fieldName === 'card-security-code' ) {
6869
switch ( errorCode ) {
6970
case 1001:
70-
return 'Security code is required.';
71+
return __( 'Security code is required.', 'calypso' );
7172
case 1017:
72-
return 'Security code is invalid.';
73+
return __( 'Security code is invalid.', 'calypso' );
7374
}
7475
}
7576

7677
// Default error message
77-
return error.message || 'Please check your card details.';
78+
return error.message || __( 'Please check your card details.', 'calypso' );
7879
}
7980

8081
/**
@@ -91,15 +92,18 @@ export function useVgsFormValidation() {
9192
if ( ! form ) {
9293
return {
9394
isValid: false,
94-
errorMessage: 'Payment form is not ready. Please wait for the form to load.',
95+
errorMessage: __(
96+
'Payment form is not ready. Please wait for the form to load.',
97+
'calypso'
98+
),
9599
};
96100
}
97101

98102
const formData = form.state;
99103
if ( ! formData ) {
100104
return {
101105
isValid: false,
102-
errorMessage: 'Please enter your card details.',
106+
errorMessage: __( 'Please enter your card details.', 'calypso' ),
103107
};
104108
}
105109

config/production.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"checkout/ebanx-pix": true,
3636
"checkout/google-pay": true,
3737
"checkout/razorpay": false,
38+
"checkout/vgs-ebanx": true,
3839
"cookie-banner": true,
3940
"current-site/domain-warning": false,
4041
"current-site/notice": true,

0 commit comments

Comments
 (0)