Skip to content

Commit

Permalink
[AD-234] Fix for payment methods that don't work
Browse files Browse the repository at this point in the history
  • Loading branch information
kpieloch committed May 6, 2024
1 parent dd869b6 commit 491fc44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ var AdyenCheckoutHybris = (function () {
self.submitDetails(state.data, self.handleResult);
},
onError: function (error, component) {
console.log('Something went wrong trying to make the Gift Card payment: ' + error);
console.log('Something went wrong trying to make a payment: ' + error);
self.handleResult(ErrorMessages.PaymentError, true);
}
});
Expand All @@ -1070,7 +1070,7 @@ var AdyenCheckoutHybris = (function () {
adyenComponent.mount(paymentNode);
self.configureButton(adyenComponent, false, label);
} catch (e) {
console.log('Something went wrong trying to mount the Gift Card component: ' + e);
console.log('Something went wrong trying to mount component: ' + e);
}
},

Expand Down Expand Up @@ -1099,9 +1099,8 @@ var AdyenCheckoutHybris = (function () {
contentType: "application/json; charset=utf-8",
success: function (response) {
try {
if (response.resultCode && response.resultCode === 'Pending' && response.action) {
component.handleAction(response.action);
} else if (response.resultCode && (response.resultCode === 'RedirectShopper')) {
if (response.action && (response.resultCode && response.resultCode === 'Pending' ||
response.resultCode && (response.resultCode === 'RedirectShopper'))) {
component.handleAction(response.action);
} else if (response.resultCode && (response.resultCode === 'Authorised')) {
handleResult(response, false);
Expand Down
41 changes: 1 addition & 40 deletions adyenv6core/src/com/adyen/v6/factory/AdyenRequestFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@
import com.adyen.model.checkout.CheckoutPaymentMethod;
import com.adyen.model.checkout.CommonField;
import com.adyen.model.checkout.DeliveryAddress;
import com.adyen.model.checkout.DotpayDetails;
import com.adyen.model.checkout.ExternalPlatform;
import com.adyen.model.checkout.Installments;
import com.adyen.model.checkout.KlarnaDetails;
import com.adyen.model.checkout.LineItem;
import com.adyen.model.checkout.Name;
import com.adyen.model.checkout.PaymentDetails;
import com.adyen.model.checkout.PaymentRequest;
import com.adyen.model.checkout.StoredPaymentMethodDetails;
import com.adyen.model.nexo.AmountsReq;
import com.adyen.model.nexo.DocumentQualifierType;
import com.adyen.model.nexo.MessageCategoryType;
Expand Down Expand Up @@ -122,6 +118,7 @@ public PaymentRequest createPaymentsRequest(final String merchantAccount,
final CustomerModel customerModel,
final RecurringContractMode recurringContractMode,
final Boolean guestUserTokenizationEnabled) {

final String adyenPaymentMethod = cartData.getAdyenPaymentMethod();
final Boolean is3DS2allowed = is3DS2Allowed();
final PaymentRequest paymentsRequest = new PaymentRequest();
Expand Down Expand Up @@ -306,7 +303,6 @@ protected void updatePaymentRequestForCC(final PaymentRequest paymentsRequest, f
}

protected void updatePaymentRequestForDC(final PaymentRequest paymentsRequest, final CartData cartData, final RecurringContractMode recurringContractMode) {

final Recurring recurringContract = getRecurringContractType(recurringContractMode);
Recurring.ContractEnum contract = null;
if (recurringContract != null) {
Expand Down Expand Up @@ -348,41 +344,6 @@ protected void updatePaymentRequestForAlternateMethod(final PaymentRequest payme
|| adyenPaymentMethod.contains(RATEPAY)) {
setOpenInvoiceData(paymentsRequest, cartData);
}
if (paymentsRequest.getPaymentMethod() == null) {
try {
PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setType(PaymentDetails.TypeEnum.fromValue(adyenPaymentMethod));
CheckoutPaymentMethod checkoutPaymentMethod = new CheckoutPaymentMethod(paymentDetails);
paymentsRequest.setPaymentMethod(checkoutPaymentMethod);
return;
} catch (IllegalArgumentException e) {
}
try {
StoredPaymentMethodDetails paymentDetails = new StoredPaymentMethodDetails();
paymentDetails.setType(StoredPaymentMethodDetails.TypeEnum.fromValue(adyenPaymentMethod));
CheckoutPaymentMethod checkoutPaymentMethod = new CheckoutPaymentMethod(paymentDetails);
paymentsRequest.setPaymentMethod(checkoutPaymentMethod);
return;
} catch (IllegalArgumentException e) {
}
try {
KlarnaDetails paymentDetails = new KlarnaDetails();
paymentDetails.setType(KlarnaDetails.TypeEnum.fromValue(adyenPaymentMethod));
CheckoutPaymentMethod checkoutPaymentMethod = new CheckoutPaymentMethod(paymentDetails);
paymentsRequest.setPaymentMethod(checkoutPaymentMethod);
return;
} catch (IllegalArgumentException e) {
}
try {
DotpayDetails paymentDetails = new DotpayDetails();
paymentDetails.setType(DotpayDetails.TypeEnum.fromValue(adyenPaymentMethod));
CheckoutPaymentMethod checkoutPaymentMethod = new CheckoutPaymentMethod(paymentDetails);
paymentsRequest.setPaymentMethod(checkoutPaymentMethod);
return;
} catch (IllegalArgumentException e) {
}
LOG.error("Payment method not recognized: " + adyenPaymentMethod);
}
}

protected String getCountryCode(final CartData cartData) {
Expand Down

0 comments on commit 491fc44

Please sign in to comment.