Skip to content

Commit

Permalink
Merge pull request #49 from xsolla/PAYMENTS-19785
Browse files Browse the repository at this point in the history
feat(PAYMENTS-19785): cross gdpr settings
  • Loading branch information
ekireevxs authored Jul 29, 2024
2 parents 2c5d9ea + c0f3815 commit cfd8ef4
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 83 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 1.3.3
- [chore] update `gulp-uglify` to version 3.0.2

## 1.3.2
- [fix] Fixed lightbox resize logic, if width and height options was exist

Expand Down
38 changes: 27 additions & 11 deletions dist/widget.js

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions dist/widget.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/widget.min.js.map

Large diffs are not rendered by default.

136 changes: 80 additions & 56 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xsolla-paystation-widget",
"version": "1.3.2",
"version": "1.3.3",
"description": "PayStation Integration Widget",
"scripts": {
"build": "gulp build",
Expand All @@ -15,7 +15,7 @@
"gulp": "3.9.0",
"gulp-rename": "1.2.0",
"gulp-sourcemaps": "1.5.2",
"gulp-uglify": "1.2.0",
"gulp-uglify": "3.0.2",
"gulp-util": "3.0.6",
"sassify": "0.9.1",
"stringify": "3.1.0",
Expand Down
14 changes: 10 additions & 4 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ module.exports = (function () {
lightbox: {},
childWindow: {},
host: 'secure.xsolla.com',
iframeOnly: false
iframeOnly: false,
consentId: null
};
var SANDBOX_PAYSTATION_URL = 'https://sandbox-secure.xsolla.com/paystation2/?';
var EVENT_NAMESPACE = '.xpaystation-widget';
Expand All @@ -70,10 +71,15 @@ module.exports = (function () {
query.access_data = JSON.stringify(this.config.access_data);
}

const urlWithoutQueryParams = this.config.sandbox ?
const paymentUrl = this.config.sandbox ?
SANDBOX_PAYSTATION_URL :
'https://' + this.config.host + '/paystation2/?';
return urlWithoutQueryParams + Helpers.param(query);
'https://' + this.config.host + '/paystation2/?' + Helpers.param(query);

if (this.config.consentId) {
return Helpers.getPaymentUrlWithConsentId(paymentUrl, this.config.consentId)
}

return paymentUrl;
};

App.prototype.checkConfig = function () {
Expand Down
22 changes: 16 additions & 6 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,21 @@ function addEventObject(context, wrapEventInNamespace) {
};
}

function getPaymentUrlWithConsentId(url, consentId) {
let paymentUrl = new URL(url);

paymentUrl.searchParams.append('consentId', consentId);

return paymentUrl.toString();
}


module.exports = {
addEventObject: addEventObject,
isEmpty: isEmpty,
uniq: uniq,
zipObject: zipObject,
param: param,
once: once,
addEventObject: addEventObject,
isEmpty: isEmpty,
uniq: uniq,
zipObject: zipObject,
param: param,
once: once,
getPaymentUrlWithConsentId: getPaymentUrlWithConsentId
}

0 comments on commit cfd8ef4

Please sign in to comment.