Skip to content

Commit

Permalink
[SFI-516] Different live prefixes can be used accross sites (#1032)
Browse files Browse the repository at this point in the history
  • Loading branch information
zenit2001 authored Jan 10, 2024
1 parent a2adb52 commit a171f7b
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 1 deletion.
8 changes: 8 additions & 0 deletions metadata/site_import/meta/system-objecttype-extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,14 @@
<externally-managed-flag>false</externally-managed-flag>
<min-length>0</min-length>
</attribute-definition>
<attribute-definition attribute-id="Adyen_LivePrefix">
<display-name xml:lang="x-default">Your Adyen Live Prefix. Required to accept live payments</display-name>
<description xml:lang="x-default">Retrieve this value from Customer Area</description>
<type>string</type>
<mandatory-flag>false</mandatory-flag>
<externally-managed-flag>false</externally-managed-flag>
<min-length>0</min-length>
</attribute-definition>
<attribute-definition attribute-id="Adyen_GooglePayMerchantID">
<display-name xml:lang="x-default">Your Google MerchantID (required in production only)</display-name>
<description xml:lang="x-default">As described in https://developers.google.com/pay/api/web/guides/test-and-deploy/deploy-production-environment#obtain-your-merchantID</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ document.addEventListener('DOMContentLoaded', () => {
const infoLogCheckbox = document.getElementById('infoLogs');
const errorLogCheckbox = document.getElementById('errorLogs');
const fatalLogCheckbox = document.getElementById('fatalLogs');
const testRadio = document.getElementById('testRadio');
const productionRadio = document.getElementById('productionRadio');
const livePrefix = document.getElementById('livePrefix');
const troubleshootingCheckboxes = [
debugLogCheckbox,
infoLogCheckbox,
Expand Down Expand Up @@ -465,6 +468,14 @@ document.addEventListener('DOMContentLoaded', () => {
}
});

productionRadio.addEventListener('click', () => {
livePrefix.disabled = false;
});

testRadio.addEventListener('click', () => {
livePrefix.disabled = true;
});

adyenGivingBackground.addEventListener('click', saveAndHideAlerts);

adyenGivingLogo.addEventListener('click', saveAndHideAlerts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@
</div>
</div>
</div>
<div class="form-group">
<label class="form-title mb-0" for="livePrefix">Adyen Live Prefix</label>
<small id="livePrefixHelp" class="form-text mb-1">
This is the LIVE prefix you can retrieve from the <a class="text-primary" href="https://ca-live.adyen.com/" target="_blank">Customer Area.</a>
Different sites can use different prefixes depending in the selected datacenter.
</small>
<div class="input-fields">
<input type="text" class="form-control" name="Adyen_LivePrefix" id="livePrefix" aria-describedby="livePrefixHelp" placeholder="" value="${AdyenConfigs.getLivePrefix() || ''}" ${AdyenConfigs.getAdyenEnvironment() === 'TEST' ? 'disabled' : ''}>
</div>
</div>
<div class="form-group">
<label class="form-title mb-0" for="clienKey">Adyen Client Key</label>
<small id="clienKeyHelp" class="form-text mb-1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ const adyenConfigsObj = {
return getCustomPreference('Adyen_ClientKey');
},

getLivePrefix() {
return getCustomPreference('Adyen_LivePrefix');
},

getGoogleMerchantID() {
return getCustomPreference('Adyen_GooglePayMerchantID');
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,13 @@ var adyenHelperObj = {
if (service === null) {
throw new Error(`Could not create ${serviceType} service object`);
}

if (AdyenConfigs.getAdyenEnvironment() === constants.MODE.LIVE) {
const livePrefix = AdyenConfigs.getLivePrefix();
const serviceUrl = service.getURL().replace(`[YOUR_LIVE_PREFIX]`, livePrefix);
service.setURL(serviceUrl);
}

const maxRetries = constants.MAX_API_RETRIES;
const apiKey = AdyenConfigs.getAdyenApiKey();
const uuid = UUIDUtils.createUUID();
Expand Down
2 changes: 1 addition & 1 deletion tests/playwright/pages/PaymentMethodsPage.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ export default class PaymentMethodsPage {
this.klarnaIframe = this.page.frameLocator(
'#klarna-apf-iframe',
);
this.firstCancelButton = this.klarnaIframe.locator('#newCollectPhone__navbar__right-icon__icon-wrapper');
this.firstCancelButton = this.klarnaIframe.locator('#collectPhonePurchaseFlow__nav-bar__right-icon-wrapper');
this.secondCancelButton = this.klarnaIframe.locator("button[title='Close']");
await this.firstCancelButton.waitFor({
state: 'visible',
Expand Down

0 comments on commit a171f7b

Please sign in to comment.