Skip to content

Commit

Permalink
Merge pull request #2321 from mercadopago/fix/point-simulator-test
Browse files Browse the repository at this point in the history
fix/point-simulator-test
  • Loading branch information
hgaldino authored Apr 4, 2024
2 parents b663840 + 3a4f894 commit 1f78233
Show file tree
Hide file tree
Showing 5 changed files with 258 additions and 87 deletions.
111 changes: 84 additions & 27 deletions guides/mp-point/integration-api/point-simulator.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,33 @@

The Point Simulator is a tool that allows you to interact with various endpoints of our API to integrate Point of Sale devices with our system. Its main objective is to help you understand the flow of creating and canceling a payment attempt.

Please note that this tool is not an exact replica of the device, but rather an educational tool designed to familiarize you with our API.
For this reason, the Point Simulator will also allow you to test that your Point integration and payments processing are working correctly. Although it’s not an exact replica of a device, it has educational purposes, to help with familiarization with our API.

The simulator has two modes of use:

* **PDV mode**: simulates the integration of a complete system (device and Point of Sale) with our Integration API. Access the [PDV mode simulator](https://api.mercadopago.com/point/integrator-simulator/sandbox/?ignoreapidoc=true).

> To use the simulator, it is not necessary to [change the operation mode](/developers/en/reference/integrations_api/_point_integration-api_devices_device-id/patch) as the simulator works by default in PDV mode.
* **Device mode**: simulates a virtual Point of Sale device so you can test your integration using HTTP requests. Access the [device mode simulator](https://api.mercadopago.com/point/integrator-simulator/sandbox/device?ignoreapidoc=true).
* **PDV mode**: simulates the integration of a complete system (device and Point of Sale) with our API.

* **Device mode**: simulates a virtual Point of Sale device so you can test your integration using HTTP requests.

To learn how to use the simulator, follow the steps below.

## 1. Generate the test environment

To start testing integrations and payment flows with the Point Simulator, you will need to generate [test users](/developers/en/docs/mp-point/additional-content/your-integrations/test/accounts) and access their production credentials.
To start testing integrations and payment flows with the Point Simulator, you will need to generate a [seller test users](/developers/en/docs/mp-point/additional-content/your-integrations/test/accounts) and access their **production credentials**.

> WARNING
>
> Important
>
> The Simulator will ask you for the seller test user test credentials, but you will need the production ones to access their account and settings.
To generate these credentials, access [Your Integrations](https://www.mercadopago[FAKER][URL][DOMAIN]/developers/panel/), select the application where you integrated Mercado Pago Point, and in the **Test Accounts** section, click on the **+ Create test account** button. You will need to complete the requested fields according to the instructions.

<center>

![Create test account](/images/woocomerce/test-create-account-es.gif)

</center>

If you prefer, you can also create test users using the following command:

Expand Down Expand Up @@ -51,19 +62,52 @@ curl -X POST \
```
------------

## 2. Configure your credentials
Please note that when creating a test user for an application already integrated with Point, **a store and a point of sale will be automatically generated and associated with that test seller account**. This means that you can carry out your tests on payment processing without the need for additional configurations.


## 2. Set up the test environment

Before accessing the Simulator, you need to finish setting up your test environment. Follow the instructions below to do so.
1. Log in with the **production credentials of the test seller user** in an incognito window.
2. Access [Your Integrations](https://www.mercadopago[FAKER][URL][DOMAIN]/developers/panel/) and create an application with Mercado Pago Point as the product to integrate.
3. Configure your test notifications by accessing the **Notifications > Webhooks** option in the left-hand side panel. Please note that you should do this in the **Test Mode** tab, and it is recommended that the configured URL be different from the one where you will later receive notifications for your real payments. You can refer to the [Notifications documentation](/developers/en/docs/mp-point/additional-content/your-integrations/notifications/webhooks) for more details on how to configure them.
4. In the left-hand side panel, access **Testing > Test Credentials** to obtain the **test Access Token for your seller user**. The Simulator will request it to give you access to the tool and assign you a virtual device associated with your integration.

<center>

![Test credentials in Dashboard](/images/woocomerce/test-test-credentials.png)

</center>

## 3. Access the Simulator

To access the Simulator, select the option that corresponds to your type of integration and complete the fields requested for each one.

* **PDV mode**: Enter the [PDV mode Simulator](https://api.mercadopago.com/point/integrator-simulator/sandbox/?ignoreapidoc=true) and provide the test _Access Token_ for your test seller user (`TEST-XXXXX-XXXXX-XXXXXXX`). By doing so, the Simulator will assign you a virtual device.

> To use the Simulator, it is not necessary to [change the operation mode](/developers/en/reference/integrations_api/_point_integration-api_devices_device-id/patch) as the simulator works by default in PDV mode.
* **Device mode**: Enter the [Device mode Simulator](https://api.mercadopago.com/point/integrator-simulator/sandbox/device?ignoreapidoc=true) and provide the test _Access Token_ for your test seller user (`TEST-XXXXX-XXXXX-XXXXXXX`) along with the device ID obtained when [listing your devices](/developers/en/docs/mp-point/integration-configuration/integrate-with-pdv/payment-processing).

When using the simulator for the first time, you will need to enter [your credentials](https://www.mercadopago[FAKER][URL][DOMAIN]/developers/panel/credentials). To obtain them, access [Your integrations](https://www.mercadopago[FAKER][URL][DOMAIN]/developers/panel/applications), option **My credentials > Test credentials**.
Once you have provided the information according to the chosen mode of the Simulator, click the **Confirm** button to access the virtual device.

In addition, you will need to select one of your available devices.
<center>

* **PDV mode**: you must enter your test `access-token` (`TEST-XXXXX-XXXXX-XXXXXXX`) and the simulator will assign you a virtual device.
![screen of the Simulator](/images/point-api/point-device-simulator.png)

* **Device mode**: you must enter your test `access-token` (`TEST-XXXXX-XXXXX-XXXXXXX`) and the device ID obtained when [listing your devices](/developers/en/docs/mp-point/integration-configuration/integrate-with-pdv/payment-processing).
</center>

## 3. Simulate a payment intent
## 4. Simulate a payment intent

We have prepared different scenarios that allow you to simulate a real experience. In order to do this, you must select the amount according to the status you want to obtain:
To test different payment flows, we have prepared different scenarios that allow you to simulate a real experience.

To start the simulation, [create a payment intent](/developers/en/reference/integrations_api/_point_integration-api_devices_deviceid_payment-intents/post) and assing it to the Point device. In the `amount` field, you must select the amount according to the status you want to obtain.

> WARNING
>
> Important
>
> If you use the Simulator in device mode, remember to use `X-Test-Scope:sandbox` in the header to ensure that the payment attempt reaches the simulator device.
| Status | Amount |
|---|---|
Expand All @@ -72,30 +116,43 @@ We have prepared different scenarios that allow you to simulate a real experienc
| Error | $1300 |
| Successful | Any other value different from the previous ones |

> WARNING
>
> Important
>
> If you use the Simulator in device mode, remember to use `X-Test-Scope:sandbox` in the header to ensure that the payment attempt reaches the simulator device.

## 4. Get the payment intent from the device
## 5. Get the payment intent from the Simulator

Once the payment intent has been created, you must click on the **green button** of the virtual device to obtain the created payment intent.

Once the payment intent has been created, you must click on the green button of the virtual device to obtain the created payment intent.
Once found, you can verify that the amount initially entered matches the one shown on the device screen.

## 5. Swipe the card and process the payment
## 6. Process the payment

If the Simulator obtained the payment intent successfully, proceed to make the payment by clicking on the animation of the card, which represents the card swipe in the device.

<center>

If the previous step was successful, you can click on the animation of the card, which represents the card swipe in the device. Processing will begin immediately and the device will display the result.
![Simulator with card](/images/point-api/point-simulator-process.png)

</center>

Processing will begin immediately and the device will display the result according to the selected amount.

| Status | Simulator behaviour |
|---|---|
| Reversed | The screen will display an error and provide the detail "Reversed". |
| Rejected | The screen will display an error and provide the detail “Rejected”. |
| Error | The screen will display an error and provide the detail “Error”. |
| Successful | A successful payment screen will be displayed and the detail will be “Approved”. |

> WARNING
>
> Important
>
> To query a payment made by the simulator through the [Payments API](/developers/en/reference/payments/_payments_id/get), you must use the same test `access-token` that you use in the Simulator.
> To query a payment made by the simulator through the [Payments API](/developers/en/reference/payments/_payments_id/get), you must use the same test `access_token` that you use in the Simulator.

## 7. Receive the notification

## 6. Receive the notification
When payment intents are processed, an alert is sent to the URL configured as the notification channel by the integrator. In the case of test payment notifications made through the Simulator, they will be sent to the channel you defined as the notification pathway when configuring your test environment with your seller user.

> Notifications for test payments made through the Simulator will be sent through the same channel you defined as the notification method when configuring your integration. Refer to [Configure notifications](/developers/en/docs/mp-point/integration-configuration/integrate-with-pdv/notifications) if you have any doubts.
To validate their reception and proper functioning, go to your notification log. There, you will find the sent notification with the transaction status, so you can verify its details.

Once the payment intent is processed, go to your notification log. There you will see that the transaction status notification has been sent and you can check the details.
> Once you have finished your testing with the Simulator, remember to **replace the test credentials of the seller user with the production credentials of your real user**.
Loading

0 comments on commit 1f78233

Please sign in to comment.