Skip to content
Open
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.

## [3.1.17]
- Added optional `Type` element (`CardType`: `CREDIT`, `DEBIT`, `CHARGE_CARD`) to `CardInformation` in API responses, exposing the card type derived from the BIN interchange group.

## [3.1.16]
- Added identifier attribute on `MethodConfig` in `/getTerminals`. Fix content of `MethodConfig` to support different configuration (unbounded), based on the gateway response.

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = 'com.altapay'
version = '3.1.16'
version = '3.1.17'

repositories {
mavenCentral()
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ For integrating Java projects with the AltaPay gateway.
<dependency>
<groupId>com.altapay</groupId>
<artifactId>sdk-java</artifactId>
<version>3.1.16</version>
<version>3.1.17</version>
</dependency>

### Gradle

implementation 'com.altapay:sdk-java:3.1.16'
implementation 'com.altapay:sdk-java:3.1.17'

## Changelog

Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/xsd/APIResponse.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,14 @@
</xs:all>
</xs:complexType>

<xs:simpleType name="CardType">
<xs:restriction base="xs:string">
<xs:enumeration value="CREDIT"/>
<xs:enumeration value="DEBIT"/>
<xs:enumeration value="CHARGE_CARD"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="CardInformation">
<xs:all>
<xs:element name="IsTokenized" type="xs:boolean"/>
Expand Down Expand Up @@ -833,6 +841,7 @@
</xs:simpleType>
</xs:element>
<xs:element name="Scheme" type="xs:string"/>
<xs:element name="Type" type="CardType" maxOccurs="1" minOccurs="0"/>
</xs:all>
</xs:complexType>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,32 @@ void ParsePostBackXmlResponse_ReadECommerceWithout3dSecurePaymentSource() throws
APIResponse response = api.parsePostBackXMLParameter(xmlResponse);
Assertions.assertEquals("eCommerce_without3ds", response.getBody().getTransactions().getTransaction().get(0).getPaymentSource());
}

@Test
void parseCardInformationType_credit() throws PensioAPIException, IOException, URISyntaxException {
String xmlResponse = readFile("com/pensio/api/txt/CardTypeCredit.xml");
APIResponse response = api.parsePostBackXMLParameter(xmlResponse);

com.pensio.api.generated.CardType type = response.getBody()
.getTransactions()
.getTransaction()
.get(0)
.getCardInformation()
.getType();
Assertions.assertEquals(com.pensio.api.generated.CardType.CREDIT, type);
}

@Test
void parseCardInformationType_absentReturnsNull() throws PensioAPIException, IOException, URISyntaxException {
String xmlResponse = readFile("com/pensio/api/txt/CardInformationNoType.xml");
APIResponse response = api.parsePostBackXMLParameter(xmlResponse);

com.pensio.api.generated.CardType type = response.getBody()
.getTransactions()
.getTransaction()
.get(0)
.getCardInformation()
.getType();
Assertions.assertNull(type);
}
}
113 changes: 113 additions & 0 deletions src/test/resources/com/pensio/api/txt/CardInformationNoType.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0"?>
<APIResponse version="20170228">
<Header>
<Date>2017-07-05T11:50:45+02:00</Date>
<Path>API/reservationOfFixedAmount3DSecureVerification</Path>
<ErrorCode>0</ErrorCode>
<ErrorMessage/>
</Header>
<Body>
<Result>Failed</Result>
<MerchantErrorMessage>TestAcquirer[pan=0466 or amount=4660]</MerchantErrorMessage>
<CardHolderErrorMessage>Card Declined</CardHolderErrorMessage>
<CardHolderMessageMustBeShown>true</CardHolderMessageMustBeShown>
<Transactions>
<Transaction>
<TransactionId>20341981</TransactionId>
<PaymentId>17794956-9bb6-4854-9712-bce5931e6e3a</PaymentId>
<AuthType>paymentAndCapture</AuthType>
<CardStatus>Expired</CardStatus>
<CreditCardExpiry>
<Year>2017</Year>
<Month>01</Month>
</CreditCardExpiry>
<CreditCardToken>2685df5ccacc32330848ba7626d329a166585996</CreditCardToken>
<CreditCardMaskedPan>414000******0466</CreditCardMaskedPan>
<IsTokenized>false</IsTokenized>
<CardInformation>
<IsTokenized>false</IsTokenized>
<Token>2685df5ccacc32330848ba7626d329a166585996</Token>
<MaskedPan>414000******0466</MaskedPan>
<Expiry>
<Year>2017</Year>
<Month>1</Month>
</Expiry>
<IssuingCountry>GB</IssuingCountry>
<LastFourDigits>0466</LastFourDigits>
<Scheme>Visa</Scheme>
</CardInformation>
<ThreeDSecureResult>Not_Attempted</ThreeDSecureResult>
<LiableForChargeback>Merchant</LiableForChargeback>
<CVVCheckResult>Not_Attempted</CVVCheckResult>
<BlacklistToken>61c62b85fb8ed03518c524891a92cd515cb64c32</BlacklistToken>
<ShopOrderId>1bf7ddd2-d335-42c6-b5ab-0a6f4faff22d</ShopOrderId>
<Shop>Caxton FX</Shop>
<Terminal>Caxton FX Test Terminal</Terminal>
<TransactionStatus>3dsecure_failed</TransactionStatus>
<ReasonCode>NONE</ReasonCode>
<MerchantCurrency>826</MerchantCurrency>
<MerchantCurrencyAlpha>GBP</MerchantCurrencyAlpha>
<CardHolderCurrency>826</CardHolderCurrency>
<CardHolderCurrencyAlpha>GBP</CardHolderCurrencyAlpha>
<ReservedAmount>0.00</ReservedAmount>
<CapturedAmount>0.00</CapturedAmount>
<RefundedAmount>0.00</RefundedAmount>
<CreditedAmount>0.00</CreditedAmount>
<RecurringDefaultAmount>0.00</RecurringDefaultAmount>
<SurchargeAmount>0.00</SurchargeAmount>
<CreatedDate>2017-07-05 11:50:41</CreatedDate>
<UpdatedDate>2017-07-05 11:50:45</UpdatedDate>
<PaymentNature>CreditCard</PaymentNature>
<PaymentSchemeName>Visa</PaymentSchemeName>
<PaymentNatureService name="SoapTestAcquirer">
<SupportsRefunds>true</SupportsRefunds>
<SupportsRelease>true</SupportsRelease>
<SupportsMultipleCaptures>true</SupportsMultipleCaptures>
<SupportsMultipleRefunds>true</SupportsMultipleRefunds>
</PaymentNatureService>
<AddressVerification>P</AddressVerification>
<AddressVerificationDescription>Postal codes match for international transaction. Street address not verified due to incompatible formats</AddressVerificationDescription>
<ChargebackEvents/>
<PaymentInfos/>
<CustomerInfo>
<UserAgent>Mozilla/5.0</UserAgent>
<IpAddress>31.221.7.34</IpAddress>
<Email>
<![CDATA[john.doe@example.com]]>
</Email>
<Username>
<![CDATA[John Doe]]>
</Username>
<CustomerPhone/>
<OrganisationNumber/>
<CountryOfOrigin>
<Country>GB</Country>
<Source>BillingAddress</Source>
</CountryOfOrigin>
<BillingAddress>
<Firstname>
<![CDATA[John]]>
</Firstname>
<Lastname>
<![CDATA[Doe]]>
</Lastname>
<Address>
<![CDATA[Portland House Bressenden Place]]>
</Address>
<City>
<![CDATA[London]]>
</City>
<Region/>
<Country>
<![CDATA[GB]]>
</Country>
<PostalCode>
<![CDATA[SW1E 5BH]]>
</PostalCode>
</BillingAddress>
</CustomerInfo>
<ReconciliationIdentifiers/>
</Transaction>
</Transactions>
</Body>
</APIResponse>
114 changes: 114 additions & 0 deletions src/test/resources/com/pensio/api/txt/CardTypeCredit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?xml version="1.0"?>
<APIResponse version="20170228">
<Header>
<Date>2017-07-05T11:50:45+02:00</Date>
<Path>API/reservationOfFixedAmount3DSecureVerification</Path>
<ErrorCode>0</ErrorCode>
<ErrorMessage/>
</Header>
<Body>
<Result>Failed</Result>
<MerchantErrorMessage>TestAcquirer[pan=0466 or amount=4660]</MerchantErrorMessage>
<CardHolderErrorMessage>Card Declined</CardHolderErrorMessage>
<CardHolderMessageMustBeShown>true</CardHolderMessageMustBeShown>
<Transactions>
<Transaction>
<TransactionId>20341981</TransactionId>
<PaymentId>17794956-9bb6-4854-9712-bce5931e6e3a</PaymentId>
<AuthType>paymentAndCapture</AuthType>
<CardStatus>Expired</CardStatus>
<CreditCardExpiry>
<Year>2017</Year>
<Month>01</Month>
</CreditCardExpiry>
<CreditCardToken>2685df5ccacc32330848ba7626d329a166585996</CreditCardToken>
<CreditCardMaskedPan>414000******0466</CreditCardMaskedPan>
<IsTokenized>false</IsTokenized>
<CardInformation>
<IsTokenized>false</IsTokenized>
<Token>2685df5ccacc32330848ba7626d329a166585996</Token>
<MaskedPan>414000******0466</MaskedPan>
<Expiry>
<Year>2017</Year>
<Month>1</Month>
</Expiry>
<IssuingCountry>GB</IssuingCountry>
<LastFourDigits>0466</LastFourDigits>
<Scheme>Visa</Scheme>
<Type>CREDIT</Type>
</CardInformation>
<ThreeDSecureResult>Not_Attempted</ThreeDSecureResult>
<LiableForChargeback>Merchant</LiableForChargeback>
<CVVCheckResult>Not_Attempted</CVVCheckResult>
<BlacklistToken>61c62b85fb8ed03518c524891a92cd515cb64c32</BlacklistToken>
<ShopOrderId>1bf7ddd2-d335-42c6-b5ab-0a6f4faff22d</ShopOrderId>
<Shop>Caxton FX</Shop>
<Terminal>Caxton FX Test Terminal</Terminal>
<TransactionStatus>3dsecure_failed</TransactionStatus>
<ReasonCode>NONE</ReasonCode>
<MerchantCurrency>826</MerchantCurrency>
<MerchantCurrencyAlpha>GBP</MerchantCurrencyAlpha>
<CardHolderCurrency>826</CardHolderCurrency>
<CardHolderCurrencyAlpha>GBP</CardHolderCurrencyAlpha>
<ReservedAmount>0.00</ReservedAmount>
<CapturedAmount>0.00</CapturedAmount>
<RefundedAmount>0.00</RefundedAmount>
<CreditedAmount>0.00</CreditedAmount>
<RecurringDefaultAmount>0.00</RecurringDefaultAmount>
<SurchargeAmount>0.00</SurchargeAmount>
<CreatedDate>2017-07-05 11:50:41</CreatedDate>
<UpdatedDate>2017-07-05 11:50:45</UpdatedDate>
<PaymentNature>CreditCard</PaymentNature>
<PaymentSchemeName>Visa</PaymentSchemeName>
<PaymentNatureService name="SoapTestAcquirer">
<SupportsRefunds>true</SupportsRefunds>
<SupportsRelease>true</SupportsRelease>
<SupportsMultipleCaptures>true</SupportsMultipleCaptures>
<SupportsMultipleRefunds>true</SupportsMultipleRefunds>
</PaymentNatureService>
<AddressVerification>P</AddressVerification>
<AddressVerificationDescription>Postal codes match for international transaction. Street address not verified due to incompatible formats</AddressVerificationDescription>
<ChargebackEvents/>
<PaymentInfos/>
<CustomerInfo>
<UserAgent>Mozilla/5.0</UserAgent>
<IpAddress>31.221.7.34</IpAddress>
<Email>
<![CDATA[john.doe@example.com]]>
</Email>
<Username>
<![CDATA[John Doe]]>
</Username>
<CustomerPhone/>
<OrganisationNumber/>
<CountryOfOrigin>
<Country>GB</Country>
<Source>BillingAddress</Source>
</CountryOfOrigin>
<BillingAddress>
<Firstname>
<![CDATA[John]]>
</Firstname>
<Lastname>
<![CDATA[Doe]]>
</Lastname>
<Address>
<![CDATA[Portland House Bressenden Place]]>
</Address>
<City>
<![CDATA[London]]>
</City>
<Region/>
<Country>
<![CDATA[GB]]>
</Country>
<PostalCode>
<![CDATA[SW1E 5BH]]>
</PostalCode>
</BillingAddress>
</CustomerInfo>
<ReconciliationIdentifiers/>
</Transaction>
</Transactions>
</Body>
</APIResponse>
Loading