Skip to content

Commit

Permalink
fix RedsysPayable type
Browse files Browse the repository at this point in the history
  • Loading branch information
dtorras committed Nov 7, 2024
1 parent cfeb8e8 commit 5eaaeec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Actions/HandleRedsysResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __invoke(
$request->status = RedsysRequestStatus::Success;
$request->save();

if ($request->model) {
if ($request->model && method_exists($request->model, 'paidWithRedsys')) {
$request->model->paidWithRedsys();
}

Expand Down
3 changes: 3 additions & 0 deletions src/Contracts/RedsysPayable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Creagia\LaravelRedsys\Contracts;

/**
* @mixin \Illuminate\Database\Eloquent\Model
*/
interface RedsysPayable
{
public function getTotalAmount(): int;
Expand Down
2 changes: 2 additions & 0 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Creagia\LaravelRedsys;

use Creagia\LaravelRedsys\Contracts\RedsysPayable;
use Creagia\LaravelRedsys\Observers\RedsysRequestObserver;
use Creagia\Redsys\Enums\Currency;
use Creagia\Redsys\Enums\PayMethod;
Expand All @@ -28,6 +29,7 @@
* @property int $amount
* @property PayMethod $pay_method
* @property TransactionType $transaction_type
* @property-read RedsysPayable|Model|null $model
*/
class Request extends Model
{
Expand Down

0 comments on commit 5eaaeec

Please sign in to comment.