Skip to content

Commit

Permalink
Merge pull request #50 from Affirm/feature_tnxs-api
Browse files Browse the repository at this point in the history
Transactions API
  • Loading branch information
taehyunlim authored Sep 7, 2021
2 parents 09af88d + 2e36fae commit 55fa288
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions cartridges/int_affirm/cartridge/scripts/api/affirmAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
self.auth = function (token) {
try {
var affirmService = require('*/cartridge/scripts/init/initAffirmServices').initService('affirm.auth');
affirmService.URL = affirmData.getURLPath() + 'charges';
affirmService.URL = affirmData.getURLPath() + '/v1/transactions';
return affirmService.call({
'checkout_token': token
'transaction_id': token
}).object;
} catch (e) {
logger.error('Affirm. File - affirmAPI. Error - {0}', e);
Expand All @@ -40,7 +40,7 @@
self.capture = function (chargeId, captureData) {
try {
var affirmService = require('*/cartridge/scripts/init/initAffirmServices').initService('affirm.capture');
affirmService.URL = affirmData.getURLPath() + 'charges/' + chargeId + '/capture';
affirmService.URL = affirmData.getURLPath() + '/v1/transactions/' + chargeId + '/capture';
return affirmService.call({
'order_id' : captureData
}).object;
Expand All @@ -58,7 +58,7 @@
self.void = function (chargeId) {
try {
var affirmService = require('*/cartridge/scripts/init/initAffirmServices').initService('affirm.void');
affirmService.URL = affirmData.getURLPath() + 'charges/' + chargeId + '/void';
affirmService.URL = affirmData.getURLPath() + '/v1/transactions/' + chargeId + '/void';
return affirmService.call().object;
} catch (e) {
logger.error('Affirm. File - affirmAPI. Error - {0}', e);
Expand All @@ -77,7 +77,7 @@
try {
var affirmService = require('*/cartridge/scripts/init/initAffirmServices').initService('affirm.refund');

affirmService.URL = affirmData.getURLPath() + 'charges/' + chargeId + '/refund';
affirmService.URL = affirmData.getURLPath() + '/v1/transactions/' + chargeId + '/refund';

return affirmService.call().object;
} catch (e) {
Expand All @@ -95,7 +95,7 @@
self.update = function (chargeId, updateData) {
try {
var affirmService = require('*/cartridge/scripts/init/initAffirmServices').initService('affirm.update');
affirmService.URL = affirmData.getURLPath() + 'charges/' + chargeId + '/update';
affirmService.URL = affirmData.getURLPath() + '/v1/transactions/' + chargeId + '/update';
return affirmService.call(updateData).object;
} catch (e) {
logger.error('Affirm. File - affirmAPI. Error - {0}', e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
self.checkTotalPrice = function (basket, AffirmResponse, status) {
let totalPrice = self.calculateNonGiftCertificateAmount(basket).multiply(100).getValue();
var logger = system.Logger.getLogger('Affirm', '');
if (totalPrice !== AffirmResponse.details.total) {
if (totalPrice !== AffirmResponse.amount) {
logger.error('Affirm check total price is failing');
status.addItem(
new system.StatusItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ metadata.platform_type=Demandware
metadata.platform_affirm=20.3.0
metadata.merchant.name=Test Merchant

affirm.production.url=https://api.affirm.com/api/v2/
affirm.production.url=https://api.affirm.com/api
affirm.production.js=https://cdn1.affirm.com/js/v2/affirm.js
affirm.sandbox.url=https://sandbox.affirm.com/api/v2/
affirm.sandbox.url=https://sandbox.affirm.com/api
affirm.sandbox.js=https://cdn1-sandbox.affirm.com/js/v2/affirm.js
affirm.sandbox.baseurl=https://sandbox.affirm.com

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ metadata.platform_type=Demandware
metadata.platform_affirm=20.3.0
metadata.merchant.name=Test Merchant

affirm.production.url=https://api.affirm.com/api/v2/
affirm.production.url=https://api.affirm.com/api
affirm.production.js=https://cdn1.affirm.com/js/v2/affirm.js
affirm.sandbox.url=https://sandbox.affirm.com/api/v2/
affirm.sandbox.url=https://sandbox.affirm.com/api
affirm.sandbox.js=https://cdn1-sandbox.affirm.com/js/v2/affirm.js
affirm.sandbox.baseurl=https://sandbox.affirm.com

Expand Down

0 comments on commit 55fa288

Please sign in to comment.