cashier-provider / cash
Driver for managing cash payments (see cashier-provider/core)
Fund package maintenance!
TheDragonCode
Open Collective
Boosty
Yoomoney
Installs: 2 653
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.3 || ^8.0
- cashier-provider/core: ^2.5 || ^3.0
- psr/http-message: ^1.0
Requires (Dev)
- ext-json: *
- dragon-code/support: ^5.0
- illuminate/database: ^6.0 || ^7.0 || ^8.0 || ^9.0
- orchestra/testbench: ^4.0 || ^5.0 || ^6.0 || ^7.0
- phpunit/phpunit: ^9.0
- symfony/var-dumper: ^4.0 || ^5.0 || ^6.0
README
Installation
To get the latest version of Cash Driver Provider
, simply require the project using Composer:
$ composer require cashier-provider/cash
Or manually update require
block of composer.json
and run composer update
.
{ "require": { "cashier-provider/cash": "^2.0" } }
Using
Note:
This project is the driver for
Cashier Provider
.
Configuration
Add your driver information to the config/cashier.php
file:
use App\Models\Payment; use App\Payments\Cash as CashDetails; use CashierProvider\Cash\Driver as CashDriver; use CashierProvider\Core\Constants\Driver; return [ 'payment' => [ 'map' => [ Payment::TYPE_CASH => 'cash' ] ], 'drivers' => [ 'cash' => [ Driver::DRIVER => CashDriver::class, Driver::DETAILS => CashDetails::class, ] ] ];
Resource
Create a model resource class inheriting from CashierProvider\Core\Resources\Model
in your application.
Use the $this->model
link to refer to the payment model. When executed, the $model
parameter will contain the payment instance.
namespace App\Payments; use CashierProvider\Core\Resources\Model; class Cash extends Model { protected function paymentId(): string { return (string) $this->model->id; } protected function sum(): float { return (float) $this->model->sum; } protected function currency(): int { return $this->model->currency; } protected function createdAt(): Carbon { return $this->model->created_at; } }
Available Methods And Details Data
$payment->cashier->external_id // Returns transaction ID for this operation $payment->cashier->details->getStatus(): ?string // Returns the text status from the bank // For example, `PAID`. $payment->cashier->details->toArray(): array // Returns an array of status. // For example, // // [ // 'status' => 'PAID' // ]