Skip to content

Commit

Permalink
[SFCC-24]: Adding SCA logic to Signifyd (#30)
Browse files Browse the repository at this point in the history
* SSIG-46

- Updated create case and send transaction APIs from v2 to v3

* SSIG-46: Adding fullName to destination

* SFCC-18: Changing fulfillment logic to V3

* SFCC-20: Task development

* SFCC-23: Ticket development

* SFCC-23: Adding custom preferences and attributes

* SFCC-23: Updating service credentials

* SFCC-23: Changing verification to signifyd policy

* SFCC-23: Removing decision center logic and guarantee disposition

* Updated documentation

* SFCC-24: SCA Payment verification

* SFCC-24: Adding SCA attributes xml

* draft: Adding adyen cartridge

* draft: Adding testing parameters

* Draft: adding .project file

* draft: Adding SFRA new version

* draft: Adding Signifyd functions to Adyen checkout

* SFCC-26: Adding testing logic

* Adding missing Transaction API fields

* [SFCC-22]: BD signifyd custom preferences updated   (#29)

* SFCC-22 updated  signifyd custom preferences

* [SFCC-22]: BD signifyd custom preferences fix

* SFCC-22-V1 updated metadata.

* Removing testing code

* Removing git ignore

* Removing adyen

* Removing testing comments and transactions

* Update .gitignore

Co-authored-by: Renato Diniz <[email protected]>
Co-authored-by: christianMwanichetaOSF <[email protected]>
  • Loading branch information
3 people committed Sep 9, 2022
1 parent 4683e76 commit e960b5b
Show file tree
Hide file tree
Showing 672 changed files with 17,366 additions and 3,040 deletions.
56 changes: 56 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# These are some examples of commonly ignored file patterns.
# You should customize this list as applicable to your project.
# Learn more about .gitignore:
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore

# Node artifact files
node_modules/
dist/

# Compiled Java class files
*.class

# Compiled Python bytecode
*.py[cod]

# Log files
*.log

# Package files
*.jar

# Maven
target/
dist/

# JetBrains IDE
.idea/

# Unit test reports
TEST*.xml

# Generated by MacOS
.DS_Store

# Generated by Windows
Thumbs.db

# Applications
*.app
*.exe
*.war

# Large media files
*.mp4
*.tiff
*.avi
*.flv
*.mov
*.wmv

# DW CLI
/**/dw*.json

#VS Code
*.code-workspace
.vscode
71 changes: 71 additions & 0 deletions link/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# These are some examples of commonly ignored file patterns.
# You should customize this list as applicable to your project.
# Learn more about .gitignore:
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore

# Node artifact files
node_modules/
dist/

# Compiled Java class files
*.class

# Compiled Python bytecode
*.py[cod]

# Log files
*.log

# Package files
*.jar

# Maven
target/
dist/

# JetBrains IDE
.idea/

# Unit test reports
TEST*.xml

# Generated by MacOS
.DS_Store

# Generated by Windows
Thumbs.db

# Applications
*.app
*.exe
*.war

# Large media files
*.mp4
*.tiff
*.avi
*.flv
*.mov
*.wmv

# Metadata
/metadata/metadata/
/metadata/*.zip

# DW CLI
/**/dw*.json

# SFRA

/cartridges/int_cybersource_sfra/cartridge/static/*/css/
/cartridges/int_cybersource_sfra/cartridge/static/*/js/

/cartridges/intermix_core/cartridge/static/*/js/
/cartridges/intermix_core/cartridge/static/*/css/
# Yeoman
/.yo-repository/

#VS Code
*.code-workspace
.vscode

Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ function process(body) {
if (body.checkpointAction) {
if (body.checkpointAction.toUpperCase() === 'ACCEPT') {
order.custom.SignifydPolicy = 'accept';
order.setStatus(order.EXPORT_STATUS_READY);
} else if (body.checkpointAction.toUpperCase() === 'REJECT') {
order.custom.SignifydPolicy = 'reject';
} else {
Expand Down Expand Up @@ -460,6 +461,7 @@ function setOrderSessionId(order, orderSessionId) {
var SignifydCreateCasePolicy = dw.system.Site.getCurrent().getCustomPreferenceValue('SignifydCreateCasePolicy').value;
var SignifydDecisionRequest = dw.system.Site.getCurrent().getCustomPreferenceValue('SignifydDecisionRequest').value;
var SignifydPassiveMode = dw.system.Site.getCurrent().getCustomPreferenceValue('SignifydPassiveMode');
var SignifydSCAEnableSCAEvaluation = dw.system.Site.getCurrent().getCustomPreferenceValue('SignifydSCAEnableSCAEvaluation');
var orderCreationCal = new Calendar(order.creationDate);
var paramsObj = {
device: {
Expand Down Expand Up @@ -489,6 +491,9 @@ function setOrderSessionId(order, orderSessionId) {

if (SignifydCreateCasePolicy === "PRE_AUTH") {
paramsObj.checkoutId = order.getUUID();
if (SignifydSCAEnableSCAEvaluation && checkSCAPaymentMethod(order)) {
paramsObj.additionalEvalRequests = ["SCA_EVALUATION"];
}
}

if (SignifydPassiveMode) {
Expand Down Expand Up @@ -567,7 +572,11 @@ function getSendTransactionParams(order) {
verifications: {
avsResponseCode: '', // to be updated by the merchant
cvvResponseCode: '', // to be updated by the merchant
}
},
acquirerDetails: '', // to be updated by the merchant if using SCA
threeDsResult: '', // to be updated by the merchant if using SCA
// uncomment line below if using SCA
// scaExemptionRequested: order.custom.SignifydExemption
}],
};

Expand Down Expand Up @@ -625,6 +634,21 @@ function checkPaymentMethodExclusion(order) {
return !result;
}

function checkSCAPaymentMethod(order) {
var signifydSCAPaymentMethods = Site.getCurrent().getCustomPreferenceValue('SignifydSCAPaymentMethods');
var signifydSCAPaymentMethodsArray = signifydSCAPaymentMethods ? signifydSCAPaymentMethods : "";
var paymentInstruments = order.getPaymentInstruments();
var result;

var iterator = paymentInstruments.iterator();
while(iterator.hasNext()) {
var paymentInstrument = iterator.next();
result = signifydSCAPaymentMethodsArray.indexOf(paymentInstrument.paymentMethod) > -1;
}

return result;
}

// eslint-disable-next-line valid-jsdoc
/**
* Send Signifyd order info and
Expand Down Expand Up @@ -709,6 +733,17 @@ exports.Call = function (order) {
order.custom.SignifydPolicy = answer.decision.checkpointAction;
order.custom.SignifydPolicyName = answer.decision.checkpointActionReason;

if (!empty(answer.scaEvaluation)) {
if (!empty(answer.scaEvaluation.outcome)) {
order.custom.SignifydSCAOutcome = answer.scaEvaluation.outcome;
}
if (!empty(answer.scaEvaluation.exemptionDetails)) {
order.custom.SignifydExemption = answer.scaEvaluation.exemptionDetails.exemption;
}
if (!empty(answer.scaEvaluation.exemptionDetails)) {
order.custom.SignifydPlacement = answer.scaEvaluation.exemptionDetails.placement;
}
}
}
});

Expand Down
18 changes: 18 additions & 0 deletions link/metadata/meta/system-objecttype-extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,22 @@
<mandatory-flag>false</mandatory-flag>
<externally-managed-flag>false</externally-managed-flag>
</attribute-definition>
<attribute-definition attribute-id="SignifydSCAEnableSCAEvaluation">
<display-name xml:lang="x-default">Signifyd Enable SCA</display-name>
<description xml:lang="x-default">Enable or disable SCA payment methods</description>
<type>boolean</type>
<mandatory-flag>false</mandatory-flag>
<externally-managed-flag>false</externally-managed-flag>
<default-value>false</default-value>
</attribute-definition>
<attribute-definition attribute-id="SignifydSCAPaymentMethods">
<display-name xml:lang="x-default">Signifyd SCA Payment Methods</display-name>
<description xml:lang="x-default">Payment methods IDs, found in: Merchant Tools &gt; Ordering &gt; Payment Methods.&#13;
Informing a payment method ID is required if SignifydSCAEnableSCAEvaluation is set to "Yes"</description>
<type>set-of-string</type>
<mandatory-flag>false</mandatory-flag>
<externally-managed-flag>false</externally-managed-flag>
</attribute-definition>
</custom-attribute-definitions>
<group-definitions>
<attribute-group group-id="Signifyd Settings">
Expand All @@ -190,6 +206,8 @@
<attribute attribute-id="SignifydEnableCartridge"/>
<attribute attribute-id="SignifydMaxRetryCount"/>
<attribute attribute-id="SignifydPassiveMode"/>
<attribute attribute-id="SignifydSCAEnableSCAEvaluation"/>
<attribute attribute-id="SignifydSCAPaymentMethods"/>
<attribute attribute-id="SignifydPaymentMethodExclusion"/>
</attribute-group>
</group-definitions>
Expand Down
17 changes: 0 additions & 17 deletions link/metadata/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
<password encrypted="true" encryption-type="common.export">mWwXvPZDOsusirJxaBwr6dmbUhxzBd8QbVMoCydX5hk=</password>
</service-credential>

<service-credential service-credential-id="signifyd.rest.send.fulfillment.development.cred">
<url>https://api.signifyd.com/v2/fulfillments/orderId</url>
<user-id>signifyd</user-id>
<password encrypted="true" encryption-type="common.export">HjKFxSvEfXB4f/Capj3AHW77ilzFpkWJPV0QbGYrQig=</password>
</service-credential>

<service-profile service-profile-id="Signifyd Profile">
<timeout-millis>1000</timeout-millis>
<rate-limit-enabled>false</rate-limit-enabled>
Expand Down Expand Up @@ -84,15 +78,4 @@
<credential-id>SignifydTransaction</credential-id>
</service>

<service service-id="Signifyd.REST.SendFulfillment">
<service-type>HTTPForm</service-type>
<enabled>true</enabled>
<log-prefix/>
<comm-log-enabled>false</comm-log-enabled>
<force-prd-enabled>true</force-prd-enabled>
<mock-mode-enabled>false</mock-mode-enabled>
<profile-id>Signifyd Profile</profile-id>
<credential-id>signifyd.rest.send.fulfillment.development.cred</credential-id>
</service>

</services>
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
#Thu Jun 09 11:30:40 EDT 2016
demandware.cartridges.app_storefront_base.multipleLanguageStorefront=true
demandware.cartridges.app_storefront_base.id=app_storefront_base
demandware.cartridges.app_storefront_base.version=6.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

$(document).ready(function () {
if (window.resetCampaignBannerSessionToken) {
window.sessionStorage.removeItem('hide_campaign_banner');
}

var campaignBannerStatus = window.sessionStorage.getItem('hide_campaign_banner');
$('.campaign-banner .close').on('click', function () {
$('.campaign-banner').addClass('d-none');
window.sessionStorage.setItem('hide_campaign_banner', '1');
});

if (!campaignBannerStatus || campaignBannerStatus < 0) {
$('.campaign-banner').removeClass('d-none');
}
});
Loading

0 comments on commit e960b5b

Please sign in to comment.