-
Notifications
You must be signed in to change notification settings - Fork 145
Description
Description
Adyen terminal settings API does not allow resetting surcharge configurations (so they no longer apply)
Steps to reproduce
TerminalSettings terminalSettings = new TerminalSettings();
// Toggle off surcharging
terminalSettings.setSurcharge(null);This should work to basically reset surcharge configurations so none apply on the terminal devices assigned to the store. We get a 200 back, but it no-ops and doesn't actually undo the surcharge configurations.
The suggestion from support was to pass an empty string. Given your library, this would not work or be viable given that the expected value is a Surcharge object.
This is a significant issue.
Actual behavior
You cannot toggle off surcharging after setting it in terminal settings for a store.
Expected behavior
You should be able to set and toggle off surcharging; it shouldn't be a one and done user action.
Code snippet or screenshots (if applicable)
Relevant code block (notice how our expectation as a consumer of this library is that we should be able to toggle on/off surcharging interchangeably):
TerminalSettings terminalSettings = new TerminalSettings();
FeeStructure feeStructure = practiceBillingSettingDao.getOrCreatePracticeBillingSetting(requestContext)
.getFeeStructure();
if (FeeStructure.SURCHARGE.equals(feeStructure)) {
// Toggle on surcharging
List<ModelConfiguration> configurations = AdyenConstants.SUPPORTED_PAYMENT_METHODS.stream()
.map(paymentMethodSetupInfo -> new ModelConfiguration().brand(paymentMethodSetupInfo.getValue())
.currencies(List.of(new Currency().currencyCode("USD")
.percentage(paymentConfig.getPassTheFeePercentageSurcharge().doubleValue())))
.sources(List.of(AdyenConstants.ADYEN_CP_TERMINAL_SETTINGS_SURCHARGE_FUNDING_SOURCE)))
.toList();
Surcharge surcharge = new Surcharge();
surcharge.setConfigurations(configurations);
surcharge.setAskConfirmation(true);
terminalSettings.setSurcharge(surcharge);
} else {
// Toggle off surcharging
terminalSettings.setSurcharge(null);
}
adyenGateway.updateTerminalSettings(adyenStoreIdentity.getStoreId(), terminalSettings).join();
AdyenGateway#updateTerminalSettings:
public CompletableFuture<TerminalSettings> updateTerminalSettings(
@NotNull String storeId,
@NotNull TerminalSettings terminalSettings) {
TerminalSettingsStoreLevelApi terminalSettingsStoreLevelApi = new TerminalSettingsStoreLevelApi(
this.adyenMerchantClient);
return CompletableFuture.supplyAsync(() -> {
try {
return terminalSettingsStoreLevelApi.updateTerminalSettingsByStoreId(storeId, terminalSettings);
} catch (Exception e) {
printError(e);
CompletableFuture<TerminalSettings> failedFuture = new CompletableFuture<>();
failedFuture.completeExceptionally(e);
return failedFuture.join(); // this will throw the exception in the calling thread
}
});
}Adyen Java API Library version
38.0.0.0
Java version
17.0.12
Operating System
macOS
Additional context
This is not an OS-specific issue.