Skip to content

Commit ae1f272

Browse files
authored
Merge pull request #14 from devinweb/feature/fix-#13
throw error message if the transaction doesn't exist
2 parents 2489c8d + 9f1d4a0 commit ae1f272

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

phpunit.xml.dist

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@
1010
stopOnFailure="false"
1111
>
1212
<testsuites>
13-
<testsuite name="Unit">
14-
<directory suffix="Test.php">./tests/Unit</directory>
15-
</testsuite>
16-
<testsuite name="Feature">
17-
<directory suffix="Test.php">./tests/Feature</directory>
13+
<testsuite name="Package Test">
14+
<directory suffix=".php">./tests/</directory>
1815
</testsuite>
1916
</testsuites>
2017
<php>

resources/lang/ar.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"failed_message": "حدث خطأ في عملية الدفع يرجى المحاولة مرة أخرى."
2+
"failed_message": "حدث خطأ في عملية الدفع يرجى المحاولة مرة أخرى.",
3+
"invalid_checkout_id": "checkout_id غير صالح"
34
}

src/Support/TransactionBuilder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Devinweb\LaravelHyperpay\Support;
44

55
use Illuminate\Support\Arr;
6+
use Illuminate\Validation\ValidationException;
67

78
class TransactionBuilder
89
{
@@ -60,6 +61,10 @@ public function findByIdOrCheckoutId($id)
6061
$transaction_model = config('hyperpay.transaction_model');
6162
$transaction = app($transaction_model)->whereId($id)->orWhere('checkout_id', $id)->first();
6263

64+
if (! $transaction) {
65+
throw ValidationException::withMessages([__('invalid_checkout_id')]);
66+
}
67+
6368
return $transaction;
6469
}
6570

0 commit comments

Comments
 (0)