New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds applepay and googlepay support #102
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,6 +107,30 @@ public class TestAdyenPaymentPluginApi extends TestAdyenPaymentPluginApiBase { | |
.put(AdyenPaymentPluginApi.PROPERTY_TERM_URL, "dummy://url") | ||
.put(AdyenPaymentPluginApi.PROPERTY_THREE_D_THRESHOLD, "25000") | ||
.build()); | ||
private final Iterable<PluginProperty> propertiesWithGooglePay = PluginProperties.buildPluginProperties(ImmutableMap.<String, String>builder() | ||
.put(AdyenPaymentPluginApi.PROPERTY_CC_LAST_NAME, "Googlepaytester") | ||
.put(AdyenPaymentPluginApi.PROPERTY_SELECTED_BRAND, "paywithgoogle") | ||
.put(AdyenPaymentPluginApi.PROPERTY_MPI_DATA_CAVV, "AAAAAAAAt5fMJPDr320qAAALwwA=hq0BA9EAAAGXIJcAGAAAABKU0+s=") | ||
.put(AdyenPaymentPluginApi.PROPERTY_MPI_DATA_ECI, "7") | ||
.put(AdyenPaymentPluginApi.PROPERTY_CC_NUMBER, CC_3DS_NUMBER) | ||
.put(AdyenPaymentPluginApi.PROPERTY_CC_EXPIRATION_MONTH, "10") | ||
.put(AdyenPaymentPluginApi.PROPERTY_CC_EXPIRATION_YEAR, "2020") | ||
.put(AdyenPaymentPluginApi.PROPERTY_USER_AGENT, "Java/1.8") | ||
.put(AdyenPaymentPluginApi.PROPERTY_ACCEPT_HEADER, "application/json") | ||
.put(AdyenPaymentPluginApi.PROPERTY_TERM_URL, "dummy://url") | ||
.build()); | ||
private final Iterable<PluginProperty> propertiesWithApplePay = PluginProperties.buildPluginProperties(ImmutableMap.<String, String>builder() | ||
.put(AdyenPaymentPluginApi.PROPERTY_CC_LAST_NAME, "Applepaytester") | ||
.put(AdyenPaymentPluginApi.PROPERTY_SELECTED_BRAND, "applepay") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a test with brand and without |
||
.put(AdyenPaymentPluginApi.PROPERTY_MPI_DATA_CAVV, "AAAAAAAAt5fMJPDr320qAAALwwA=hq0BA9EAAAGXIJcAGAAAABKU0+s=") | ||
.put(AdyenPaymentPluginApi.PROPERTY_MPI_DATA_ECI, "7") | ||
.put(AdyenPaymentPluginApi.PROPERTY_CC_NUMBER, CC_3DS_NUMBER) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you also passing a full PAN? Are you sure Adyen treats the request as an ApplePay one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, treats as applepay. |
||
.put(AdyenPaymentPluginApi.PROPERTY_CC_EXPIRATION_MONTH, String.valueOf(CC_EXPIRATION_MONTH)) | ||
.put(AdyenPaymentPluginApi.PROPERTY_CC_EXPIRATION_YEAR, String.valueOf(CC_EXPIRATION_YEAR)) | ||
.put(AdyenPaymentPluginApi.PROPERTY_USER_AGENT, "Java/1.8") | ||
.put(AdyenPaymentPluginApi.PROPERTY_ACCEPT_HEADER, "application/json") | ||
.put(AdyenPaymentPluginApi.PROPERTY_TERM_URL, "dummy://url") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably not needed. |
||
.build()); | ||
private final Iterable<PluginProperty> propertiesWithAVSInfo = PluginProperties.buildPluginProperties(ImmutableMap.<String, String>builder() | ||
.put(AdyenPaymentPluginApi.PROPERTY_CC_TYPE, CC_TYPE) | ||
.put(AdyenPaymentPluginApi.PROPERTY_CC_LAST_NAME, "Avschecker") | ||
|
@@ -425,6 +449,46 @@ public void testAuthorizeAndCheckAVSResult() throws Exception { | |
assertEquals(avsResult, "7 Both postal code and address match"); | ||
} | ||
|
||
@Test(groups = "integration") | ||
public void testAuthorizeWithGooglePay() throws Exception { | ||
adyenPaymentPluginApi.addPaymentMethod(account.getId(), account.getPaymentMethodId(), adyenEmptyPaymentMethodPlugin(), true, propertiesWithGooglePay, context); | ||
final Payment payment = TestUtils.buildPayment(account.getId(), account.getPaymentMethodId(), account.getCurrency(), killbillApi); | ||
|
||
final PaymentTransaction authorizationTransaction = TestUtils.buildPaymentTransaction(payment, TransactionType.AUTHORIZE, new BigDecimal("25"), account.getCurrency()); | ||
|
||
final PaymentTransactionInfoPlugin authorizationInfoPlugin = adyenPaymentPluginApi.authorizePayment(account.getId(), | ||
payment.getId(), | ||
authorizationTransaction.getId(), | ||
account.getPaymentMethodId(), | ||
authorizationTransaction.getAmount(), | ||
authorizationTransaction.getCurrency(), | ||
propertiesWithGooglePay, | ||
context); | ||
|
||
assertNull(authorizationInfoPlugin.getGatewayErrorCode()); | ||
assertEquals(authorizationInfoPlugin.getStatus(), PaymentPluginStatus.PROCESSED); | ||
} | ||
|
||
@Test(groups = "integration") | ||
public void testAuthorizeWithApplePay() throws Exception { | ||
adyenPaymentPluginApi.addPaymentMethod(account.getId(), account.getPaymentMethodId(), adyenEmptyPaymentMethodPlugin(), true, propertiesWithApplePay, context); | ||
final Payment payment = TestUtils.buildPayment(account.getId(), account.getPaymentMethodId(), account.getCurrency(), killbillApi); | ||
|
||
final PaymentTransaction authorizationTransaction = TestUtils.buildPaymentTransaction(payment, TransactionType.AUTHORIZE, new BigDecimal("260"), account.getCurrency()); | ||
|
||
final PaymentTransactionInfoPlugin authorizationInfoPlugin = adyenPaymentPluginApi.authorizePayment(account.getId(), | ||
payment.getId(), | ||
authorizationTransaction.getId(), | ||
account.getPaymentMethodId(), | ||
authorizationTransaction.getAmount(), | ||
authorizationTransaction.getCurrency(), | ||
propertiesWithApplePay, | ||
context); | ||
|
||
assertNull(authorizationInfoPlugin.getGatewayErrorCode()); | ||
assertEquals(authorizationInfoPlugin.getStatus(), PaymentPluginStatus.PROCESSED); | ||
} | ||
|
||
@Test(groups = "integration") | ||
public void testAuthorizeAndCheckBadAVSResult() throws Exception { | ||
adyenPaymentPluginApi.addPaymentMethod(account.getId(), account.getPaymentMethodId(), adyenEmptyPaymentMethodPlugin(), true, propertiesWithAVSInfo, context); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it expected the brand overrides this value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Adyen asked to send these values.