Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public class DefaultPaymentMethodDetails implements PaymentMethodDetails {
private Boolean storeDetails;
@SerializedName("idealIssuer")
private String idealIssuer;
@SerializedName("sepa.ownerName")
private String sepaOwnerName;
@SerializedName("sepa.ibanNumber")
private String sepaIbanNumber;

@Override
public String getType() {
Expand Down Expand Up @@ -284,6 +288,22 @@ public DefaultPaymentMethodDetails idealIssuer(String idealIssuer) {
return this;
}

public String getSepaOwnerName() {
return sepaOwnerName;
}

public void setSepaOwnerName(String sepaOwnerName) {
this.sepaOwnerName = sepaOwnerName;
}

public String getSepaIbanNumber() {
return sepaIbanNumber;
}

public void setSepaIbanNumber(String sepaIbanNumber) {
this.sepaIbanNumber = sepaIbanNumber;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down Expand Up @@ -311,7 +331,9 @@ public boolean equals(Object o) {
&& Objects.equals(encryptedSecurityCode, that.encryptedSecurityCode)
&& Objects.equals(recurringDetailReference, that.recurringDetailReference)
&& Objects.equals(storeDetails, that.storeDetails)
&& Objects.equals(idealIssuer, that.idealIssuer);
&& Objects.equals(idealIssuer, that.idealIssuer)
&& Objects.equals(sepaIbanNumber, that.sepaIbanNumber)
&& Objects.equals(sepaOwnerName, that.sepaOwnerName);
}

@Override
Expand Down
30 changes: 30 additions & 0 deletions src/test/java/com/adyen/CheckoutTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.TimeZone;
import org.junit.Test;
import com.adyen.model.Amount;
import com.adyen.model.checkout.DefaultPaymentMethodDetails;
import com.adyen.model.checkout.PaymentMethodDetails;
import com.adyen.model.checkout.PaymentMethodsRequest;
import com.adyen.model.checkout.PaymentMethodsResponse;
Expand Down Expand Up @@ -253,6 +254,35 @@ public void TestPaymentMethodDetails() {
+ "}", jsonRequest);
}

@Test
public void TestSepaPaymentMethodDetails() {
DefaultPaymentMethodDetails defaultPaymentMethodDetails = new DefaultPaymentMethodDetails();
defaultPaymentMethodDetails.type("sepadirectdebit");
defaultPaymentMethodDetails.setSepaOwnerName("A. Schneider");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type constant is not needed.

defaultPaymentMethodDetails.setSepaIbanNumber("DE87123456781234567890");

PaymentsRequest paymentsRequest = createPaymentsCheckoutRequest();
paymentsRequest.setApplicationInfo(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is redundant. please remove null assignment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to remove the application info because the version is always updating and the mock request is not.

paymentsRequest.setPaymentMethod(defaultPaymentMethodDetails);

String jsonRequest = PRETTY_PRINT_GSON.toJson(paymentsRequest);

assertEquals("{\n"
+ " \"amount\": {\n"
+ " \"value\": 1000,\n"
+ " \"currency\": \"USD\"\n"
+ " },\n"
+ " \"merchantAccount\": \"MagentoMerchantTest\",\n"
+ " \"paymentMethod\": {\n"
+ " \"type\": \"sepadirectdebit\",\n"
+ " \"sepa.ownerName\": \"A. Schneider\",\n"
+ " \"sepa.ibanNumber\": \"DE87123456781234567890\"\n"
+ " },\n"
+ " \"reference\": \"Your order number\",\n"
+ " \"returnUrl\": \"https://your-company.com/...\"\n"
+ "}",jsonRequest );
}

@Test
public void TestDateSerializers() throws ParseException {
PaymentsRequest paymentsRequest = new PaymentsRequest();
Expand Down