Ananas APItest bench
staging api.qa2.ananastest.com
TC-DISC-08 Negative Validation changes data

Promotional price above the allowed limit (95%)

Verify the minimum allowed price

! 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

  1. Send a promotional price below the allowed minimum

Expected result

The system rejects the request

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

Change parameters

A dry run builds every request without sending it; responses come from a local stub.

Test code

mirrors tests/DiscountsTest.php::tc_disc_08()
183// Verify the minimum allowed price
184public function tc_disc_08(): void
185{
186 $targetId = (int) $_ENV['TARGET_ID'];
187
188 $response = $this->ananas->setDiscounts([
189 'discounts' => [
190 [
191 'merchantInventoryId' => $targetId,
192 'discountPrice' => 1,
193 'discountPriceCurrency' => 'RSD',
194 'dateFrom' => Carbon::now()->addDays(10)->format('d/m/Y'),
195 'dateTo' => Carbon::now()->addDays(11)->format('d/m/Y'),
196 'discountType' => 'SALE',
197 ],
198 ],
199 ]);
200
201 $this->assertEquals(200, $response['statusCode']);
202 $this->assertNotEquals(1, $response['response']['scheduleResult'][0]['success']);
203 $this->assertNotEmpty($response['response']['scheduleResult'][0]['error']);
204}

web/app/Scenarios/DiscountsScenarios.php · line numbers refer to this file

Not run yet. Run it against the API, or do a dry run to see the requests it would send.