Skip to content
Closed
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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group=com.checkout
version=7.9.1
version=7.9.2

project_name=Checkout SDK Java
project_description=Checkout SDK for Java https://checkout.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,13 @@ public final class Processing {
@SerializedName("cko_network_token_available")
private Boolean ckoNetworkTokenAvailable;

/**
* The scheme transaction link identifier. Returned for Mastercard transactions when the scheme
* provides a link identifier that ties together related transactions on the network
* (see Mastercard Transaction Link Identifier documentation).
* [Optional]
*/
@SerializedName("scheme_transaction_link_id")
private String schemeTransactionLinkId;

}
8 changes: 8 additions & 0 deletions src/main/java/com/checkout/payments/PaymentProcessing.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,12 @@ public final class PaymentProcessing {
*/
private Aggregator aggregator;

/**
* The scheme transaction link identifier. Returned for Mastercard transactions when the scheme
* provides a link identifier that ties together related transactions on the network
* (see Mastercard Transaction Link Identifier documentation).
* [Optional]
*/
private String schemeTransactionLinkId;

}
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,13 @@ public final class ProcessingData {
@SerializedName("airline_data")
private List<AirlineData> airlineData;

/**
* The scheme transaction link identifier. Returned for Mastercard transactions when the scheme
* provides a link identifier that ties together related transactions on the network
* (see Mastercard Transaction Link Identifier documentation).
* [Optional]
*/
@SerializedName("scheme_transaction_link_id")
private String schemeTransactionLinkId;

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.checkout.handlepaymentsandpayouts.payments.common.source.klarnasource.KlarnaSource;
import com.checkout.handlepaymentsandpayouts.payments.common.source.paypalsource.PaypalSource;
import com.checkout.handlepaymentsandpayouts.payments.common.source.sepasource.SepaSource;
import com.checkout.handlepaymentsandpayouts.payments.postpayments.responses.requestapaymentorpayoutresponsecreated.processing.Processing;

public final class RequestAPaymentOrPayoutResponseCreatedSerializationTest {

Expand Down Expand Up @@ -149,4 +150,32 @@ void shouldDeserializeSepaSource() {
assertEquals("src_sepa_123", sepaSource.getId());
}

@Test
void shouldDeserializeProcessingSchemeTransactionLinkId() {
String json = "{\n" +
" \"id\": \"pay_123\",\n" +
" \"amount\": 1000,\n" +
" \"currency\": \"USD\",\n" +
" \"approved\": true,\n" +
" \"status\": \"Authorized\",\n" +
" \"processed_on\": \"2021-06-08T12:25:01Z\",\n" +
" \"processing\": {\n" +
" \"retrieval_reference_number\": \"RRN001\",\n" +
" \"acquirer_transaction_id\": \"ACQ001\",\n" +
" \"scheme\": \"Mastercard\",\n" +
" \"scheme_transaction_link_id\": \"MTL-XYZ-789\"\n" +
" }\n" +
"}";

RequestAPaymentOrPayoutResponseCreated response = serializer.fromJson(json, RequestAPaymentOrPayoutResponseCreated.class);

assertNotNull(response);
Processing processing = response.getProcessing();
assertNotNull(processing);
assertEquals("RRN001", processing.getRetrievalReferenceNumber());
assertEquals("ACQ001", processing.getAcquirerTransactionId());
assertEquals("Mastercard", processing.getScheme());
assertEquals("MTL-XYZ-789", processing.getSchemeTransactionLinkId());
}

}
6 changes: 6 additions & 0 deletions src/test/java/com/checkout/payments/GetPaymentsTestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,12 @@ private void validateNotFoundSync(Runnable operation) {
private void validateBasicGetPaymentResponse(GetPaymentResponse paymentReturned, PaymentStatus expectedStatus) {
assertNotNull(paymentReturned);
assertEquals(expectedStatus, paymentReturned.getStatus());
// Mastercard Transaction Link Identifier — optional, only populated for Mastercard
// transactions. Exercising the getter confirms the field is exposed by the SDK
// and deserializes without error even when absent from the response payload.
if (paymentReturned.getProcessing() != null) {
paymentReturned.getProcessing().getSchemeTransactionLinkId();
}
}

private void validatePaymentWithDigitalItem(GetPaymentResponse paymentReturned) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

class PaymentProcessingSerializationTest {

Expand Down Expand Up @@ -92,6 +93,26 @@ void shouldDeserializeReconciliationId() {
assertEquals("recon_001", processing.getReconciliationId());
}

@Test
void shouldDeserializeSchemeTransactionLinkId() {
final String json = "{\"scheme_transaction_link_id\":\"MTL-001\"}";

final PaymentProcessing processing = serializer.fromJson(json, PaymentProcessing.class);

assertNotNull(processing);
assertEquals("MTL-001", processing.getSchemeTransactionLinkId());
}

@Test
void shouldSerializeSchemeTransactionLinkIdToSnakeCase() {
final PaymentProcessing processing = new PaymentProcessing();
processing.setSchemeTransactionLinkId("MTL-001");

final String json = serializer.toJson(processing);

assertTrue(json.contains("\"scheme_transaction_link_id\":\"MTL-001\""));
}

@Test
void shouldDeserializePartnerFields() {
final String json = "{"
Expand Down Expand Up @@ -182,7 +203,8 @@ void shouldDeserializeFullSwaggerExample() {
+ "\"merchant_category_code\":\"5812\","
+ "\"aft\":false,"
+ "\"bizum_payment_id\":\"biz_001\","
+ "\"reconciliation_id\":\"rec_001\""
+ "\"reconciliation_id\":\"rec_001\","
+ "\"scheme_transaction_link_id\":\"MTL-XYZ-789\""
+ "}";

final PaymentProcessing processing = serializer.fromJson(json, PaymentProcessing.class);
Expand All @@ -199,6 +221,7 @@ void shouldDeserializeFullSwaggerExample() {
assertEquals(100L, processing.getForeignRetailerAmount());
assertEquals("biz_001", processing.getBizumPaymentId());
assertEquals("rec_001", processing.getReconciliationId());
assertEquals("MTL-XYZ-789", processing.getSchemeTransactionLinkId());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ void shouldDeserializePartnerResponseCode() {
assertEquals("ER_WRONG_TICKET", data.getPartnerResponseCode());
}

@Test
void shouldDeserializeSchemeTransactionLinkId() {
final String json = "{\"scheme_transaction_link_id\":\"MTL-001\"}";

final ProcessingData data = serializer.fromJson(json, ProcessingData.class);

assertNotNull(data);
assertEquals("MTL-001", data.getSchemeTransactionLinkId());
}

@Test
void shouldDeserializeAllNewFieldsTogether() {
final String json = "{"
Expand All @@ -121,7 +131,8 @@ void shouldDeserializeAllNewFieldsTogether() {
+ "\"fallback_source_used\":false,"
+ "\"failure_code\":\"partner_error\","
+ "\"partner_code\":\"902111\","
+ "\"partner_response_code\":\"DECLINED\""
+ "\"partner_response_code\":\"DECLINED\","
+ "\"scheme_transaction_link_id\":\"MTL-XYZ-789\""
+ "}";

final ProcessingData data = serializer.fromJson(json, ProcessingData.class);
Expand All @@ -134,6 +145,7 @@ void shouldDeserializeAllNewFieldsTogether() {
assertEquals("partner_error", data.getFailureCode());
assertEquals("902111", data.getPartnerCode());
assertEquals("DECLINED", data.getPartnerResponseCode());
assertEquals("MTL-XYZ-789", data.getSchemeTransactionLinkId());
}

@Test
Expand All @@ -153,5 +165,6 @@ void shouldLeaveNewFieldsNullWhenAbsent() {
assertNull(data.getFailureCode());
assertNull(data.getPartnerCode());
assertNull(data.getPartnerResponseCode());
assertNull(data.getSchemeTransactionLinkId());
}
}
Loading