Skip to content

Commit

Permalink
2.3.2: #37
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Oct 18, 2017
1 parent 234ac54 commit 7752a3a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
28 changes: 25 additions & 3 deletions Block/Multishipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,33 @@ final protected function _toHtml() {
* I have implemented it similar to:
* https://github.com/mage2pro/core/blob/3.2.8/Payment/view/frontend/web/card.js#L171-L178
*/
'cardholder' => !$s->prefillCardholder() ? null : df_strtoupper(df_cc_s(
$a->getFirstname(), $a->getLastname()
))
'cardholder' => !$s->prefillCardholder() ? null : $this->cardholder($a)
,'requireCardholder' => $s->requireCardholder()
])
), df_link_inline(df_asset_name('main', $m, 'css')));
}

/**
* 2017-10-18
* Note 1.
* `The ineligible characters should be automatically replaced by the corresponding eligible ones
* in the multi-shipping scenario while prefilling the cardholder's name
* (if «Prefill the cardholder's name from the billing address?» option is enabled)`:
* https://github.com/mage2pro/stripe/issues/37
* Note 2.
* I have implemented it for the single-shipping scenario in JavaScript:
* https://github.com/mage2pro/core/blob/3.2.9/Payment/view/frontend/web/card.js#L188-L201
* baChange(this, function(a) {this.cardholder((a.firstname + ' ' + a.lastname).toUpperCase()
* .normalize('NFD').replace(/[^\w\s-]/g, '')
* );});
* https://github.com/mage2pro/core/issues/37#issuecomment-337546667
* Note 3.
* I have adapted an implementation from here:
* https://stackoverflow.com/questions/3371697#comment63507856_3371773
* @param A $a
* @return string
*/
private function cardholder(A $a) {return transliterator_transliterate('Any-Latin; Latin-ASCII',
df_strtoupper(df_cc_s($a->getFirstname(), $a->getLastname()))
);}
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage2pro/stripe"
,"version": "2.3.1"
,"version": "2.3.2"
,"description": "The «Stripe» payment extension for Magento 2."
,"type": "magento2-module"
,"homepage": "https://mage2.pro/c/extensions/stripe"
Expand All @@ -11,7 +11,7 @@
"homepage": "https://mage2.pro/users/dmitry_fedyuk",
"role": "Developer"
}]
,"require": {"mage2pro/core": ">=3.2.8", "stripe/stripe-php": "3.*"}
,"require": {"mage2pro/core": ">=3.2.9", "stripe/stripe-php": "3.*"}
,"autoload": {"files": ["registration.php"], "psr-4": {"Dfe\\Stripe\\": ""}}
,"keywords": [
"API"
Expand Down

0 comments on commit 7752a3a

Please sign in to comment.