-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 3.4.2
- Loading branch information
Showing
49 changed files
with
1,473 additions
and
477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* globals wc_pagarme_checkout */ | ||
/* jshint esversion: 6 */ | ||
const pagarmeCustomerFields = { | ||
billingDocumentId: 'billing_document', | ||
shippingDocumentId: 'shipping_document', | ||
blocksBillingDocumentId: 'billing-address-document', | ||
blocksShippingDocumentId: 'shipping-address-document', | ||
|
||
documentMasks: [ | ||
'000.000.000-009999', | ||
'00.000.000/0000-00' | ||
], | ||
documentMaskOptions: { | ||
onKeyPress: function (document, e, field, options) { | ||
const masks = pagarmeCustomerFields.documentMasks, | ||
mask = document.length > 14 ? masks[1] : masks[0]; | ||
field.mask(mask, options); | ||
} | ||
}, | ||
|
||
applyDocumentMask() { | ||
jQuery('#' + this.billingDocumentId).mask(this.documentMasks[0], this.documentMaskOptions); | ||
jQuery('#' + this.shippingDocumentId).mask(this.documentMasks[0], this.documentMaskOptions); | ||
jQuery('#' + this.blocksBillingDocumentId).mask(this.documentMasks[0], this.documentMaskOptions); | ||
jQuery('#' + this.blocksShippingDocumentId).mask(this.documentMasks[0], this.documentMaskOptions); | ||
}, | ||
|
||
addEventListener() { | ||
jQuery(document.body).on('checkout_error', function () { | ||
const documentFieldIds = [ | ||
pagarmeCustomerFields.billingDocumentId, | ||
pagarmeCustomerFields.shippingDocumentId, | ||
pagarmeCustomerFields.blocksBillingDocumentId, | ||
pagarmeCustomerFields.blocksShippingDocumentId | ||
]; | ||
jQuery.each(documentFieldIds, function () { | ||
const documentField = '#' + this + '_field', | ||
isDocumentEmpty = jQuery('.woocommerce-error li[data-id="' + this + '"]').length, | ||
isDocumentInvalid = jQuery('.woocommerce-error li[data-pagarme-error="' + this + '"]').length; | ||
if (isDocumentEmpty || isDocumentInvalid) { | ||
jQuery(documentField).addClass('woocommerce-invalid'); | ||
} else { | ||
jQuery(documentField).removeClass('woocommerce-invalid'); | ||
} | ||
}); | ||
}); | ||
}, | ||
|
||
start: function () { | ||
this.addEventListener(); | ||
|
||
setTimeout(function() { | ||
pagarmeCustomerFields.applyDocumentMask(); | ||
}, 5000); | ||
} | ||
}; | ||
|
||
pagarmeCustomerFields.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
assets/javascripts/front/reactCheckout/payments/GooglePay/useGooglepay.js
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
assets/javascripts/front/reactCheckout/payments/GooglePay/validateBilling.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
function validateBilling(billing) { | ||
|
||
const requiredFields = [ | ||
'first_name', | ||
'last_name', | ||
'email', | ||
'phone', | ||
'address_1', | ||
'city', | ||
'postcode', | ||
'state', | ||
'country' | ||
]; | ||
for (const field of requiredFields) { | ||
if (!billing[field]) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
export default validateBilling; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('react', 'react-dom', 'wp-data', 'wp-element'), 'version' => '568464aca724c57656dd'); | ||
<?php return array('dependencies' => array('react', 'react-dom', 'wp-data', 'wp-element'), 'version' => '4df6da733d92f5ffc390'); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.