-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #214 from mercadopago/develop-v1
Update SDK version from 1.11.2 to 1.11.3
- Loading branch information
Showing
7 changed files
with
284 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created | ||
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path | ||
|
||
name: Publish package to the Maven Central Repository and GitHub Packages | ||
|
||
on: | ||
release: | ||
types: [ released ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '8' | ||
distribution: 'adopt' | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
|
||
- id: install-secret-key | ||
name: Install GPG Secret Key | ||
run: | | ||
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import | ||
gpg --list-secret-keys --keyid-format LONG | ||
- id: publish-to-central | ||
name: Publish to Central Repository | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | ||
run: | | ||
mvn \ | ||
--no-transfer-progress \ | ||
--batch-mode \ | ||
-Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \ | ||
clean deploy -P release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created | ||
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path | ||
|
||
name: Publish SNAPSHOT package | ||
|
||
on: | ||
release: | ||
types: [ prereleased ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '8' | ||
distribution: 'adopt' | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
|
||
- id: install-secret-key | ||
name: Install GPG Secret Key | ||
run: | | ||
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import | ||
gpg --list-secret-keys --keyid-format LONG | ||
- id: publish-to-central | ||
name: Publish to Central Repository | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | ||
run: | | ||
mvn \ | ||
--no-transfer-progress \ | ||
--batch-mode \ | ||
-Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \ | ||
clean deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,8 @@ public class PaymentTest extends BaseResourceTest { | |
|
||
private static final String PAYMENT_BASE_JSON = "payment/payment_base.json"; | ||
|
||
private static final String PAYMENT_PIX_JSON = "payment/payment_pix.json"; | ||
|
||
private static final String PAYMENT_CAPTURED_JSON = "payment/payment_captured.json"; | ||
|
||
private static final String PAYMENT_CANCELLED_JSON = "payment/payment_cancelled.json"; | ||
|
@@ -136,6 +138,43 @@ public void paymentSaveRequestOptionsTest() throws MPException, IOException { | |
assertNotNull(payment.getId()); | ||
} | ||
|
||
@Test | ||
public void paymentPixSaveTest() throws MPException, IOException { | ||
|
||
httpClientMock.mock(PAYMENT_PIX_JSON, HTTP_STATUS_CREATED, PAYMENT_PIX_JSON); | ||
|
||
Payment payment = newPixPayment(); | ||
payment.save(); | ||
assertNotNull(payment.getLastApiResponse()); | ||
assertEquals(HTTP_STATUS_CREATED, payment.getLastApiResponse().getStatusCode()); | ||
assertNotNull(payment.getId()); | ||
assertEquals("pix", payment.getPaymentMethodId()); | ||
assertEquals( | ||
"https://www.mercadopago.com.br/payments/21071815560/ticket?caller_id=471763966&hash=abcd1234efgh5678", | ||
payment.getPointOfInteraction().getTransactionData().getTicketUrl()); | ||
assertNotNull(payment.getPointOfInteraction().getTransactionData().getQrCode()); | ||
assertNotNull(payment.getPointOfInteraction().getTransactionData().getQrCodeBase64()); | ||
} | ||
|
||
@Test | ||
public void paymentPixSaveRequestOptionsTest() throws MPException, IOException { | ||
|
||
httpClientMock.mock(PAYMENT_PIX_JSON, HTTP_STATUS_CREATED, PAYMENT_PIX_JSON); | ||
|
||
MPRequestOptions requestOptions = newRequestOptions(); | ||
Payment payment = newPixPayment(); | ||
payment.save(requestOptions); | ||
assertNotNull(payment.getLastApiResponse()); | ||
assertEquals(HTTP_STATUS_CREATED, payment.getLastApiResponse().getStatusCode()); | ||
assertNotNull(payment.getId()); | ||
assertEquals("pix", payment.getPaymentMethodId()); | ||
assertEquals( | ||
"https://www.mercadopago.com.br/payments/21071815560/ticket?caller_id=471763966&hash=abcd1234efgh5678", | ||
payment.getPointOfInteraction().getTransactionData().getTicketUrl()); | ||
assertNotNull(payment.getPointOfInteraction().getTransactionData().getQrCode()); | ||
assertNotNull(payment.getPointOfInteraction().getTransactionData().getQrCodeBase64()); | ||
} | ||
|
||
@Test | ||
public void capturePaymentTest() throws MPException, IOException { | ||
|
||
|
@@ -346,5 +385,14 @@ public static Payment newPayment(boolean capture) { | |
.setFloor("floor") | ||
.setApartment("apartment")))); | ||
} | ||
|
||
public static Payment newPixPayment() { | ||
return new Payment() | ||
.setTransactionAmount(100f) | ||
.setDateOfExpiration(new Date(2022, Calendar.FEBRUARY, 10, 10, 10, 10)) | ||
.setPaymentMethodId("pix") | ||
.setDescription("description") | ||
.setPayer(new Payer().setEmail("[email protected]")); | ||
} | ||
} | ||
|
9 changes: 9 additions & 0 deletions
9
src/test/java/mercadopago/resources/mocks/request/payment/payment_pix.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"payer": { | ||
"email": "[email protected]" | ||
}, | ||
"description": "description", | ||
"transaction_amount": 100.0, | ||
"payment_method_id": "pix", | ||
"date_of_expiration": "3922-02-10T10:10:10.000+0000" | ||
} |
130 changes: 130 additions & 0 deletions
130
src/test/java/mercadopago/resources/mocks/response/payment/payment_pix.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
{ | ||
"id": 21071815560, | ||
"date_created": "2022-01-10T10:10:10.000-00:00", | ||
"date_approved": null, | ||
"date_last_updated": "2022-01-10T10:10:10.000-00:00", | ||
"date_of_expiration": "2022-02-10T10:10:10.000-00:00", | ||
"money_release_date": null, | ||
"operation_type": "regular_payment", | ||
"issuer_id": null, | ||
"payment_method_id": "pix", | ||
"payment_type_id": "bank_transfer", | ||
"status": "pending", | ||
"status_detail": "pending_waiting_transfer", | ||
"currency_id": "BRL", | ||
"description": "description", | ||
"live_mode": true, | ||
"sponsor_id": null, | ||
"authorization_code": null, | ||
"money_release_schema": null, | ||
"taxes_amount": 0, | ||
"counter_currency": null, | ||
"brand_id": null, | ||
"shipping_amount": 0, | ||
"pos_id": null, | ||
"store_id": null, | ||
"integrator_id": null, | ||
"platform_id": null, | ||
"corporation_id": null, | ||
"collector_id": 471763966, | ||
"payer": { | ||
"type": null, | ||
"id": "128185910", | ||
"operator_id": null, | ||
"email": "[email protected]", | ||
"identification": { | ||
"type": null, | ||
"number": null | ||
}, | ||
"phone": { | ||
"area_code": null, | ||
"number": null, | ||
"extension": null | ||
}, | ||
"first_name": null, | ||
"last_name": null, | ||
"entity_type": null | ||
}, | ||
"marketplace_owner": null, | ||
"metadata": {}, | ||
"additional_info": { | ||
"available_balance": null, | ||
"nsu_processadora": null, | ||
"authentication_code": null | ||
}, | ||
"order": {}, | ||
"external_reference": null, | ||
"transaction_amount": 100, | ||
"transaction_amount_refunded": 0, | ||
"coupon_amount": 0, | ||
"differential_pricing_id": null, | ||
"deduction_schema": null, | ||
"callback_url": null, | ||
"installments": 1, | ||
"transaction_details": { | ||
"payment_method_reference_id": null, | ||
"net_received_amount": 0, | ||
"total_paid_amount": 100, | ||
"overpaid_amount": 0, | ||
"external_resource_url": null, | ||
"installment_amount": 0, | ||
"financial_institution": null, | ||
"payable_deferral_period": null, | ||
"acquirer_reference": null, | ||
"bank_transfer_id": null, | ||
"transaction_id": null | ||
}, | ||
"fee_details": [], | ||
"charges_details": [], | ||
"captured": true, | ||
"binary_mode": false, | ||
"call_for_authorize_id": null, | ||
"statement_descriptor": null, | ||
"card": {}, | ||
"notification_url": null, | ||
"refunds": [], | ||
"processing_mode": "aggregator", | ||
"merchant_account_id": null, | ||
"merchant_number": null, | ||
"acquirer_reconciliation": [], | ||
"point_of_interaction": { | ||
"type": "OPENPLATFORM", | ||
"business_info": { | ||
"unit": "online_payments", | ||
"sub_unit": "default" | ||
}, | ||
"location": { | ||
"state_id": null, | ||
"source": null | ||
}, | ||
"application_data": { | ||
"name": null, | ||
"version": null | ||
}, | ||
"transaction_data": { | ||
"qr_code": "00020126580014br.gov.bcb.pix0136d58a7469-afb3-48dd-b279-5576754cd5f75204000053039865406100.005802BR5911TETE97814116009Sao Paulo62240520mpqrinter2107181556063044CC4", | ||
"bank_transfer_id": null, | ||
"transaction_id": null, | ||
"financial_institution": null, | ||
"bank_info": { | ||
"payer": { | ||
"account_id": null, | ||
"id": null, | ||
"long_name": null, | ||
"external_account_id": null | ||
}, | ||
"collector": { | ||
"account_id": null, | ||
"long_name": null, | ||
"account_holder_name": "Salazar Tucker", | ||
"transfer_account_id": null | ||
}, | ||
"is_same_bank_account_owner": null, | ||
"origin_bank_id": null, | ||
"origin_wallet_id": null | ||
}, | ||
"qr_code_base64": "iVBORw0KGgoAAAANSUhEUgAABWQAAAVkAQAAAAB79iscAAAI6UlEQVR42u3dW27kNhAFUO6A+9+ldsAAgZFRsy7Z7cwAianTH4ZtvY76r1CvNn7Q52q0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tH9e2+ZPv//v65RezvvnTu3XXf7+sxytp3yd179OSbf/OkpLS0tLS0tLS0tLS/sIbb+HbL/+vN+u3qS8S3r2/Yn1C5quWDBoaWlpaWlpaWlpaWkfob0HkC+P2Bx9uXZ6qylYvP9orwfa6ymZQUtLS0tLS0tLS0tL+zzt9frYlKtbhIgpbzil/cob0NLS0tLS0tLS0tLS0oZoLlNe8CmAnFDl/a4Qcg5aWlpaWlpaWlpaWtqnawu+l7vnprdaNJmLNaeKzVqY+Rs1orS0tLS0tLS0tLS0tD9dm6aU/Ac/fmOmCi0tLS0tLS0tLS0t7U/W5s+yt21RiZmiyBKVvqTz9hWbr6fQ0tLS0tLS0tLS0tKerU1Fk9cqqHyZ+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l4rV/S8BTstu56CynsE2mlpaWlpaWlpaWlpaR+j3Y2LTGm/e3g5wgbtqbhyhBzhPUT8ZhRJS0tLS0tLS0tLS0t7pHZZ85hLL8fmz/KmKe6cpp4sR6TQ0tLS0tLS0tLS0tI+VtvyKuzSElfrNFOGrizKrmP8v5Pdo6WlpaWlpaWlpaWlfYa2FFyO8ltphOuvWbt0g7EZRJmyhbS0tLS0tLS0tLS0tI/QJnwprqzpt8/b32qy7377dy9OS0tLS0tLS0tLS0t7trYWPk7tasswbzPzf4QcYf1aPghNaWlpaWlpaWlpaWlpT9f+/z+0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tH9M+xd0qTe2JoomXQAAAABJRU5ErkJggg==", | ||
"ticket_url": "https://www.mercadopago.com.br/payments/21071815560/ticket?caller_id=471763966&hash=abcd1234efgh5678" | ||
} | ||
} | ||
} |