-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: terminal selection with store filtering from storefront
- Loading branch information
Showing
16 changed files
with
130 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/cartridges/app_adyen_SFRA/cartridge/templates/default/checkout/billing/adyenPosForm.isml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/cartridges/app_adyen_SFRA/cartridge/templates/resources/terminal.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
terminal.selectStore=Please select your store | ||
terminal.selectTerminal=Please select your terminal | ||
terminal.noTerminals=There are no terminals connected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/cartridges/int_adyen_SFRA/cartridge/adyen/scripts/payments/getConnectedTerminals.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const PaymentMgr = require('dw/order/PaymentMgr'); | ||
const adyenTerminalApi = require('*/cartridge/adyen/scripts/payments/adyenTerminalApi'); | ||
const constants = require('*/cartridge/adyen/config/constants'); | ||
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs'); | ||
const AdyenConfigs = require('*/cartridge/adyen/utils/adyenConfigs'); | ||
|
||
function getConnectedTerminals(req, res, next) { | ||
try { | ||
const requestObject = {}; | ||
const getTerminalRequest = {}; | ||
const { storeId } = JSON.parse(req.form.data); | ||
const activatedStores = AdyenConfigs.getAdyenActiveStoreId(); | ||
getTerminalRequest.merchantAccount = AdyenConfigs.getAdyenMerchantAccount(); | ||
getTerminalRequest.store = storeId; | ||
requestObject.request = getTerminalRequest; | ||
|
||
if ( | ||
PaymentMgr.getPaymentMethod(constants.METHOD_ADYEN_POS).isActive() && | ||
activatedStores.includes(storeId) | ||
) { | ||
const response = adyenTerminalApi.executeCall( | ||
constants.SERVICE.CONNECTEDTERMINALS, | ||
requestObject, | ||
); | ||
res.json({ ...response }); | ||
} | ||
} catch (error) { | ||
AdyenLogs.fatal_log('/getConnectedTerminals call failed', error); | ||
res.json({ | ||
error: true, | ||
}); | ||
} | ||
return next(); | ||
} | ||
|
||
module.exports = getConnectedTerminals; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters