-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a4f17a
commit da8f834
Showing
17 changed files
with
390 additions
and
31 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
database/migrations/private/2023_07_08_223554_cashier_details_create_status_column.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the "cashier-provider/core" project. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Andrey Helldar <helldar@dragon-code.pro> | ||
* @copyright 2023 Andrey Helldar | ||
* @license MIT | ||
* | ||
* @see https://github.com/cashier-provider | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use CashierProvider\Core\Concerns\Migrations\PrivateMigration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
|
||
new class extends PrivateMigration { | ||
public function up(): void | ||
{ | ||
$this->connection()->table($this->table(), function (Blueprint $table) { | ||
$table->string('status')->nullable()->after('operation_id'); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the "cashier-provider/core" project. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Andrey Helldar <helldar@dragon-code.pro> | ||
* @copyright 2023 Andrey Helldar | ||
* @license MIT | ||
* | ||
* @see https://github.com/cashier-provider | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CashierProvider\Core\Casts; | ||
|
||
use CashierProvider\Core\Concerns\Config\Payment\Drivers; | ||
use CashierProvider\Core\Data\Models\InfoData; | ||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class InfoCast implements CastsAttributes | ||
{ | ||
use Drivers; | ||
|
||
public function get(Model $model, string $key, mixed $value, array $attributes): InfoData | ||
{ | ||
$instance = static::driverByModel($model->parent)->details; | ||
|
||
return call_user_func([$instance, 'from'], json_decode($value, true)); | ||
} | ||
|
||
/** | ||
* @param \Illuminate\Database\Eloquent\Model $model | ||
* @param string $key | ||
* @param \Spatie\LaravelData\Data $value | ||
* @param array $attributes | ||
* | ||
* @return string | ||
*/ | ||
public function set(Model $model, string $key, mixed $value, array $attributes): string | ||
{ | ||
return $value->toJson(JSON_UNESCAPED_SLASHES ^ JSON_UNESCAPED_UNICODE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the "cashier-provider/core" project. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Andrey Helldar <helldar@dragon-code.pro> | ||
* @copyright 2023 Andrey Helldar | ||
* @license MIT | ||
* | ||
* @see https://github.com/cashier-provider | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CashierProvider\Core\Concerns\Events; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
trait Notifiable | ||
{ | ||
protected static function event(Model $payment): void {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the "cashier-provider/core" project. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Andrey Helldar <helldar@dragon-code.pro> | ||
* @copyright 2023 Andrey Helldar | ||
* @license MIT | ||
* | ||
* @see https://github.com/cashier-provider | ||
*/ | ||
|
||
namespace CashierProvider\Core\Data\Models; | ||
|
||
use CashierProvider\Core\Concerns\Config\Payment\Payments; | ||
use CashierProvider\Core\Concerns\Transformers\EnumsTransformer; | ||
use CashierProvider\Core\Enums\StatusEnum; | ||
use Spatie\LaravelData\Data; | ||
use UnitEnum; | ||
|
||
abstract class InfoData extends Data | ||
{ | ||
use EnumsTransformer; | ||
use Payments; | ||
|
||
public UnitEnum|int|string|null $status; | ||
|
||
public function statusToEnum(): StatusEnum | ||
{ | ||
return static::payment()->status->toEnum( | ||
static::transformFromEnum($this->status) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the "cashier-provider/core" project. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Andrey Helldar <helldar@dragon-code.pro> | ||
* @copyright 2023 Andrey Helldar | ||
* @license MIT | ||
* | ||
* @see https://github.com/cashier-provider | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CashierProvider\Core\Events; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
abstract class BaseEvent | ||
{ | ||
public function __construct( | ||
public Model $payment | ||
) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the "cashier-provider/core" project. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Andrey Helldar <helldar@dragon-code.pro> | ||
* @copyright 2023 Andrey Helldar | ||
* @license MIT | ||
* | ||
* @see https://github.com/cashier-provider | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CashierProvider\Core\Events; | ||
|
||
class CreatedEvent extends BaseEvent | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the "cashier-provider/core" project. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Andrey Helldar <helldar@dragon-code.pro> | ||
* @copyright 2023 Andrey Helldar | ||
* @license MIT | ||
* | ||
* @see https://github.com/cashier-provider | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CashierProvider\Core\Events; | ||
|
||
class FailedEvent extends BaseEvent | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the "cashier-provider/core" project. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Andrey Helldar <helldar@dragon-code.pro> | ||
* @copyright 2023 Andrey Helldar | ||
* @license MIT | ||
* | ||
* @see https://github.com/cashier-provider | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CashierProvider\Core\Events; | ||
|
||
class RefundedEvent extends BaseEvent | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the "cashier-provider/core" project. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Andrey Helldar <helldar@dragon-code.pro> | ||
* @copyright 2023 Andrey Helldar | ||
* @license MIT | ||
* | ||
* @see https://github.com/cashier-provider | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CashierProvider\Core\Events; | ||
|
||
class SuccessEvent extends BaseEvent | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the "cashier-provider/core" project. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Andrey Helldar <helldar@dragon-code.pro> | ||
* @copyright 2023 Andrey Helldar | ||
* @license MIT | ||
* | ||
* @see https://github.com/cashier-provider | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CashierProvider\Core\Events; | ||
|
||
class WaitRefundEvent extends BaseEvent | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.