TC-DISC-16
Functional
changes data Mixed batch (valid and invalid data)
Verify partial processing of the request
! Documented discrepancy · errors.txt
All tests in this section: The discount tests are tricky because they involve persistent changes to the real data. To mitigate this problem and automate the tests, every discount is cancelled after the test. The ongoing promotion cannot be cancelled, and therefore have to be reused for these tests.
Specification · xlsx
Steps
- Send a valid and an invalid promotion in the same request
Expected result
Valid promotions are accepted; invalid ones are rejected
Endpoints
POST · PUT · GET /payment/api/v1/merchant-integration/discountsPUT /payment/api/v1/merchant-integration/discounts/{id}/cancellations Run
- API_URL
https://api.qa2.ananastest.com- TARGET_ID
2555660- DISCOUNT_PRICE
10000
A dry run builds every request without sending it; responses come from a local stub.
Test code
mirrors tests/DiscountsTest.php::tc_disc_16()
496// Verify partial processing of the request
497public function tc_disc_16(): void
498{
499 $targetId = (int) $_ENV['TARGET_ID'];
500
501 $response = $this->ananas->setDiscounts([
502 'discounts' => [
503 [
504 'merchantInventoryId' => $targetId,
505 'discountPrice' => (int) $_ENV['DISCOUNT_PRICE'],
506 'discountPriceCurrency' => 'RSD',
507 'dateFrom' => Carbon::now()->addDays(10)->format('d/m/Y'),
508 'dateTo' => Carbon::now()->addDays(11)->format('d/m/Y'),
509 'discountType' => 'SALE',
510 ],
511 [
512 'merchantInventoryId' => 999999,
513 'discountPrice' => (int) $_ENV['DISCOUNT_PRICE'],
514 'discountPriceCurrency' => 'RSD',
515 'dateFrom' => Carbon::now()->subDay()->format('d/m/Y'),
516 'dateTo' => Carbon::now()->subDays(10)->format('d/m/Y'),
517 'discountType' => 'SALE',
518 ],
519 ],
520 ]);
521
✗522 $this->assertEquals(200, $response['statusCode']);
523 $this->assertEquals(1, $response['response']['scheduleResult'][0]['success']);
524 $this->assertNotEquals(1, $response['response']['scheduleResult'][1]['success']);
525 $this->assertNotEmpty($response['response']['scheduleResult'][1]['error']);
526
527 $discountId = $response['response']['scheduleResult'][0]['data']['discountId'];
528
529 $this->ananas->cancelDiscount($discountId);
530}
web/app/Scenarios/DiscountsScenarios.php · line numbers refer to this file
Assertions
| Line | Assertion | Expected | Actual | |
|---|---|---|---|---|
| ✗ | 522 | assertEquals |
200 |
504 |
The run stopped at the first failed assertion, as PHPUnit does.
HTTP exchanges 2
1 POST /iam/api/v1/auth/token 504 Gateway Time-out 11.00 s
Request
POST
https://api.qa2.ananastest.com/iam/api/v1/auth/token- Content-Length
- 219
- User-Agent
- GuzzleHttp/7
- Content-Type
- application/json
- Host
- api.qa2.ananastest.com
JSON · 219 B
{
"clientId": "5iliufdg44q6ett7gk79h2m8e9",
"clientSecret": "h0pf3bfAC7WI23ImSRr1k92S6oNQr9KXmhr1toafO2igUDUlqhZM7U8TpCmYC+yoOPBshC4WlNtoo94/2wibOiUofQo=",
"grantType": "CLIENT_CREDENTIALS",
"scope": "public_api/full_access"
}
Response
504 Gateway Time-out 11.00 s
- Server
- awselb/2.0
- Date
- Wed, 11 Nov 2026 13:19:28 GMT
- Content-Type
- text/html
- Content-Length
- 132
- Connection
- keep-alive
Text · 132 B
<html> <head><title>504 Gateway Time-out</title></head> <body> <center><h1>504 Gateway Time-out</h1></center> </body> </html>
cURL
curl -X POST 'https://api.qa2.ananastest.com/iam/api/v1/auth/token' \
-H 'Content-Type: application/json' \
--data-raw '{"clientId":"5iliufdg44q6ett7gk79h2m8e9","clientSecret":"h0pf3bfAC7WI23ImSRr1k92S6oNQr9KXmhr1toafO2igUDUlqhZM7U8TpCmYC+yoOPBshC4WlNtoo94\/2wibOiUofQo=","grantType":"CLIENT_CREDENTIALS","scope":"public_api\/full_access"}'
2 POST /payment/api/v1/merchant-integration/discounts 504 Gateway Time-out 10.00 s
Request
POST
https://api.qa2.ananastest.com/payment/api/v1/merchant-integration/discounts- Content-Length
- 326
- User-Agent
- GuzzleHttp/7
- Content-Type
- application/json
- Host
- api.qa2.ananastest.com
- Authorization
- Bearer
JSON · 326 B
{
"discounts": [
{
"merchantInventoryId": 2555660,
"discountPrice": 10000,
"discountPriceCurrency": "RSD",
"dateFrom": "21/11/2026",
"dateTo": "22/11/2026",
"discountType": "SALE"
},
{
"merchantInventoryId": 999999,
"discountPrice": 10000,
"discountPriceCurrency": "RSD",
"dateFrom": "10/11/2026",
"dateTo": "01/11/2026",
"discountType": "SALE"
}
]
}
Response
504 Gateway Time-out 10.00 s
- Server
- awselb/2.0
- Date
- Wed, 11 Nov 2026 13:19:39 GMT
- Content-Type
- text/html
- Content-Length
- 132
- Connection
- keep-alive
Text · 132 B
<html> <head><title>504 Gateway Time-out</title></head> <body> <center><h1>504 Gateway Time-out</h1></center> </body> </html>
cURL
curl -X POST 'https://api.qa2.ananastest.com/payment/api/v1/merchant-integration/discounts' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer' \
--data-raw '{"discounts":[{"merchantInventoryId":2555660,"discountPrice":10000,"discountPriceCurrency":"RSD","dateFrom":"21\/11\/2026","dateTo":"22\/11\/2026","discountType":"SALE"},{"merchantInventoryId":999999,"discountPrice":10000,"discountPriceCurrency":"RSD","dateFrom":"10\/11\/2026","dateTo":"01\/11\/2026","discountType":"SALE"}]}'