Skip to content

Commit

Permalink
Afterpay v23.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ghatamehta-afterpay committed Mar 2, 2023
1 parent cd4c527 commit 0b53bd2
Show file tree
Hide file tree
Showing 282 changed files with 19,615 additions and 3,044 deletions.
8 changes: 7 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
bin/
cartridges/bm_afterpay/cartridge/static/default/lib/
cartridges/int_afterpay_sfra/cartridge/static/
cartridges/int_afterpay_sfra/cartridge/static/default/
cartridges/int_afterpay_sfra/cartridge/client/default/js/cashappCheckoutMobile.js
cartridges/int_afterpay_sfra_6/cartridge/static/default/
cartridges/int_afterpay_sg/cartridge/static/default/
cartridges/int_afterpay_sfra_6/cartridge/client/default/js/cashappCheckoutMobile.js
cartridges/int_afterpay_sfra/cartridge/scripts/util/parsePriceAfterpay.js
cartridges/int_afterpay_sfra_6/cartridge/scripts/util/parsePriceAfterpay.js
documentation/
metadata/
node_modules/
Expand Down
11 changes: 8 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"root": true,
"extends": "airbnb-base/legacy",
"parser": "babel-eslint",
"rules": {
"import/no-unresolved": "off",
"indent": ["error", 4, { "SwitchCase": 1, "VariableDeclarator": 1 }],
Expand All @@ -12,7 +11,13 @@
"global-require": "off",
"no-shadow": ["error", { "allow": ["err", "callback"]}],
"linebreak-style": 0,
"max-len": "off"
"max-len": "off",
"eqeqeq": "off",
"prefer-const": "warn",
"no-undef": "off",
"no-param-reassign": ["error", { "props": false }],
"no-else-return": 0,
"no-plusplus": 0
},
"globals": {
"dw": false,
Expand All @@ -25,4 +30,4 @@
"PIPELET_NEXT": false,
"XML": false
}
}
}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
.vscode
node_modules
cartridges/int_afterpay_sfra/cartridge/static/default/css
cartridges/int_afterpay_sfra/cartridge/static/default/js/afterpay.js
cartridges/int_afterpay_sfra/cartridge/static/default/js/afterpayCheckout.js
cartridges/int_afterpay_sfra/cartridge/static/default/js/checkout.js
cartridges/int_afterpay_sfra/cartridge/static/default/js/productTile.js
cartridges/int_afterpay_sfra/cartridge/static/default/js/cashappCheckout.js
cartridges/int_afterpay_sfra/cartridge/static/default/js/cashappCheckoutMobile.js
cartridges/int_afterpay_sfra_6/cartridge/static/default/css
cartridges/int_afterpay_sfra_6/cartridge/static/default/js/afterpay.js
cartridges/int_afterpay_sfra_6/cartridge/static/default/js/afterpayCheckout.js
cartridges/int_afterpay_sfra_6/cartridge/static/default/js/checkout.js
cartridges/int_afterpay_sfra_6/cartridge/static/default/js/productTile.js
cartridges/int_afterpay_sfra_6/cartridge/static/default/js/cashappCheckout.js
cartridges/int_afterpay_sfra_6/cartridge/static/default/js/cashappCheckoutMobile.js
dw.json
.DS_Store
.vscode/system-objecttype-extensions.d.ts
2 changes: 0 additions & 2 deletions cartridges/bm_afterpay/cartridge/controllers/AfterPay.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use strict';
/* global request */

/**
* Controller for Order management pages
Expand Down Expand Up @@ -32,7 +31,6 @@ function orderList() {
ISML.renderTemplate('application/orderlist', orderListResponse);
}


/**
* AfterPay Order Details page
* */
Expand Down
3 changes: 1 addition & 2 deletions cartridges/bm_afterpay/cartridge/controllers/Operations.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use strict';
/* global request */

/**
* redirects to specific actions
Expand All @@ -22,7 +21,7 @@ function performAction() {
var r = require('~/cartridge/scripts/util/response');
r.renderJSON(result);

return;
return; // eslint-disable-line no-useless-return
}

/*
Expand Down
6 changes: 4 additions & 2 deletions cartridges/bm_afterpay/cartridge/scripts/getOrders.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* Gets order list
*
Expand Down Expand Up @@ -30,14 +32,14 @@ function getOrders(input) {
var rowCount;
var pageCount;

totalOrderCount = startRow = endRow = rowCount = pageCount = 0;
totalOrderCount = startRow = endRow = rowCount = pageCount = 0; // eslint-disable-line

if (orderNumber) { // searching for an order ID
order = OrderMgr.searchOrder('orderNo = {0}', orderNumber);

if (order) {
result.push(order);
totalOrderCount = startRow = endRow = 1;
totalOrderCount = startRow = endRow = 1;// eslint-disable-line
}
} else { // all orders on pagination
orders = OrderMgr.searchOrders('custom.apIsAfterpayOrder = {0}', 'creationDate desc', true);
Expand Down
9 changes: 5 additions & 4 deletions cartridges/bm_afterpay/cartridge/scripts/transActions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* AfterPay Transaction Actions
*
Expand All @@ -16,7 +18,7 @@ var UUIDUtils = require('dw/util/UUIDUtils');
/* Script Modules */
var LogUtils = require('*/cartridge/scripts/util/afterpayLogUtils');
var Logger = LogUtils.getLogger('TransActions');
var { brandUtilities } = require('*/cartridge/scripts/util/afterpayUtilities');
var brandUtilities = require('*/cartridge/scripts/util/afterpayUtilities').brandUtilities;

/**
* updates the order status
Expand Down Expand Up @@ -86,9 +88,8 @@ function refund(orderNo, amountString) {
var apPaymentInstrument;
var paymentTransaction;
var status = false;
var amountArray = amountString.split(' ');
var currency = amountArray[0];
var amount = amountArray[1];
var currency = order.getCurrencyCode();
var amount = amountString;
var response;
var paymentID;
var request;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/*
* Creates custom log file for the cartridge
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var RefundService = require('*/cartridge/scripts/logic/services/afterpayRefundService');
var LogUtils = require('*/cartridge/scripts/util/afterpayLogUtils');
var Logger = LogUtils.getLogger('RefundUtilities');
Expand Down
2 changes: 2 additions & 0 deletions cartridges/bm_afterpay/cartridge/scripts/util/resource.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/**
* Resource helper
*
Expand Down
2 changes: 1 addition & 1 deletion cartridges/bm_afterpay/cartridge/scripts/util/response.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
/* global response */

/**
* This module provides often-needed helper methods for sending responses.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

/* global jQuery */
(function ($) {
$('#filtertableProjects').DataTable({ // eslint-disable-line
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict';

/* global jQuery, Resources, Urls */

var j = jQuery.noConflict();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@
<tbody>
<tr>
<td class="table_detail left e w s" nowrap="nowrap"><label class="item-label" for="">${Resource.msg('order.information','afterpay',null)}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%><label class="item-label" for="">
<td class="table_detail left e s" nowrap="nowrap" width="75%"><label class="item-label" for="">
${Resource.msg('order.information.body1','afterpay',null)+' '+order.getAllProductLineItems().size()+' '+Resource.msg('order.information.body2','afterpay',null)+Resource.msg('order.information.body3','afterpay',null)+' '+order.getTotalGrossPrice()}
</label></td>
</tr>
<tr>
<td class="table_detail left e w s" nowrap="nowrap"><label class="item-label" for="">${Resource.msg('order.creation.date','afterpay',null)}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%><label class="item-label" for="">${order.creationDate}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%"><label class="item-label" for="">${order.creationDate}</label></td>
</tr>
<tr>
<td class="table_detail left e w s" nowrap="nowrap"><label class="item-label" for="">${Resource.msg('order.site','afterpay',null)}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%><label class="item-label" for="">${dw.system.Site.current.ID}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%"><label class="item-label" for="">${dw.system.Site.current.ID}</label></td>
</tr>
<tr>
<td class="table_detail left e w s" nowrap="nowrap"><label class="item-label" for="">${Resource.msg('order.createdby','afterpay',null)}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%><label class="item-label" for="">${order.createdBy}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%"><label class="item-label" for="">${order.createdBy}</label></td>
</tr>
<tr>
<td class="table_detail left e w s" nowrap="nowrap"><label class="item-label" for="">${Resource.msg('order.customer','afterpay',null)}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%><label class="item-label" for="">${order.getCustomerName()}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%"><label class="item-label" for="">${order.getCustomerName()}</label></td>
</tr>
<tr>
<td class="table_detail left e w s" nowrap="nowrap"><label class="item-label" for="">${Resource.msg('order.customerno','afterpay',null)}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%><label class="item-label" for="">${order.getCustomerNo() ? order.getCustomerNo() : "anonymous" + order.getCustomer().getID()}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%"><label class="item-label" for="">${order.getCustomerNo() ? order.getCustomerNo() : "anonymous" + order.getCustomer().getID()}</label></td>
</tr>
<tr>
<td class="table_detail left e w s" nowrap="nowrap"><label class="item-label" for="">${Resource.msg('order.customer.email','afterpay',null)}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%><label class="item-label" for="">${order.getCustomerEmail()}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%"><label class="item-label" for="">${order.getCustomerEmail()}</label></td>
</tr>
<tr>
<td class="table_detail left e w s" nowrap="nowrap"><label class="item-label" for="">${Resource.msg('transaction.status','afterpay',null)}</label></td>
Expand All @@ -55,14 +55,15 @@
<isset name="currentStatus" value="${Resource.msg('option.refunded','afterpay',null)}" scope="page" />
<isset name="isDirectPayment" value="${true}" scope="page" />
<isif condition="${paymentTransaction}">
<isset name="afterpayTotalAmount" value="${paymentTransaction.amount.value}" scope="page" />
<isset name="isDirectPayment" value="${paymentTransaction.custom.apPaymentMode === 'DIRECT_CAPTURE'}" scope="page" />
<isset name="apPaymentStatus" value="${isDirectPayment ? paymentTransaction.custom.apDirectPaymentStatus : paymentTransaction.custom.apAuthoriseStatus}" scope="page" />
<isset name="canRefund" value="${isDirectPayment && apPaymentStatus.toLowerCase() == 'approved' && empty(paymentTransaction.custom.apRefundID)}" scope="page" />
<isif condition="${!(isDirectPayment && !canRefund)}">
<isset name="currentStatus" value="${apPaymentStatus}" scope="page" />
</isif>
</isif>
<td class="table_detail left e s" nowrap="nowrap" width="75%><label class="item-label" for="">${isDirectPayment ? paymentTransaction.custom.apDirectPaymentStatus : paymentTransaction.custom.apAuthoriseStatus}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%"><label class="item-label" for="">${isDirectPayment ? paymentTransaction.custom.apDirectPaymentStatus : paymentTransaction.custom.apAuthoriseStatus}</label></td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -122,31 +123,19 @@
<tbody>
<tr>
<td class="table_detail left e w s" nowrap="nowrap"><label class="item-label" for="">${Resource.msg('payment.total','afterpay',null)}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%><label class="item-label" for="">${order.getTotalGrossPrice()}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%"><label class="item-label" for="">${order.getCurrencyCode()}&nbsp;${afterpayTotalAmount}</label></td>
</tr>
<tr>
<td class="table_detail left e w s" nowrap="nowrap"><label class="item-label" for="">${Resource.msg('payment.invoice.number','afterpay',null)}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%><label class="item-label" for="">${order.invoiceNo}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%"><label class="item-label" for="">${order.invoiceNo}</label></td>
</tr>
<tr>
<td class="table_detail left e w s" nowrap="nowrap"><label class="item-label" for="">${Resource.msg('payment.status','afterpay',null)}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%><label class="item-label" for="">${currentStatus}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%"><label class="item-label" for="">${currentStatus}</label></td>
</tr>
<iscomment>Payment Details
<isset name="paymentProcessor" value="${dw.order.PaymentMgr.getPaymentMethod(paymentInstrument.getPaymentMethod()).getPaymentProcessor()}" scope ="page"/>
<tr>
<td class="table_detail left e w s" nowrap="nowrap"><label class="item-label" for="">${Resource.msg('payment.method','afterpay',null)}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%><label class="item-label" for="">
${paymentInstrument.paymentMethod}<br>
${Resource.msg('payment.processor','afterpay',null) +' '+ paymentProcessor.getID()}<br>
${Resource.msg('payment.transaction','afterpay',null) +' '+ orderNo}<br>
${Resource.msg('payment.amount','afterpay',null) +' '}<span>${order.getTotalGrossPrice()}</span><br>
</label></td>
</tr>
</iscomment>
<tr>
<td class="table_detail left e w s" nowrap="nowrap"><label class="item-label" for="">${Resource.msg('payment.billing.address','afterpay',null)}</label></td>
<td class="table_detail left e s" nowrap="nowrap" width="75%><label class="item-label" for=""></label>
<td class="table_detail left e s" nowrap="nowrap" width="75%"><label class="item-label" for=""></label>
${order.getBillingAddress().firstName+' '+order.getBillingAddress().lastName}<br>
${order.getBillingAddress().address1}<br>${order.getBillingAddress().address2 ? order.getBillingAddress().address2 : ''}
${order.getBillingAddress().city+' '+order.getBillingAddress().stateCode+' '+order.getBillingAddress().postalCode}<br>
Expand All @@ -170,7 +159,7 @@
<td class="center" colspan="2">
<button name="submit" class="button">${Resource.msg('operations.submit.label','afterpay',null)}</button>
<input type="hidden" name="orderno" value="${orderNo}">
<input type="hidden" name="amount" value="${order.getTotalGrossPrice()}">
<input type="hidden" name="amount" value="${afterpayTotalAmount}">
</td>
</tr>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ operations.actions=Choose any action
operations.orders= Choose order(s)
operations.wait=Please wait...
#Payment information
payment.total=Order Total:
payment.total=Afterpay Order Total:
payment.amount.paid=Amount Paid:
payment.balance.due=Balance Due:
payment.invoice.number=Invoice Number:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@
"clearpay": {
"paymentMethod": "CLEARPAY",
"paymentProcessor": "*/cartridge/scripts/payment/processor/CLEARPAY"
},
"cashapp": {
"paymentMethod": "CASHAPPPAY",
"paymentProcessor": "*/cartridge/scripts/payment/processor/CASHAPPPAY"
}
}
}
Loading

0 comments on commit 0b53bd2

Please sign in to comment.