File tree Expand file tree Collapse file tree 2 files changed +1
-52
lines changed Expand file tree Collapse file tree 2 files changed +1
-52
lines changed Original file line number Diff line number Diff line change @@ -121,50 +121,3 @@ export const getCheckOutFieldsLabel = ( field, billingOrShipping ) => {
121
121
export const amazonPayCanMakePayment = ( { cartTotals } , { allowedCurrencies } ) => {
122
122
return allowedCurrencies && allowedCurrencies . length > 0 ? allowedCurrencies . includes ( cartTotals . currency_code ) : true ;
123
123
} ;
124
-
125
-
126
- /**
127
- * Maybe override required field validation.
128
- *
129
- * @param {string } country The country code.
130
- * @returns {array }
131
- */
132
- export const overrideRequiredFieldValidation = ( country ) => {
133
- let overridenFields = [ ] ;
134
-
135
- if ( ! window . amazon_payments_advanced ||
136
- ! window . amazon_payments_advanced . overriden_fields_per_country ||
137
- ! window . amazon_payments_advanced . overriden_fields_per_country [ country ]
138
- ) {
139
- return overridenFields ;
140
- }
141
-
142
- const fieldsToOverride = window . amazon_payments_advanced . overriden_fields_per_country [ country ] ;
143
-
144
- for ( const field of fieldsToOverride ) {
145
- const elem = document . getElementById ( field ) ;
146
- if ( ! elem || ! elem . required ) {
147
- continue ;
148
- }
149
-
150
- elem . required = false ;
151
- overridenFields . push ( field ) ;
152
- }
153
-
154
- return overridenFields ;
155
- }
156
-
157
-
158
- /**
159
- * Restore the required field validation.
160
- *
161
- * @param {array } fields The fields to restore the required validation.
162
- */
163
- export const restoreRequiredFieldValidation = ( fields ) => {
164
- fields . forEach ( field => {
165
- const elem = document . getElementById ( field ) ;
166
- if ( elem ) {
167
- elem . required = true ;
168
- }
169
- } ) ;
170
- }
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import React from 'react';
9
9
/**
10
10
* Internal dependencies
11
11
*/
12
- import { getCheckOutFieldsLabel , overrideRequiredFieldValidation , restoreRequiredFieldValidation } from '../../_utils' ;
12
+ import { getCheckOutFieldsLabel } from '../../_utils' ;
13
13
import { activateChange } from '../../_renderAmazonButton' ;
14
14
import { settings } from './_settings' ;
15
15
@@ -44,13 +44,9 @@ const AmazonPayInfo = ( props ) => {
44
44
45
45
const { amazonBilling, amazonShipping } = settings . amazonAddress ;
46
46
47
- const [ overridenFields , setOverridenFields ] = useState ( [ ] ) ;
48
-
49
47
useEffect ( ( ) => {
50
48
const unsubscribe = props . eventRegistration . onCheckoutValidation (
51
49
async ( ) => {
52
- restoreRequiredFieldValidation ( overridenFields ) ;
53
- setOverridenFields ( overrideRequiredFieldValidation ( shippingAddress ?. country || '' ) ) ;
54
50
for ( const shippingField in amazonShipping ) {
55
51
// Values are the same as expected. Bail.
56
52
if ( amazonShipping [ shippingField ] === shippingAddress [ shippingField ] ) {
You can’t perform that action at this time.
0 commit comments