Skip to content

Commit 68e8311

Browse files
Merge pull request #68 from AltaPay/COREP-5065-adjust-checkout-to-be-backward-compatible-with-previous-version-of-gateway
Corep 5065 adjust checkout to be backward compatible with previous version of gateway
2 parents 5ea5b96 + 5c3502f commit 68e8311

5 files changed

Lines changed: 55 additions & 17 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [3.1.5]
5+
- Restore backward compatibility to the gateway version for cardWallet/session and cardWallet/authorize API methods
6+
47
## [3.1.4]
58
- Added new method to Merchant API `authenticate`
69

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
}
1010

1111
group = 'com.altapay'
12-
version = '3.1.4'
12+
version = '3.1.5'
1313

1414
repositories {
1515
mavenCentral()

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ For integrating Java projects with the AltaPay gateway.
4949
<dependency>
5050
<groupId>com.altapay</groupId>
5151
<artifactId>sdk-java</artifactId>
52-
<version>3.1.4</version>
52+
<version>3.1.5</version>
5353
</dependency>
5454
5555
### Gradle
5656
57-
implementation 'com.altapay:sdk-java:3.1.4'
57+
implementation 'com.altapay:sdk-java:3.1.5'
5858
5959
## Changelog
6060

src/main/java/com/pensio/api/PensioMerchantAPI.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,12 @@ public APIResponse cardWalletSession(CardWalletSessionRequest request) throws Pe
675675
{
676676
addParam(params, "applePayRequestData[validationUrl]", request.getApplePayRequestData().getValidationUrl());
677677
addParam(params, "applePayRequestData[domain]", request.getApplePayRequestData().getDomain());
678+
679+
// backward compatibility with legacy flow
680+
addParam(params, "validationUrl", request.getApplePayRequestData().getValidationUrl());
681+
addParam(params, "domain", request.getApplePayRequestData().getDomain());
678682
}
683+
679684
setPaymentRequestParameters(request, params);
680685

681686
return getAPIResponse("cardWallet/session", HttpMethod.POST, params);
@@ -687,11 +692,11 @@ public APIResponse cardWalletAuthorize(CardWalletAuthorizeRequest request) throw
687692
addParam(params, "provider_data", request.getProviderData());
688693
addParam(params, "payment_id", request.getPaymentId());
689694

690-
if (!request.getPaymentInfos().getAll().isEmpty()) {
691-
for (PaymentInfo paymentInfo : request.getPaymentInfos().getAll()) {
692-
addParam(params, "transaction_info[" + paymentInfo.getKey() + "]", paymentInfo.getValue());
693-
}
694-
}
695+
addParam(params, "sale_reconciliation_identifier", request.getSaleReconciliationIdentifier());
696+
addParam(params, "sale_invoice_number", request.getSaleInvoiceNumber());
697+
addParam(params, "sales_tax", request.getSalesTax());
698+
699+
setPaymentRequestParameters(request, params);
695700

696701
return getAPIResponse("cardWallet/authorize", HttpMethod.POST, params);
697702
}

src/main/java/com/pensio/api/request/CardWalletAuthorizeRequest.java

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
package com.pensio.api.request;
22

3-
public class CardWalletAuthorizeRequest {
3+
import com.pensio.Amount;
4+
5+
public class CardWalletAuthorizeRequest extends PaymentRequest<CardWalletAuthorizeRequest> {
46

5-
private String paymentId;
67
private String providerData;
7-
private final PaymentInfos paymentInfos = new PaymentInfos();
8+
private String paymentId;
89

9-
public PaymentInfos getPaymentInfos() {
10-
return paymentInfos;
11-
}
10+
// Optional parameters -- deprecated as others payment request attributes (reusing existing payment by payment_id)
11+
private String saleReconciliationIdentifier;
12+
private String saleInvoiceNumber;
13+
private String salesTax;
1214

13-
public CardWalletAuthorizeRequest addPaymentInfo(String key, String value) {
14-
paymentInfos.add(key, value);
15-
return this;
15+
public CardWalletAuthorizeRequest(String providerData, String paymentId, String terminal, String shopOrderId, Amount amount) {
16+
super(shopOrderId, terminal, amount);
17+
this.providerData = providerData;
18+
this.paymentId = paymentId;
1619
}
1720

1821
public String getProviderData() {
@@ -33,4 +36,31 @@ public CardWalletAuthorizeRequest setPaymentId(String paymentId) {
3336
return this;
3437
}
3538

39+
public String getSaleReconciliationIdentifier() {
40+
return saleReconciliationIdentifier;
41+
}
42+
43+
public CardWalletAuthorizeRequest setSaleReconciliationIdentifier(String saleReconciliationIdentifier) {
44+
this.saleReconciliationIdentifier = saleReconciliationIdentifier;
45+
return this;
46+
}
47+
48+
public String getSaleInvoiceNumber() {
49+
return saleInvoiceNumber;
50+
}
51+
52+
public CardWalletAuthorizeRequest setSaleInvoiceNumber(String saleInvoiceNumber) {
53+
this.saleInvoiceNumber = saleInvoiceNumber;
54+
return this;
55+
}
56+
57+
public String getSalesTax() {
58+
return salesTax;
59+
}
60+
61+
public CardWalletAuthorizeRequest setSalesTax(String salesTax) {
62+
this.salesTax = salesTax;
63+
return this;
64+
}
65+
3666
}

0 commit comments

Comments
 (0)