Skip to content

Commit

Permalink
2.3.4: #35
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Oct 19, 2017
1 parent af8efd8 commit c55fedb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage2pro/stripe"
,"version": "2.3.3"
,"version": "2.3.4"
,"description": "The «Stripe» payment extension for Magento 2."
,"type": "magento2-module"
,"homepage": "https://mage2.pro/c/extensions/stripe"
Expand Down
43 changes: 37 additions & 6 deletions view/frontend/web/multishipping.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,26 @@ define([
* @see \Df\Payment\Token::KEY
* const KEY = 'token';
* https://github.com/mage2pro/core/blob/2.10.46/Payment/Token.php#L36
* @param {String} v
* @param {String} token
* @param {String=} cardType
*/
var setResult = function(v) {$element.append($('<input>').attr({
name: 'payment[token]', type: 'hidden', value: v
}));};
var setResult = function(token, cardType) {
var addHiddenInput = function(n, v) {
$element.append($('<input>').attr({name: 'payment[' + n + ']', type: 'hidden', value: v}));
};
addHiddenInput('token', token);
/**
* 2017-10-19
* `Pass the brand of ther used bank card from the payment form to the Magento server part
* in the multi-shipping scenario (in the same way as it is happen in the single-shipping scenario)`:
* https://github.com/mage2pro/stripe/issues/35
* The single-shipping scenario's implementation:
* https://github.com/mage2pro/stripe/blob/2.2.0/view/frontend/web/main.js#L71-L80
*/
if (cardType) {
addHiddenInput('cardType', cardType);
}
};
$methods.change(function(){
updateContinue();
// 2017-08-26
Expand Down Expand Up @@ -104,7 +119,7 @@ define([
*/
$('#multishipping-billing-form').submit(function() {
if (isOurMethodSelected()) {
var o = optionSelected();
/** @type {String} */ var o = optionSelected();
if ('new' !== o) {
setResult(o);
}
Expand Down Expand Up @@ -258,7 +273,23 @@ define([
$message.html(r.error.message).show();
}
else {
setResult(r.token.id);
/**
* 2017-10-19
* Note 1.
* `Pass the brand of ther used bank card
* from the payment form to the Magento server part
* in the multi-shipping scenario
* (in the same way as it is happen in the single-shipping scenario)`:
* https://github.com/mage2pro/stripe/issues/35
* The single-shipping scenario's implementation:
* https://github.com/mage2pro/stripe/blob/2.2.0/view/frontend/web/main.js#L71-L80
* Note 2. «The token object»: https://stripe.com/docs/api#token_object
* Note 3. `brand`:
* «Card brand.
* Can be Visa, American Express, MasterCard, Discover, JCB, Diners Club, or Unknown.
* https://stripe.com/docs/api#token_object-card-brand
*/
setResult(r.token.id, r.token.card.brand);
eContinue.disabled = false;
$(eContinue).click();
}
Expand Down

0 comments on commit c55fedb

Please sign in to comment.