Location-based products simulation
π§ͺ Simulating a Location-Based Purchase with Dummy Products
π General Overview
GET
calls, each one revealing the next step (nextPath
, nextField
). This approach guarantees that your integration remains resilient to product complexity changes or future updates to the API structure.π§ Remember you can use the Get Labels method to have a preview of all the possible steps any dynamic flow might have.
1.
2.
3.
4.
5.
6.
7.
Get Deliver Locations
, but have mind it could play a role in real life products. This is why it is mandatory to follow the flow through the nextPath
field from each response..β οΈ Important Notice β Dynamic Flow Logic The location-based product flow follows a dynamic GET sequence, where each response includes a nextPath
indicating the next endpoint to call. This path-driven logic means the number of steps required before reachingGET /products
can vary depending on the specific product configuration.π§ In real scenarios, some products may involve: Additional intermediate steps, such as districts, sectors, or delivery points Or fewer steps, skipping certain fields entirely β To ensure compatibility across all products, never hardcode assumptions about the number of steps. Instead: Always follow the nextPath
provided in each API responseContinue iterating until you reach the product listing endpoint
π Dynamic GET Sequence in this dummy scenario
GET
requests for location-based dummy products, is designed to simulate geographical product selection before cart creation and purchase.nextPath
, guiding the client to the next step. Dummy responses are predictable and reusable for developer tests β especially with fixed values such as categoryId = 8
,countryId = 192
, stateId = 473
, and municipalityId = 499
.π Step 1 β Get Countries
[
{
"countryId": 192,
"name": "Cuba",
"nextPath": "/physical-products/categories/{{terminalId}}/192",
"nextField": "categoryId"
}
]
countryId = 192
β Required for Create CartnextPath
shown above.
ποΈ Step 2 β Get Categories
[
{
"categoryId": 4,
"name": "PHONE",
"nextPath": "/physical-products/states/{{terminalId}}/4/192",
"nextField": "stateId"
},
{
"categoryId": 5,
"name": "MODEM",
"nextPath": "/physical-products/states/{{terminalId}}/5/192",
"nextField": "stateId"
},
{
"categoryId": 2,
"name": "COMBO",
"nextPath": "/physical-products/states/{{terminalId}}/2/192",
"nextField": "stateId"
},
{
"categoryId": 8,
"name": "DUMMY",
"nextPath": "/physical-products/states/{{terminalId}}/8/192",
"nextField": "stateId"
}
]
categoryId = 8
("DUMMY") β needed for dummy flow.nextPath
to load states.
β οΈ Important Warning β Dummy Flow Safety When testing the location-based product flow, it is mandatory to use category 8
("DUMMY"). This category is specifically designed for simulation and safe testing.π« Using any other category (e.g. "PHONE"
,"MODEM"
,"COMBO"
) may result in:Access to real products Actual charges to your account Irreversible transactions affecting end users β Always ensure: categoryId = 8
is selected when building the dummy test flow.π For internal QA and developer environments, hardcode categoryId = 8
when applicable or validate programmatically before sending requests to cart and purchase endpoints.This practice protects your team, your customers, and your integration from accidental costs or data exposure.
ποΈ Step 3 β Get States
[
{
"stateId": 472, "name": "Pinar del RΓo", "nextPath": "/physical-products/municipalities/{{terminalId}}/8/472", "nextField": "municipalityId"
},
{
"stateId": 473, "name": "La Habana", "nextPath": "/physical-products/municipalities/{{terminalId}}/8/473", "nextField": "municipalityId"
},
{
"stateId": 474, "name": "Artemisa", "nextPath": "/physical-products/municipalities/{{terminalId}}/8/474", "nextField": "municipalityId"
}
// ...
]
stateId = 473
("La Habana") β required for cart creation
ποΈ Step 4 β Get Municipalities
[
{
"municipalityId": 499, "name": "Centro Habana", "nextPath": "/physical-products/products/{{terminalId}}/8/499", "nextField": "productId"
},
{
"municipalityId": 512, "name": "Habana Vieja", "nextPath": "/physical-products/products/{{terminalId}}/8/512", "nextField": "productId"
},
{
"municipalityId": 513, "name": "Diez de Octubre", "nextPath": "/physical-products/products/{{terminalId}}/8/513", "nextField": "productId"
}
// ...
]
municipalityId = 499
("Centro Habana") β required for cart creation
π¦ Step 5 β Get Products
[
{
"productPriceX100": 100,
"productId": 846,
"operatorId": 9988,
"name": "Arroz 1kg",
"description": "Paquete de arroz de 1 kilogramo",
"imageUrl": "https://static.csqworld.com/flags/CU.png"
},
{
"productPriceX100": 100,
"productId": 847,
"operatorId": 9988,
"name": "Aceite 1L",
"description": "Botella de aceite de 1 litro",
"imageUrl": "https://static.csqworld.com/flags/CU.png"
}
]
productId = 846
("Arroz 1kg") -> required as a parameter in the body of create cart
step.operatorId = 9988
β required as a parameter in the Create Cart
and Purchase
steps.π Summary of Dummy Test Values (Stable)
Field | Dummy Value |
---|---|
countryId | 192 β Cuba |
categoryId | 8 β Dummy |
stateId | 473 β La Habana |
municipalityId | 499 β Centro Habana |
The only variable is the actual product (
productId
and operatorId
), which may change.nextPath
AlwaysThatβs why you should always:
nextPath
from each responseGET /products
π Step 6: Create Cart
{
"productId": 846,
"countryId": 192,
"stateId": 473,
"municipalityId": 499,
"buyerName": "TEST CSQ",
"buyerSurname": "TEST CSQ",
"buyerPhone": "123456789",
"buyerEmail": "test@test.com",
"buyerDocumentNumber": "98787666",
"beneficiaryName": "beneficiary",
"beneficiarySurname": "surname",
"beneficiaryPhone": "888999111",
"beneficiaryEmail": "beneficiary@email.com",
"beneficiaryDocumentNumber": "61827396",
"beneficiaryDocumentType": "ID_CARD",
"city": "LA HABANA",
"address": "PRUEBA"
}
{
"resultMessage": "Cart created successfully",
"resultCode": 0,
"cartId": 440, // β οΈ Note: The "cartId" value will change every time a new cart is created.
"productPriceX100": 100,
"amountToSendX100": 600,
"deliveryPriceX100": 500
}
cartId
-> required as a parameter in the body of purchase
step.amountToSendx100
β required as a parameter in the body of purchase
step.stateId
, municipalityId
, countryId
) used across steps.Create Cart
before Purchase
.deliveryPriceX100
is included in the cart response but handled internally.π³ Step 7: Purchase
{
"amountToSendX100": 600,
"localDateTime": "2025-07-09T14:06:00",
"cartId": "440"
}
{
"rc": 0,
"items": [
{
"finalstatus": 0,
"resultcode": "10",
"resultmessage": "Operation completed successfully",
"supplierreference": "440",
"suppliertoken": ""
}
]
}
supplierreference
and suppliertoken
for reconciliation or audit tracking.β οΈ Stable Values in Dummy Flow
Field | Dummy Value |
---|---|
countryId | 192 β Cuba |
categoryId | 8 β Dummy (most relevant!!) |
stateId | 473 β La Habana |
municipalityId | 499 β Centro Habana |
productId
) may change over time, this location path will consistently return valid data to reach the product listing step.productId
dynamic.
Modified atΒ 2025-07-09 13:40:31