Skip to content

Commit f080c25

Browse files
committed
Renamed enum case name to better describe its function
1 parent 98f593f commit f080c25

5 files changed

Lines changed: 5 additions & 5 deletions

File tree

app/Enums/ApiResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ enum ApiResponse: string
3232
case RESPONSE_REDEMPTION_FAILED_VOUCHER_ALREADY_FULLY_REDEEMED = 'This voucher has already been fully redeemed, no redemption made this time.';
3333
case RESPONSE_REDEMPTION_FAILED_REQUESTED_AMOUNT_TOO_HIGH = 'Requested amount is greater than voucher value remaining, no redemption made this time.';
3434
case RESPONSE_REDEMPTION_FAILED_TOO_MANY_ATTEMPTS = 'Too many redemption attempts, please wait.';
35-
case RESPONSE_REDEMPTION_FAILED_VOUCHER_EXPIRED = 'This voucher has expired.';
35+
case RESPONSE_VOUCHER_EXPIRED = 'This voucher has expired.';
3636
case RESPONSE_REDEMPTION_LIVE_REDEMPTION = 'Please provide the customer with their goods / services to the value of XXX.';
3737
case RESPONSE_REDEMPTION_TEST_REDEMPTION = 'This was a test redemption. Do NOT provide the person with goods or services.';
3838
case RESPONSE_REDEMPTION_SUCCESSFUL = 'Redemption successful.';

app/Http/Controllers/Api/V1/ApiVoucherRedemptionsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function store(): JsonResponse
166166
if (!is_null($voucher->expires_at)) {
167167
if ($voucher->expires_at <= now()) {
168168
$this->responseCode = 400;
169-
$this->message = ApiResponse::RESPONSE_REDEMPTION_FAILED_VOUCHER_EXPIRED->value;
169+
$this->message = ApiResponse::RESPONSE_VOUCHER_EXPIRED->value;
170170

171171
return $this->respond();
172172
}

app/Http/Controllers/Api/V1/ApiVoucherValidationController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function store(): JsonResponse
148148
if (!is_null($voucher->expires_at)) {
149149
if ($voucher->expires_at <= now()) {
150150
$this->responseCode = 409;
151-
$this->message = ApiResponse::RESPONSE_REDEMPTION_FAILED_VOUCHER_EXPIRED->value;
151+
$this->message = ApiResponse::RESPONSE_VOUCHER_EXPIRED->value;
152152

153153
return $this->respond();
154154
}

tests/Feature/API/App/VoucherRedemption/VoucherRedemptionPostTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,6 @@ public function itFailsIfVoucherHasExpired()
375375
$response->assertStatus(400);
376376

377377
$responseObject = json_decode($response->getContent(), false);
378-
$this->assertSame(ApiResponse::RESPONSE_REDEMPTION_FAILED_VOUCHER_EXPIRED->value, $responseObject->meta->message);
378+
$this->assertSame(ApiResponse::RESPONSE_VOUCHER_EXPIRED->value, $responseObject->meta->message);
379379
}
380380
}

tests/Feature/API/App/VoucherValidation/VoucherValidationPostTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public function itFailsIfVoucherIsExpired()
206206
* Assert status code & message are expected
207207
*/
208208
$response->assertStatus(409);
209-
$this->assertEquals($responseObject->meta->message, ApiResponse::RESPONSE_REDEMPTION_FAILED_VOUCHER_EXPIRED->value);
209+
$this->assertEquals($responseObject->meta->message, ApiResponse::RESPONSE_VOUCHER_EXPIRED->value);
210210
}
211211

212212
#[Test]

0 commit comments

Comments
 (0)