added data-attribute for method-type

This commit is contained in:
Andrey Kasalinskiy 2017-02-15 19:17:22 +03:00
parent 3d9263d29e
commit f94f45b2e0
3 changed files with 10 additions and 5 deletions

View File

@ -1,7 +1,10 @@
export default function (endpointUrl) {
if (endpointUrl) {
export default function (endpointUrl, method) {
if (method !== 'GET') {
method = 'POST';
}
if (endpointUrl) {
const callbackForm = document.createElement('form');
callbackForm.method = 'POST';
callbackForm.method = method;
callbackForm.action = endpointUrl;
callbackForm.setAttribute('target', '_top');
document.body.appendChild(callbackForm);

View File

@ -21,6 +21,8 @@ export default class InitScript {
endpointEvents: dataSet.endpointEvents,
endpointFailed: dataSet.endpointFailed,
endpointSuccess: dataSet.endpointSuccess,
endpointFailedMethod: dataSet.endpointFailedMethod,
endpointSuccessMethod: dataSet.endpointSuccessMethod,
buttonColor: dataSet.buttonColor,
logo: dataSet.logo,
name: dataSet.name,

View File

@ -50,11 +50,11 @@ ready(function () {
} else if (message.type === 'done') {
StateInspector.resolve(params.invoiceId);
close();
processingCallback(params.endpointSuccess);
processingCallback(params.endpointSuccess, params.endpointSuccessMethod);
} else if (message.type === 'error') {
StateInspector.resolve(params.invoiceId);
close();
processingCallback(params.endpointFailed);
processingCallback(params.endpointFailed, params.endpointFailedMethod);
}
});