Skip to content

Commit

Permalink
Merge pull request #13 from cybersource-tpi/v24.3.0_
Browse files Browse the repository at this point in the history
V24.3.0
  • Loading branch information
cybersource-tpi authored Aug 15, 2024
2 parents 7eacdcb + b4e5e18 commit 3143f3c
Show file tree
Hide file tree
Showing 31 changed files with 433 additions and 236 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

* **Description:** Cybersource, a Visa solution, is the only global, modular payment management platform built on secure Visa infrastructure with the payment reach and fraud insights of a massive $500B+ global processing network. You can find out more about what Cybersource does [here](https://www.cybersource.com/en-gb.html)
* **Categories:** Payment Processing, Fraud Detection, Address Validation, Tax Computation
* **Version:** 24.2.1
* **Last Certification Date:** May 2024
* **Supports SFRA v6.3.0**
* **Version:** 24.3.0
* **Last Certification Date:** August 2024
* **Supports SFRA v7.0**
* **JavaScript Controllers Friendly:** **YES**

### Contact ###
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,28 @@ $(document).ready(function () {
var number = microform.createField('number');
var securityCode = microform.createField('securityCode');
securityCode.load('#securityCode-container');

number.load('#cardNumber-container');
number.on('change', function (data) {
if (data.couldBeValid) {
$('.card-number-wrapper .invalid-feedback').css('display', 'none');
}
var cardType = data.card[0].name;
$('.card-number-wrapper').attr('data-type', cardType);
$('#cardType').val(cardType);
});


$('#expirationMonth').on('change', function (event) {
$('#expirationMonthMissingMessage').css('display', 'none');
$('#expiredCardMessage').css('display', 'none');
})
$('#expirationYear').on('change', function (event) {
$('#expirationYearMissingMessage').css('display', 'none');
$('#expiredCardMessage').css('display', 'none');
})


/**
* *
* @param {*} token *
Expand All @@ -60,9 +76,6 @@ $(document).ready(function () {
var expMonth = $('#expirationMonth').val();
var expYear = $('#expirationYear').val();

if (expMonth === '' || expYear === '') {
return false;
}
// Send in optional parameters from other parts of your payment form
var options = {
expirationMonth: expMonth.length === 1 ? '0' + expMonth : expMonth,
Expand All @@ -76,11 +89,21 @@ $(document).ready(function () {
microform.createToken(options, function (err, response) {
// At this point the token may be added to the form
// as hidden fields and the submission continued
let flag = false;

if (err) {
$('.card-number-wrapper .invalid-feedback').text(err.message).css('display', 'block');
flag = true;
}

if (!cardExpiryValidate()) {
flag = true;
}

if (flag == true) {
return true;
}

var decodedJwt = parseJwt(response);
document.getElementById('cardNumber').valid = true;
$('#flex-response').val(response);
Expand Down Expand Up @@ -128,6 +151,34 @@ $(document).ready(function () {
}
}

function cardExpiryValidate() {
var expMonth = $('#expirationMonth').val();
var expYear = $('#expirationYear').val();

if (expMonth == '' || expYear == '') {
if (expMonth == '') {
$('#expirationMonthMissingMessage').css('display', 'block');
}
if (expYear == '') {
$('#expirationYearMissingMessage').css('display', 'block');
}
return false;
}
else {
let currentDate = new Date();
let currentMonth = currentDate.getMonth() + 1;
let currentYear = currentDate.getFullYear();

// Check if the card is expired
if (expYear < currentYear || (expYear == currentYear && expMonth < currentMonth)) {
$('#expiredCardMessage').css('display', 'block');
return false;
}
}
return true;
}


$('.payment-summary .edit-button').on('click', function () {
$('#flex-response').val('');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,19 @@ $('#checkout-main').on('click', '.next-step-button button', function (event) {
});
}
});

$('#applePayPaymentOptionLink').on('click', function (event) {
$('#placeOrderButton').hide();
});

$('#gPaypaymentOptionLink').on('click', function (event) {
$('#placeOrderButton').hide();
});

$('#visaCheckoutPaymentOptionLink').on('click', function (event) {
$('#placeOrderButton').hide();
});

$('#creditCardPaymentOptionLink').on('click', function (event) {
$('#placeOrderButton').show();
});
module.exports = base;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<isset name="isCartridgeEnabled" value="${require('*/cartridge/configuration/index').cartridgeEnabled}" scope="page" />
<isif condition="${isTokenationEnabled && isCartridgeEnabled}">
<script src="${URLUtils.staticURL('/custom/lib/jquery/jquery-3.5.1.min.js')}" type="text/javascript"></script>
<script src="${URLUtils.staticURL('/custom/js/flexMicroform.js')}" type="text/javascript"></script>
<script src="${URLUtils.staticURL('/custom/flexMicroform.js')}" type="text/javascript"></script>
</isif>

<form action="${URLUtils.url('PaymentInstruments-SavePayment', 'UUID', pdict.UUID)}" class="payment-form" method="POST" name="payment-form"
Expand Down Expand Up @@ -69,9 +69,10 @@
</isif> >${month.label}</option>
</isloop>
</select>
<div class="invalid-feedback">
<isprint value="${pdict.paymentForm.expirationMonth.error}" encoding="htmlcontent" />
</div>

<span class="invalid-feedback" id="expirationMonthMissingMessage">${Resource.msg('payment.card.month.missing', 'forms', null)}</span>
<span class="invalid-feedback" id="expiredCardMessage">${Resource.msg('error.message.creditexpiration.expired', 'forms', null)}</span>

</div>
</div>

Expand All @@ -89,7 +90,9 @@
<option id="${year}" value="${year}" <isif condition="${year == pdict.paymentForm.expirationYear.value}">selected</isif> >${year}</option>
</isloop>
</select>
<div class="invalid-feedback"></div>

<span class="invalid-feedback" id="expirationYearMissingMessage">${Resource.msg('payment.card.year.missing', 'forms', null)}</span>

</div>
</div>
</div>
Expand Down Expand Up @@ -139,7 +142,7 @@
<!-- Last Name -->
<div class="col-6">
<div class="form-group
${pdict.paymentForm.billToAddressFieldslastName.mandatory === true ? 'required' : ''}">
${pdict.paymentForm.billToAddressFields.lastName.mandatory === true ? 'required' : ''}">
<label class="form-control-label" for="lastName">
<isprint value="${pdict.paymentForm.billToAddressFields.lastName.label}" encoding="htmlcontent" />
</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@
<isapplepay class="apple-pay-cart btn btn-block"></isapplepay>
</div>
</isif>
<div class="col-12">
<isinclude template="checkout/billing/paymentOptions/googleButton" />
</div>

</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<iselse>
<input type="hidden" id="carttotal" value="${pdict.totals.grandTotal}" />
</isif>
<isinclude template="checkout/billing/paymentOptions/googleButton" />

</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

<isset name="isFlexEnabled" value="${require('*/cartridge/configuration/index').flexMicroformEnabled}" scope="page" />
<isset name="isCartridgeEnabled" value="${require('*/cartridge/configuration/index').cartridgeEnabled}" scope="page" />
<isset name="isTokenizationEnabled" value="${require('*/cartridge/configuration/index').tokenizationEnabled}" scope="page" />
<isif condition="${isFlexEnabled && isCartridgeEnabled}">
<script src="${URLUtils.staticURL('/custom/lib/jquery/jquery-3.5.1.min.js')}" type="text/javascript"></script>
<script src="${URLUtils.staticURL('/custom/js/flexMicroform.js')}" type="text/javascript"></script>
<script src="${URLUtils.staticURL('/custom/flexMicroform.js')}" type="text/javascript"></script>
<isinclude url="${URLUtils.url('SecureAcceptance-CreateFlexToken')}"></isinclude>
</isif>

Expand Down Expand Up @@ -53,7 +54,12 @@
</option>
</isloop>
</select>
<div class="invalid-feedback" id="expirationMonthInvalidMessage"></div>

<span class="invalid-feedback" id="expirationMonthMissingMessage">${Resource.msg('payment.card.month.missing', 'forms', null)}</span>
<isif condition="${isFlexEnabled}">
<span class="invalid-feedback" id="expiredCardMessage">${Resource.msg('error.message.creditexpiration.expired', 'forms', null)}</span>
</isif>

</div>
</div>
<div class="col-6">
Expand All @@ -77,7 +83,10 @@
</option>
</isloop>
</select>
<div class="invalid-feedback" id="expirationYearInvalidMessage"></div>

<span class="invalid-feedback" id="expirationYearMissingMessage">${Resource.msg('payment.card.year.missing', 'forms', null)}</span>


</div>
</div>
</div>
Expand Down Expand Up @@ -108,7 +117,7 @@

<div class="row">
<div class="col">
<isif condition="${pdict.customer.registeredUser}">
<isif condition="${pdict.customer.registeredUser && isTokenizationEnabled}">
<div class="save-credit-card custom-control custom-checkbox ">
<input type="checkbox" class="custom-control-input" id="saveCreditCard"
name="${creditFields.saveCard.htmlName}" value="true" checked>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<li class="nav-item applepay-tab-wrapper" data-method-id="${paymentOption.ID}">
<a class="nav-link applepay-tab" data-toggle="tab" href="#applepay-content" role="tab">
<a class="nav-link applepay-tab" data-toggle="tab" href="#applepay-content" role="tab" id="applePayPaymentOptionLink">
<img class="applepay-options"
src="${URLUtils.staticURL('/images/apple.png')}"
height="32"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<li class="nav-item" data-method-id="${paymentOption.ID}">
<a class="nav-link credit-card-tab active" data-toggle="tab" href="#credit-card-content" role="tab" id="creditCardPaymentOptionLink">
<img class="credit-card-option"
src="${URLUtils.staticURL('/images/credit.png')}"
height="32"
alt="${paymentOption.name}"
title="${paymentOption.name}"
>
</a>
</li>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--------------------------------------------------------------
</iscomment>
<li class="nav-item googlepay-tab-wrapper" data-method-id="${paymentOption.ID}">
<a class="nav-link google-tab" data-toggle="tab" href="#googlepay-content" role="tab">
<a class="nav-link google-tab" data-toggle="tab" href="#googlepay-content" role="tab" id="gPaypaymentOptionLink">
${paymentOption.name}
</a>
</li>
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@


<isif condition="${!VisaSRCProduction}">
<img alt="Visa SRC" class="v-button" role="button" src="${visaSRCEndpoints.Stage.image}" />
<div style="text-align: center;">
<img alt="Visa SRC" class="v-button" role="button" src="${visaSRCEndpoints.Stage.image}" />
</div>
<script type="text/javascript" src="${visaSRCEndpoints.Stage.sdk}"></script>
</isif>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<li class="nav-item visasrc-tab-wrapper" data-method-id="${paymentOption.ID}">
<a class="nav-link visasrc-tab" data-toggle="tab" href="#visasrc-content" role="tab">
${Resource.msg('msg.click.to.pay', 'visaSRC', null)}
</a>
</li>
<li class="nav-item visasrc-tab-wrapper" data-method-id="${paymentOption.ID}">
<a class="nav-link visasrc-tab" data-toggle="tab" href="#visasrc-content" role="tab" id="visaCheckoutPaymentOptionLink">
${Resource.msg('msg.click.to.pay', 'visaSRC', null)}
</a>
</li>
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<button class="btn btn-primary btn-block submit-shipping" type="submit" name="submit" value="submit-shipping" <isif condition="${pdict.order.usingMultiShipping && !pdict.order.shippable}">disabled</isif>> ${Resource.msg('button.next.payment', 'checkout', null)}
</button>

<button class="btn btn-primary btn-block submit-payment" type="submit" name="submit" value="submit-payment">
<button class="btn btn-primary btn-block submit-payment" type="submit" name="submit" value="submit-payment" id='placeOrderButton'>
${Resource.msg('button.next.place.order', 'checkout', null)}
</button>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@

var authNames = [];
var contentTypes = ['application/json;charset=utf-8'];
var accepts = ['application/hal+json', 'application/xml'];
var accepts = ['application/hal+json;charset=utf-8'];
var returnType = ReportingV3ConversionDetailsGet200Response;

return this.apiClient.callApi(
Expand Down
10 changes: 2 additions & 8 deletions cartridges/int_cybs_sfra_base/cartridge/configuration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var LogfileMaxSize = '5242880'; // 10 MB In Bytes
* Send this value in all requests that are sent through the partner solution. CyberSource assigns the ID to the partner.
* Note When you see a partner ID of 999 in reports, the partner ID that was submitted is incorrect.
*/
var SolutionId = 'QBZT2URS';
var SolutionId = '2TLC4V9R';

var CruiseDDCEndPoint = {
Stage: 'https://centinelapistag.cardinalcommerce.com/V1/Cruise/Collect',
Expand Down Expand Up @@ -67,6 +67,7 @@ function getConfig(config) {
merchantKeyId: config.merchantKeyId || customPreferences.Core.Preferences.MerchantKeyId.getValue(),
merchantsecretKey: config.merchantSecretKey || customPreferences.Core.Preferences.MerchantKeySecret.getValue(),
developerId: config.developerId || customPreferences.Core.Preferences.DeveloperId.getValue(),
CommerceIndicator: config.CommerceIndicator || customPreferences.Core.Preferences.CommerceIndicator.getValue(),

// Delivery address verification
davEnabled: config.davEnabled || customPreferences.DeliveryAddressVerification.Preferences.DAVEnabled.getValue(),
Expand Down Expand Up @@ -98,13 +99,6 @@ function getConfig(config) {
taxShipFromCountryCode: config.taxShipFromCountryCode || customPreferences.TaxConfiguration.Preferences.ShipFromCountryCode.getValue(),
calculateTaxOnRoute: [{
route: 'CheckoutShippingServices-SubmitShipping'
},
{
route: 'CheckoutServices-SubmitPayment'
},
{
route: 'CheckoutServices-PlaceOrder',
recalculate: true
}
],
taxCookieId: '_taxvalue',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ module.exports = {
flags: {
mandatory: false
}
},
/** @type {CustomPreference} */
CommerceIndicator: {
id: 'Cybersource_CommerceIndicator' ,
display_name: 'Commerce Indicator',
description: '',
type: Types.EnumOfString,
default: 'internet',
flags: {
mandatory: false
}
}
}
},
Expand Down
Loading

0 comments on commit 3143f3c

Please sign in to comment.