Skip to content

Commit

Permalink
2.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Sep 20, 2019
1 parent 3d6ed51 commit 7f5f99d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function cardholder() {return $this->iia(self::$II_CARDHOLDER);}
/**
* 2017-10-09
* @used-by \Dfe\Square\Facade\Customer::cardAdd()
* @used-by \Dfe\Square\P\Address::p()
* @return string|null
*/
function postalCode() {return $this->iia(self::$II_POSTAL_CODE);}
Expand Down
8 changes: 5 additions & 3 deletions P/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class Address extends \Df\Payment\Operation {
* @used-by \Dfe\Square\P\Charge::p()
* @return array(string => mixed)
*/
function billing() {return $this->p($this->addressB());}
function billing() {return $this->p($this->addressB(), true);}

/**
* 2017-10-09
Expand All @@ -31,9 +31,10 @@ function shipping() {return $this->p($this->addressS());}
* @used-by billing()
* @used-by shipping()
* @param A|null $a
* @param bool $isBilling [optional]
* @return array(string => mixed)
*/
private function p(A $a = null) {/** @var A|null $a */ return !$a ? [] : [
private function p(A $a = null, $isBilling = false) {/** @var A|null $a */ return !$a ? [] : [
// 2017-10-09
// «The first line of the address.
// Fields that start with `address_line` provide the address's most specific details,
Expand Down Expand Up @@ -68,7 +69,8 @@ private function p(A $a = null) {/** @var A|null $a */ return !$a ? [] : [
// 2017-10-09 «Optional organization name when it's representing recipient». Type: string.
,'organization' => $a->getCompany()
// 2017-10-09 «The address's postal code». Type: string.
,'postal_code' => $a->getPostcode()
// 2019-09-21 «The postal code in billing address doesn't match the one used for card nonce creation.»
,'postal_code' => !$isBilling ? $a->getPostcode() : $this->m()->postalCode()
// 2017-10-09 «A civil region within the address's locality, if any». Type: string.
,'sublocality' => ''
// 2017-10-09 «A civil region within the address's sublocality, if any». Type: string.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage2pro/square"
,"version": "2.4.1"
,"version": "2.4.2"
,"description": "Square Payments integration with Magento 2"
,"type": "magento2-module"
,"homepage": "https://mage2.pro/c/extensions/square"
Expand Down
5 changes: 3 additions & 2 deletions view/frontend/web/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ return parent.extend({
* }
* https://docs.connect.squareup.com/articles/adding-payment-form#noncecallbackformat
*/
cardNonceResponseReceived: $.proxy(function(errors, nonce) {
cardNonceResponseReceived: $.proxy(function(errors, nonce, cardData) {
/**
* 2017-10-06
* «The `errors` parameter is an array of objects
Expand All @@ -128,6 +128,7 @@ return parent.extend({
* https://docs.connect.squareup.com/articles/adding-payment-form#noncecallbackformat
*/
this.token = nonce;
this.postalCode(cardData['billing_postal_code']);
this.placeOrderInternal();
}
else {
Expand Down Expand Up @@ -274,7 +275,7 @@ return parent.extend({
else {
$.when(dfc.geo()).then($.proxy(function(data) {
this.postalCode(data['zip_code']);
}), this)
}, this))
}
}, this)
/**
Expand Down

0 comments on commit 7f5f99d

Please sign in to comment.