From 5f77a8979c9609a364a2b2af2655c43fe217727c Mon Sep 17 00:00:00 2001 From: rhames07 Date: Wed, 6 Jul 2022 11:41:52 -0300 Subject: [PATCH 1/2] Add linkedTo parameter to request --- .../client/payment/PaymentCreateRequest.java | 3 +++ .../payment/PaymentPointOfInteractionRequest.java | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/main/java/com/mercadopago/client/payment/PaymentPointOfInteractionRequest.java diff --git a/src/main/java/com/mercadopago/client/payment/PaymentCreateRequest.java b/src/main/java/com/mercadopago/client/payment/PaymentCreateRequest.java index 234ad454..ee4fb325 100644 --- a/src/main/java/com/mercadopago/client/payment/PaymentCreateRequest.java +++ b/src/main/java/com/mercadopago/client/payment/PaymentCreateRequest.java @@ -97,6 +97,9 @@ public class PaymentCreateRequest { /** Transaction details. */ private final PaymentTransactionDetailsRequest transactionDetails; + /** Point of interaction. */ + private final PaymentPointOfInteractionRequest pointOfInteraction; + /** Sponsor Identification. */ private final Long sponsorId; diff --git a/src/main/java/com/mercadopago/client/payment/PaymentPointOfInteractionRequest.java b/src/main/java/com/mercadopago/client/payment/PaymentPointOfInteractionRequest.java new file mode 100644 index 00000000..454c3869 --- /dev/null +++ b/src/main/java/com/mercadopago/client/payment/PaymentPointOfInteractionRequest.java @@ -0,0 +1,12 @@ +package com.mercadopago.client.payment; + +import lombok.Builder; +import lombok.Getter; + +/** PaymentPointOfInteractionRequest class. */ +@Getter +@Builder +public class PaymentPointOfInteractionRequest { + /** Linked to information. */ + private final String linkedTo; +} From 17e7433b709387b0d53e2909d5d9c838fd2228ef Mon Sep 17 00:00:00 2001 From: rhames07 Date: Wed, 6 Jul 2022 12:38:02 -0300 Subject: [PATCH 2/2] Update tests --- .../com/mercadopago/client/payment/PaymentClientTest.java | 4 ++++ .../resources/mocks/request/payment/payment_pix.json | 3 +++ .../resources/mocks/response/payment/payment_pix.json | 1 + 3 files changed, 8 insertions(+) diff --git a/src/test/java/com/mercadopago/client/payment/PaymentClientTest.java b/src/test/java/com/mercadopago/client/payment/PaymentClientTest.java index 318fca22..5793da15 100644 --- a/src/test/java/com/mercadopago/client/payment/PaymentClientTest.java +++ b/src/test/java/com/mercadopago/client/payment/PaymentClientTest.java @@ -116,6 +116,7 @@ public void createPixSuccess() throws MPException, IOException, MPApiException { assertEquals( "https://www.mercadopago.com.br/payments/21071815560/ticket?caller_id=471763966&hash=abcd1234efgh5678", payment.getPointOfInteraction().getTransactionData().getTicketUrl()); + assertEquals("openfinance", payment.getPointOfInteraction().getLinkedTo()); assertNotNull(payment.getPointOfInteraction().getTransactionData().getQrCode()); assertNotNull(payment.getPointOfInteraction().getTransactionData().getQrCodeBase64()); } @@ -136,6 +137,7 @@ public void createPixWithRequestOptionsSuccess() throws MPException, IOException assertEquals( "https://www.mercadopago.com.br/payments/21071815560/ticket?caller_id=471763966&hash=abcd1234efgh5678", payment.getPointOfInteraction().getTransactionData().getTicketUrl()); + assertEquals("openfinance", payment.getPointOfInteraction().getLinkedTo()); assertNotNull(payment.getPointOfInteraction().getTransactionData().getQrCode()); assertNotNull(payment.getPointOfInteraction().getTransactionData().getQrCodeBase64()); } @@ -655,6 +657,8 @@ private PaymentCreateRequest newPixPayment() { .paymentMethodId("pix") .description("description") .payer(PaymentPayerRequest.builder().email("test_user_1648059260@testuser.com").build()) + .pointOfInteraction( + PaymentPointOfInteractionRequest.builder().linkedTo("openfinance").build()) .build(); } } diff --git a/src/test/java/com/mercadopago/resources/mocks/request/payment/payment_pix.json b/src/test/java/com/mercadopago/resources/mocks/request/payment/payment_pix.json index d5ee0ad2..6d3fd3f6 100644 --- a/src/test/java/com/mercadopago/resources/mocks/request/payment/payment_pix.json +++ b/src/test/java/com/mercadopago/resources/mocks/request/payment/payment_pix.json @@ -5,5 +5,8 @@ "email": "test_user_1648059260@testuser.com" }, "payment_method_id": "pix", + "point_of_interaction": { + "linked_to": "openfinance" + }, "transaction_amount": 100 } \ No newline at end of file diff --git a/src/test/java/com/mercadopago/resources/mocks/response/payment/payment_pix.json b/src/test/java/com/mercadopago/resources/mocks/response/payment/payment_pix.json index d10ac003..36fec188 100644 --- a/src/test/java/com/mercadopago/resources/mocks/response/payment/payment_pix.json +++ b/src/test/java/com/mercadopago/resources/mocks/response/payment/payment_pix.json @@ -89,6 +89,7 @@ "acquirer_reconciliation": [], "point_of_interaction": { "type": "OPENPLATFORM", + "linked_to": "openfinance", "business_info": { "unit": "online_payments", "sub_unit": "default"