Skip to content

Commit

Permalink
0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Sep 20, 2017
1 parent ae389a3 commit 0f5d8f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage2pro/klarna"
,"version": "0.4.0"
,"version": "0.4.1"
,"description": "The «Klarna» payment extension for Magento 2."
,"type": "magento2-module"
,"homepage": "https://mage2.pro/c/extensions/klarna"
Expand All @@ -11,7 +11,7 @@
"homepage": "https://mage2.pro/users/dmitry_fedyuk",
"role": "Developer"
}]
,"require": {"klarna/checkout": "*", "mage2pro/core": ">=2.11.22", "mage2pro/klarna-sdk-v3": "^2.2.3"}
,"require": {"klarna/checkout": "*", "mage2pro/core": ">=2.12.10", "mage2pro/klarna-sdk-v3": "^2.2.3"}
,"autoload": {"files": ["registration.php"], "psr-4": {"Dfe\\Klarna\\": ""}}
,"keywords": [
"API"
Expand Down
15 changes: 7 additions & 8 deletions view/frontend/web/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ define([
,'Magento_Checkout/js/model/quote'
,'Magento_Customer/js/model/customer'
,'Magento_Checkout/js/model/url-builder'
], function(df, api, billingAddressChange, parent, $, ko, q, customer, ub) {'use strict';
], function(df, api, baChange, parent, $, ko, q, customer, ub) {'use strict';
/** 2017-09-06 @uses Class::extend() https://github.com/magento/magento2/blob/2.2.0-rc2.3/app/code/Magento/Ui/view/base/web/js/lib/core/class.js#L106-L140 */
return parent.extend({
// 2016-12-17
Expand All @@ -21,30 +21,29 @@ return parent.extend({
initialize: function() {
this._super();
this.klHtml = ko.observable(this.config('html'));
var _this = this;
billingAddressChange(function(newAddress) {if (newAddress.countryId) {
baChange(this, function(newAddress) {if (newAddress.countryId) {
// 2017-04-04
// The M2 client part does not notify the server part about the billing address change.
// So we need to pass the chosen country ID to the server part.
//console.log(newAddress.countryId);
//_this.klHtml(newAddress.countryId);
/** @type {Boolean} */
var l = customer.isLoggedIn();
$.when(api(_this,
$.when(api(this,
// 2017-04-05
// Для анонимных покупателей q.getQuoteId() — это строка вида
// «63b25f081bfb8e4594725d8a58b012f7».
ub.createUrl(df.s.t('/dfe-klarna/%s/html', l ? 'mine' : q.getQuoteId()), {})
,df.o.merge({ba: q.billingAddress(), qp: _this.getData()}, l ? {} : {email: q.guestEmail})
,df.o.merge({ba: q.billingAddress(), qp: this.getData()}, l ? {} : {email: q.guestEmail})
))
.fail(function() {debugger;})
.done(function(json) {
.done($.proxy(function(json) {
// 2017-04-05
// Отныне json у нас всегда строка: @see dfw_encode().
/** @type {Object} */
var d = !json ? {} : $.parseJSON(json);
_this.klHtml(d['html']);
})
this.klHtml(d['html']);
}, this))
;
}}, false);
return this;
Expand Down

0 comments on commit 0f5d8f3

Please sign in to comment.