Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v4.5.0 #86

Merged
merged 89 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
dde6e51
feat:mpp-480 deferred capture button
joyet-simon Jul 27, 2023
0e0d68b
feat:mpp-480 add helper and test
joyet-simon Jul 27, 2023
c0a76b0
test : Update sinon package and test button getter
Francois-Gomis Jul 27, 2023
08702d5
Merge pull request #66 from alma/feat/mpp-480_deferred-capture-button
joyet-simon Jul 28, 2023
fe2c9c8
feat:mpp-479 capture method in payment payload intial tests
joyet-simon Jul 28, 2023
83889bf
feat:mpp-479 refacto and implement capture in payment data
joyet-simon Jul 28, 2023
371d480
feat:mpp-479 add tests
joyet-simon Jul 28, 2023
2751edd
feat:mpp-479 deferred capture rm get payment data
joyet-simon Aug 1, 2023
7f16983
Merge pull request #68 from alma/feat/mpp-479-capture-method-in-payme…
joyet-simon Aug 1, 2023
57b0692
feat:mpp-483 deferred capture endpoint implement
joyet-simon Aug 1, 2023
fff0047
feat:mpp-483 deferred capture endpoint error and tests
joyet-simon Aug 2, 2023
7f7439f
Merge pull request #70 from alma/feat/mpp-483-create-capture-payment-…
joyet-simon Aug 2, 2023
01634a2
feat:mpp-508 add flag for deferred capture in order
joyet-simon Aug 2, 2023
2297524
feat:mpp-508 rm some comment
joyet-simon Aug 3, 2023
8b734c1
feat:mpp-508 modify condition for manual capture
joyet-simon Aug 3, 2023
64d2bb8
feat:mpp-508 rename isManualCapture
joyet-simon Aug 3, 2023
05acffc
Merge pull request #71 from alma/feat/mpp-508-add-flag-for-deferred-i…
joyet-simon Aug 3, 2023
aab1dbc
feat:mpp-484 deferred capture job + tests
joyet-simon Aug 3, 2023
b133bfa
feat:mpp-484 implement capture at shipping job
joyet-simon Aug 3, 2023
e89ad6f
fix: test and mock
Francois-Gomis Aug 3, 2023
3ac2f0c
feat: add status filter for searchOrders
Francois-Gomis Aug 3, 2023
84edb1c
typo: to capture flag
Francois-Gomis Aug 4, 2023
e3c070a
feat: capture flag externally managed
Francois-Gomis Aug 4, 2023
c41b158
feat: capture flag name
Francois-Gomis Aug 4, 2023
91700b8
feat: Change capture wording and add constant
Francois-Gomis Aug 4, 2023
05cf833
Merge pull request #72 from alma/feat/mpp-484-implement-capture-at-sh…
Francois-Gomis Aug 7, 2023
4a3fc25
test: add test to refund job before deferred payment.
Francois-Gomis Aug 7, 2023
c888c76
test: add cancel payment Endpoint
Francois-Gomis Aug 7, 2023
6eecfe1
feat: cancel and refund for deferred payment
Francois-Gomis Aug 7, 2023
3110a78
feat: reset refund admin for after cancel job
Francois-Gomis Aug 7, 2023
b175bab
feat: add else for capture
Francois-Gomis Aug 7, 2023
752e658
feat: Add no call refund in test for cancel
Francois-Gomis Aug 7, 2023
f6819eb
feat: change deferred status after cancel
Francois-Gomis Aug 7, 2023
c14e286
Merge pull request #73 from alma/feat/mpp_489_deferred_payment_refund
joyet-simon Aug 8, 2023
78fbf7f
feat:mpp-523 change BO alma deferred capture value
joyet-simon Aug 8, 2023
a0e7d04
feat:mpp-523 disable error on refund job
joyet-simon Aug 8, 2023
49621d6
Merge pull request #74 from alma/feat/mpp-523-remove-transaction-Wrap…
joyet-simon Aug 8, 2023
4dde368
feat:mpp-532 support payment and authorization expiration
joyet-simon Aug 17, 2023
0f7b5d3
add pre-commit config file
joyet-simon Aug 18, 2023
fd36563
add jshint to pre-commit config file
joyet-simon Aug 18, 2023
a5931dd
feat:mpp-486 deferred capture refacto + tests
joyet-simon Aug 1, 2023
62dd6a4
feat:mpp-486 deferred capture frontend wording
joyet-simon Aug 1, 2023
10d300e
fix: unit test on payment data building
Francois-Gomis Sep 4, 2023
054bb8b
Merge pull request #69 from alma/feat/mpp-486-frontend-wording-for-in…
Francois-Gomis Sep 4, 2023
4a2c8d1
refactor: refactor eligibility helper for test.
Francois-Gomis Sep 4, 2023
de5d740
Merge pull request #76 from alma/feature/MPP-574_refactor_eligibility…
Francois-Gomis Sep 4, 2023
ffa3889
feature: add default value for capture_method to automatic
Francois-Gomis Sep 4, 2023
6c3a503
feature: add capture_method in eligibility calls
Francois-Gomis Sep 5, 2023
fcdff54
Merge pull request #77 from alma/feature/MPP-581_add_capture_method_i…
Francois-Gomis Sep 5, 2023
8969333
feature: Change wording on checkout with eligibility result
Francois-Gomis Sep 5, 2023
4ecd612
test: fix checkout test
Francois-Gomis Sep 5, 2023
e73c545
Merge pull request #78 from alma/feature/MPP-575_change_wording_for_d…
Francois-Gomis Sep 5, 2023
ebc5a30
feat: pre-commit hook config
joyet-simon Sep 6, 2023
d6dc262
feat: pre-commit hook stylelint
joyet-simon Sep 6, 2023
95160bd
feat: pre-commit hook jshint
joyet-simon Sep 6, 2023
a43918d
Merge branch 'develop' into feature/pre-commit-hook
joyet-simon Sep 6, 2023
a5b923a
Merge pull request #79 from alma/feature/pre-commit-hook
joyet-simon Sep 20, 2023
f0bc7f7
finish pre-commit implementation
joyet-simon Sep 20, 2023
3ef0817
Merge pull request #82 from alma/refactor/pre-commit
joyet-simon Sep 20, 2023
2916da2
add captureMethod in plan for checkout
joyet-simon Sep 21, 2023
edc3dc3
add captureMethod in plan for checkout
joyet-simon Sep 21, 2023
4633c4f
make plan factory for test
joyet-simon Sep 21, 2023
3e6e910
Add input capture amount field in BO
joyet-simon Sep 25, 2023
dd1ebfe
Partial capture get amount value unit test
joyet-simon Sep 25, 2023
f929526
cancel order on payment’s auth expired on IPN
joyet-simon Sep 25, 2023
029fcbd
fix authorization expired date test
joyet-simon Sep 27, 2023
1a306c3
Merge pull request #75 from alma/feat/MPP-532-payment-and-authorizati…
joyet-simon Sep 27, 2023
773e49b
get and set partial capture fields in Order helper
joyet-simon Oct 10, 2023
1238c95
add partial capture and variables to simplify code
joyet-simon Oct 10, 2023
f4be625
update site pref builder for partial capture
joyet-simon Oct 10, 2023
138e8e3
add and rectify unit tests for partial capture
joyet-simon Oct 10, 2023
e4b1baa
allow Alma payment methods for country GB
joyet-simon Oct 10, 2023
efa53f7
rm unused function in unit tests
joyet-simon Oct 10, 2023
eb2cd20
rm github codeowners
joyet-simon Oct 10, 2023
9d3b3b5
Merge branch 'develop' into feature/MPP-648_partial_capture
joyet-simon Oct 10, 2023
ab33b62
Merge pull request #83 from alma/feature/MPP-493_deferred_capture
joyet-simon Oct 10, 2023
e9543ee
set order’s deferred attributes after capture payment
joyet-simon Oct 11, 2023
8872100
Merge pull request #84 from alma/feature/MPP-648_partial_capture
joyet-simon Oct 11, 2023
688f5b8
update changelog
joyet-simon Oct 11, 2023
831093d
update unit test with the good alma_plugin_version
joyet-simon Oct 11, 2023
3db5153
Merge pull request #85 from alma/chore/update_changelog
joyet-simon Oct 11, 2023
498db60
resolve conflicts
joyet-simon Oct 11, 2023
2fa777a
Merge pull request #87 from alma/chore/temp_develop
joyet-simon Oct 11, 2023
9aa0398
add some constant and rename others
joyet-simon Oct 12, 2023
6bba0c7
extract some function
joyet-simon Oct 12, 2023
0608002
rename some unit tests
joyet-simon Oct 12, 2023
1e1a422
Merge pull request #88 from alma/fix/develop_pr
joyet-simon Oct 13, 2023
76fa50a
rename a constant
joyet-simon Oct 13, 2023
11ec724
Merge pull request #89 from alma/fix/develop_pr
joyet-simon Oct 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/CODEOWNERS

This file was deleted.

9 changes: 9 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"node": true,
"esversion": 8,
"expr": true,
"predef": [
"describe",
"it"
]
}
61 changes: 61 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
args: ["--maxkb=1024"]
- id: detect-private-key
- id: check-merge-conflict

- repo: https://github.com/pre-commit/mirrors-jshint
rev: v2.13.6
hooks:
- id: jshint
files: "(^.*\\.js$)"

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.29.0
hooks:
- id: eslint
files: "(^cartridges/int_alma/cartridge/.*\\.js$)"# *.js, *.jsx, *.ts and *.tsx
types: [file]
args:
- --fix

- repo: https://github.com/thibaudcolas/pre-commit-stylelint
rev: v14.16.0
hooks:
- id: stylelint
files: "(^cartridges/int_alma/cartridge/static/default/css/.*\\.css$)"
args:
- --config
- .stylelintrc.json
additional_dependencies:
- [email protected]
- [email protected]
- [email protected]
- [email protected]

# - repo: https://github.com/returntocorp/semgrep
# rev: v1.27.0
# hooks:
# - id: semgrep
# args:
# - --error
# - --config
# - semgrep/rules/
# - --metrics
# - "off"
# - --quiet
# - --disable-version-check
# - --skip-unknown-extensions
# pass_filenames: false # Passing files explicitely override semgremignore

- repo: https://github.com/alma/pre-commit-hooks
rev: 1.1.2
hooks:
- id: check-branch-name
args:
- "-r^((chore|ci|dependabot|devx|docs|feature|fix|hotfix|hotfix-backport|infra|other|perf|refactor|security|test)\/.+|(snyk)-.+|main|HEAD|develop)$$"
5 changes: 5 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

v4.5.0
------
* Feat: add Deferred Capture feature.
* Chore: add pre-commit tool.

v4.4.0
------
* Feat: In Page checkout
Expand Down
74 changes: 55 additions & 19 deletions cartridges/int_alma/cartridge/controllers/Alma.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,6 @@ function buildViewParams(paymentObj, order, localeId, reqProfile) {
return viewParams;
}

/**
* Synchronize order and payment details
* @param {string} pid payment id
* @param {Object} order order
* @throw Error
*/
function syncOrderAndPaymentDetails(pid, order) {
var almaPaymentHelper = require('*/cartridge/scripts/helpers/almaPaymentHelper');
var orderHelper = require('*/cartridge/scripts/helpers/almaOrderHelper');

orderHelper.addPidToOrder(order, pid);
almaPaymentHelper.setOrderMerchantReference(pid, order);
}

/**
* Ensure that Alma received the right amount and that SFCC order is synced
* @param {Object} paymentObj the payment to describe
Expand Down Expand Up @@ -84,6 +70,26 @@ function affectOrder(paymentObj, order) {
throw new Error(reason);
}

if (almaPaymentHelper.isPaymentExpired(paymentObj)) {
Transaction.wrap(function () {
order.trackOrderChange('Payment is expired');
OrderMgr.failOrder(order, true);
});

logger.warn('Payment: {0} is expired', [paymentObj.id]);
throw new Error('payment_expired');
}

if (almaPaymentHelper.isPaymentAuthorizationExpired(paymentObj)) {
Transaction.wrap(function () {
order.trackOrderChange('Payment’s authorization is expired');
OrderMgr.cancelOrder(order);
});

logger.warn('Authorization for the payment: {0} is expired', [paymentObj.id]);
throw new Error('authorization_expired');
}

var isOnShipmentPaymentEnabled = require('*/cartridge/scripts/helpers/almaOnShipmentHelper').isOnShipmentPaymentEnabled;
var paymentStatus = isOnShipmentPaymentEnabled(paymentObj.installments_count) ? Order.PAYMENT_STATUS_NOTPAID : Order.PAYMENT_STATUS_PAID;
acceptOrder(order, paymentStatus);
Expand Down Expand Up @@ -115,6 +121,7 @@ function buildPaymentObj(pid) {
server.get('PaymentSuccess', function (req, res, next) {
var paymentHelper = require('*/cartridge/scripts/helpers/almaPaymentHelper');
var orderHelper = require('*/cartridge/scripts/helpers/almaOrderHelper');
var configHelper = require('*/cartridge/scripts/helpers/almaConfigHelper');
var paymentObj = null;

try {
Expand All @@ -128,9 +135,16 @@ server.get('PaymentSuccess', function (req, res, next) {
}
var order = getOrderByAlmaPaymentId(req.querystring.pid);

var isDeferredCapture = paymentHelper.isAvailableForManualCapture(
configHelper.isDeferredCaptureEnable(),
paymentObj.installments_count,
paymentObj.deferred_days
);

if (!order) {
order = paymentHelper.createOrderFromBasket(req.querystring.alma_payment_method);
syncOrderAndPaymentDetails(req.querystring.pid, order);
orderHelper.addAlmaDataToOrder(req.querystring.pid, order, isDeferredCapture);
paymentHelper.setOrderMerchantReference(req.querystring.pid, order);
}

// we probably should throw an error if we don't have an order
Expand Down Expand Up @@ -269,11 +283,19 @@ server.get('OrderAmount', server.middleware.https, function (req, res, next) {
server.post('CreatePaymentUrl', server.middleware.https, function (req, res, next) {
var getLocale = require('*/cartridge/scripts/helpers/almaHelpers').getLocale;
var almaPaymentHelper = require('*/cartridge/scripts/helpers/almaPaymentHelper');
var almaConfigHelper = require('*/cartridge/scripts/helpers/almaConfigHelper');

var isDeferredCapture = almaPaymentHelper.isAvailableForManualCapture(
almaConfigHelper.isDeferredCaptureEnable(),
req.querystring.installments,
req.querystring.deferred_days
);

var paymentData = almaPaymentHelper.buildPaymentData(
req.querystring.installments,
req.querystring.deferred_days,
getLocale(req)
getLocale(req),
isDeferredCapture
);

try {
Expand Down Expand Up @@ -325,10 +347,20 @@ server.get(
function (req, res, next) {
var almaPaymentHelper = require('*/cartridge/scripts/helpers/almaPaymentHelper');
var getLocale = require('*/cartridge/scripts/helpers/almaHelpers').getLocale;
var almaConfigHelper = require('*/cartridge/scripts/helpers/almaConfigHelper');
var orderHelper = require('*/cartridge/scripts/helpers/almaOrderHelper');

var isDeferredCapture = almaPaymentHelper.isAvailableForManualCapture(
almaConfigHelper.isDeferredCaptureEnable(),
req.querystring.installments,
req.querystring.deferred_days
);

var paymentData = almaPaymentHelper.buildPaymentData(
req.querystring.installments,
req.querystring.deferred_days,
getLocale(req)
getLocale(req),
isDeferredCapture
);

try {
Expand All @@ -337,7 +369,8 @@ server.get(

if (!order) {
order = almaPaymentHelper.createOrderFromBasket(req.querystring.alma_payment_method);
syncOrderAndPaymentDetails(almaPayment.id, order);
orderHelper.addAlmaDataToOrder(almaPayment.id, order, isDeferredCapture);
almaPaymentHelper.setOrderMerchantReference(almaPayment.id, order);
}
res.setStatusCode(200);
res.json({
Expand Down Expand Up @@ -368,10 +401,13 @@ server.get('Plans',
var almaPlanHelper = require('*/cartridge/scripts/helpers/almaPlanHelper');

var BasketMgr = require('dw/order/BasketMgr');
var almaConfigHelper = require('*/cartridge/scripts/helpers/almaConfigHelper');

var isDeferredCaptureEnabled = almaConfigHelper.isDeferredCaptureEnable();
var currentBasket = BasketMgr.getCurrentBasket();

res.json({
plans: almaPlanHelper.getPlansForCheckout(getLocale(req), currentBasket)
plans: almaPlanHelper.getPlansForCheckout(getLocale(req), currentBasket, isDeferredCaptureEnabled)
});
return next();
});
Expand Down
6 changes: 5 additions & 1 deletion cartridges/int_alma/cartridge/controllers/Checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ server.append('Begin', function (req, res, next) {
var almaPlanHelper = require('*/cartridge/scripts/helpers/almaPlanHelper');
var almaHelpers = require('*/cartridge/scripts/helpers/almaHelpers');
var almaConfigInfo = getAlmaInfo();
var almaConfigHelper = require('*/cartridge/scripts/helpers/almaConfigHelper');


var BasketMgr = require('dw/order/BasketMgr');
var currentBasket = BasketMgr.getCurrentBasket();
Expand All @@ -60,14 +62,16 @@ server.append('Begin', function (req, res, next) {
return;
}

var isDeferredCaptureEnabled = almaConfigHelper.isDeferredCaptureEnable();

var viewData = Object.assign(
res.getViewData(),
almaConfigInfo,
getAlmaUrls(),
{
currencyCode: currentBasket.currencyCode,
purchase_amount: Math.round(currentBasket.totalGrossPrice.multiply(100).value),
plans: almaPlanHelper.getPlansForCheckout(getLocale(req), currentBasket),
plans: almaPlanHelper.getPlansForCheckout(getLocale(req), currentBasket, isDeferredCaptureEnabled),
inpage_on_close_message: Resource.msg('alma.inpage_on_close_message', 'alma', null),
inpage_on_failure_message: Resource.msg('alma.inpage_on_failure_message', 'alma', null),
locale: getLocale(req)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ var Resource = require('dw/web/Resource');
var formatCurrency = require('*/cartridge/scripts/util/formatting').formatCurrency;
var isOnShipmentPaymentEnabled = require('*/cartridge/scripts/helpers/almaOnShipmentHelper').isOnShipmentPaymentEnabled;
var PaymentMgr = require('dw/order/PaymentMgr');
var almaConfigHelper = require('*/cartridge/scripts/helpers/almaConfigHelper');
var almaPaymentHelper = require('*/cartridge/scripts/helpers/almaPaymentHelper');

var ALMA_PNX_ID = 'ALMA_PNX';
var ALMA_CREDIT_ID = 'ALMA_CREDIT';
Expand All @@ -17,12 +19,8 @@ var paymentMethodId = '';
* @returns {string} the custom site preference name
*/
function getSelectorNameFromPlan(plan) {
return 'ALMA_general_'
// number of installments (p1x, p3x, p4x, ....)
+ plan.installments_count + '_'
// by how many days is the payment defered
+ plan.deferred_days
;
// ALMA_general + number of installments (p1x, p3x, p4x, ....) + by how many days is the payment defered
return 'ALMA_general_' + plan.installments_count + '_' + plan.deferred_days;
}

/**
Expand Down Expand Up @@ -70,7 +68,8 @@ function getCreditInfo(plan, currencyCode) {
var costOfCredit = formatCurrency(plan.customer_total_cost_amount / 100, currencyCode);
var purchaseAmount = formatCurrency(plan.purchaseAmount, currencyCode);
var totalCost = formatCurrency(plan.purchaseAmount + (plan.customer_total_cost_amount / 100), currencyCode);
var rate = Math.round(plan.annual_interest_rate / 100).toString() + '.' + (plan.annual_interest_rate % 100) + '%';
var rate = Math.round(plan.annual_interest_rate / 100)
.toString() + '.' + (plan.annual_interest_rate % 100) + '%';
return {
basket_cost: Resource.msgf('alma.credit.basket_cost', 'alma', null, purchaseAmount),
amount: Resource.msgf('alma.credit.cost_of_credit', 'alma', null, costOfCredit),
Expand Down Expand Up @@ -131,6 +130,15 @@ function getPaymentInstallments(plan, currencyCode) {
formatCurrency(plan.payment_plan[1].purchase_amount / 100, currencyCode)
;
}
// on deferred capture
if (almaPaymentHelper.isAvailableForManualCapture(almaConfigHelper.isDeferredCaptureEnable(), plan.installments_count, plan.deferred_days)) {
return formatCurrency(plan.payment_plan[0].purchase_amount / 100, currencyCode) + ' ' +
plan.payment_plan[0].localized_due_date +
Resource.msg(getPropertyCategory(plan) + '.installments.then', 'alma', null) + ' ' +
getInstallmentCountAfterFirst(plan) +
formatCurrency(plan.payment_plan[1].purchase_amount / 100, currencyCode)
;
}
// installment payment
return formatCurrency(plan.payment_plan[0].purchase_amount / 100, currencyCode) + ' ' +
Resource.msg(getPropertyCategory(plan) + '.installments', 'alma', null) + ' ' +
Expand Down Expand Up @@ -166,24 +174,17 @@ function isAvailableForInpage(installmentsCount, deferredDays) {
return installmentsCount <= 4 && deferredDays <= 0;
}

/**
* Returns true if the merchant want in-page payment
* @returns {boolean} if we can use inpage
*/
function isInpageActivated() {
var Site = require('dw/system/Site');

return Site.getCurrent().getCustomPreferenceValue('ALMA_Inpage_Payment');
}

/**
* Return true if plan is activated
* @param {Object} paymentMethod payment method
* @param {Object} plan plan
* @returns {boolean} payment method ID
*/
function planIsActivated(paymentMethod, plan) {
var almaActivated = paymentMethod.getCustom().almaActivated.trim().split('|');
var almaActivated = paymentMethod.getCustom()
.almaActivated
.trim()
.split('|');

return almaActivated.some(function (element) {
return element.includes(plan.installments_count) || element.includes(plan.deferred_days);
Expand All @@ -205,9 +206,7 @@ function getPlanPaymentMethodID(plan) {
if (plan.deferred_days > 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_DEFERRED_ID), plan)) {
paymentMethodId = ALMA_DEFERRED_ID;
}
if (plan.installments_count === 1
&& plan.deferred_days === 0
&& planIsActivated(PaymentMgr.getPaymentMethod(ALMA_PAY_NOW_ID), plan)) {
if (plan.installments_count === 1 && plan.deferred_days === 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_PAY_NOW_ID), plan)) {
paymentMethodId = ALMA_PAY_NOW_ID;
}

Expand All @@ -224,7 +223,7 @@ function formatPlanForCheckout(plan, currencyCode) {
var formatPlan = {};
if (plan.installments_count < 5 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_PNX_ID), plan)) {
formatPlan = {
in_page: isAvailableForInpage(plan.installments_count, plan.deferred_days) && isInpageActivated(),
in_page: isAvailableForInpage(plan.installments_count, plan.deferred_days) && almaConfigHelper.isInpageActivated(),
selector: getSelectorNameFromPlan(plan),
installments_count: plan.installments_count,
deferred_days: plan.deferred_days,
Expand All @@ -237,7 +236,7 @@ function formatPlanForCheckout(plan, currencyCode) {
}
if (plan.installments_count >= 5 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_CREDIT_ID), plan)) {
formatPlan = {
in_page: isAvailableForInpage(plan.installments_count, plan.deferred_days) && isInpageActivated(),
in_page: isAvailableForInpage(plan.installments_count, plan.deferred_days) && almaConfigHelper.isInpageActivated(),
selector: getSelectorNameFromPlan(plan),
installments_count: plan.installments_count,
deferred_days: plan.deferred_days,
Expand All @@ -250,7 +249,7 @@ function formatPlanForCheckout(plan, currencyCode) {
}
if (plan.deferred_days > 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_DEFERRED_ID), plan)) {
formatPlan = {
in_page: isAvailableForInpage(plan.installments_count, plan.deferred_days) && isInpageActivated(),
in_page: isAvailableForInpage(plan.installments_count, plan.deferred_days) && almaConfigHelper.isInpageActivated(),
selector: getSelectorNameFromPlan(plan),
installments_count: plan.installments_count,
deferred_days: plan.deferred_days,
Expand All @@ -263,7 +262,7 @@ function formatPlanForCheckout(plan, currencyCode) {
}
if (plan.installments_count === 1 && plan.deferred_days === 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_PAY_NOW_ID), plan)) {
formatPlan = {
in_page: isAvailableForInpage(plan.installments_count, plan.deferred_days) && isInpageActivated(),
in_page: isAvailableForInpage(plan.installments_count, plan.deferred_days) && almaConfigHelper.isInpageActivated(),
selector: getSelectorNameFromPlan(plan),
installments_count: plan.installments_count,
deferred_days: plan.deferred_days,
Expand All @@ -280,6 +279,5 @@ function formatPlanForCheckout(plan, currencyCode) {
module.exports = {
formatPlanForCheckout: formatPlanForCheckout,
getPlanPaymentMethodID: getPlanPaymentMethodID,
isAvailableForInpage: isAvailableForInpage,
isInpageActivated: isInpageActivated
isAvailableForInpage: isAvailableForInpage
};
Loading