| @@ -220,9 +220,10 @@ | ||
| 220 | 220 | var created = responses.find(function (response) { |
| 221 | 221 | return response && response.data && response.data.action === 'king_addons_form_builder_submissions'; |
| 222 | 222 | }); |
| 223 | 223 | var submissionId = created && created.data ? created.data.post_id : 0; |
| 224 | - return startPayment(submissionId).then(function (payResponse) { | |
| 224 | + var accessSecret = created && created.data ? created.data.access_secret : ''; | |
| 225 | + return startPayment(submissionId, accessSecret).then(function (payResponse) { | |
| 225 | 226 | return responses.concat([payResponse]); |
| 226 | 227 | }); |
| 227 | 228 | }) |
| 228 | 229 | .then((responses) => { |
| @@ -449,11 +450,13 @@ | ||
| 449 | 450 | /** |
| 450 | 451 | * Ask the server to open a payment and note where to |
| 451 | 452 | * send the visitor once everything else has run. |
| 452 | 453 | * |
| 454 | + * @param {number|string} submissionId Submission created by this submit, if any. | |
| 455 | + * @param {string} accessSecret Secret issued with that submission. | |
| 453 | 456 | * @return {jqXHR} The request. |
| 454 | 457 | */ |
| 455 | - function startPayment(submissionId) { | |
| 458 | + function startPayment(submissionId, accessSecret) { | |
| 456 | 459 | return $.ajax({ |
| 457 | 460 | type: 'POST', |
| 458 | 461 | url: KingAddonsFormBuilderData.ajaxurl, |
| 459 | 462 | data: { |
| @@ -465,9 +468,10 @@ | ||
| 465 | 468 | form_id: $scope.find('input[name="form_id"]').val(), |
| 466 | 469 | form_name: $scope.find('form').attr('name'), |
| 467 | 470 | form_page: $scope.find('form').attr('page'), |
| 468 | 471 | form_page_id: $scope.find('form').attr('page_id'), |
| 469 | - submission_id: submissionId || 0 | |
| 472 | + submission_id: submissionId || 0, | |
| 473 | + access_secret: accessSecret || '' | |
| 470 | 474 | }, |
| 471 | 475 | success: function (response) { |
| 472 | 476 | if (response && response.success && response.data && response.data.redirect) { |
| 473 | 477 | paymentRedirect = response.data.redirect; |