Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
stopOnFailure="false"
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
<testsuite name="Package Test">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<php>
Expand Down
3 changes: 2 additions & 1 deletion resources/lang/ar.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"failed_message": "حدث خطأ في عملية الدفع يرجى المحاولة مرة أخرى."
"failed_message": "حدث خطأ في عملية الدفع يرجى المحاولة مرة أخرى.",
"invalid_checkout_id": "checkout_id غير صالح"
}
5 changes: 5 additions & 0 deletions src/Support/TransactionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Devinweb\LaravelHyperpay\Support;

use Illuminate\Support\Arr;
use Illuminate\Validation\ValidationException;

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

if (! $transaction) {
throw ValidationException::withMessages([__('invalid_checkout_id')]);
}

return $transaction;
}

Expand Down