Skip to content

Commit

Permalink
see changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenefvdm committed Oct 15, 2022
1 parent 138cac3 commit b6f1ea8
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 39 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to `payfast-onsite-subscriptions` will be documented in this file.

## v1.4.1 - 2022-10-15

- Remove illuminate contracts as dependency
- Add normal logging back to webhook controller again
- If testmode variable isn't set it will not fail on merchant_id giving the user a bigger clue as to .env variables that haven't been added
- If the model doesn't have a first name or last name then just use name

## v1.4.0 - 2022-10-13

- Bump Nova minimum to version 4 by adding NovaRequest classes to actions
- Update readme to specify Nova 4
- Fix plural problem with the `Receipt[s]` resource name

## v1.3.0 - 2022-10-12

- Bump PHP to 8.1
Expand Down
3 changes: 2 additions & 1 deletion Nova/Actions/CancelSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Queue\InteractsWithQueue;
use FintechSystems\PayFast\Facades\PayFast;
use Illuminate\Contracts\Queue\ShouldQueue;
use Laravel\Nova\Http\Requests\NovaRequest;

class CancelSubscription extends Action
{
Expand All @@ -35,7 +36,7 @@ public function handle(ActionFields $fields, Collection $models)
*
* @return array
*/
public function fields()
public function fields(NovaRequest $request)
{
return [];
}
Expand Down
3 changes: 2 additions & 1 deletion Nova/Actions/ChangeEndsAt.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Laravel\Nova\Actions\DestructiveAction;
use Laravel\Nova\Http\Requests\NovaRequest;

class ChangeEndsAt extends DestructiveAction
{
Expand All @@ -37,7 +38,7 @@ public function handle(ActionFields $fields, Collection $models)
*
* @return array
*/
public function fields()
public function fields(NovaRequest $request)
{
return [
Date::make('Ends At')
Expand Down
3 changes: 2 additions & 1 deletion Nova/Actions/EnableBilling.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Laravel\Nova\Fields\ActionFields;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Laravel\Nova\Http\Requests\NovaRequest;

class EnableBilling extends Action
{
Expand All @@ -35,7 +36,7 @@ public function handle(ActionFields $fields, Collection $models)
*
* @return array
*/
public function fields()
public function fields(NovaRequest $request)
{
return [];
}
Expand Down
3 changes: 2 additions & 1 deletion Nova/Actions/FetchSubscriptionInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Illuminate\Queue\InteractsWithQueue;
use FintechSystems\PayFast\Facades\PayFast;
use Illuminate\Contracts\Queue\ShouldQueue;
use Laravel\Nova\Http\Requests\NovaRequest;

class FetchSubscriptionInformation extends Action
{
Expand All @@ -37,7 +38,7 @@ public function handle(ActionFields $fields, Collection $models)
*
* @return array
*/
public function fields()
public function fields(NovaRequest $request)
{
return [];
}
Expand Down
3 changes: 2 additions & 1 deletion Nova/Actions/OverridePayFastStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Laravel\Nova\Actions\DestructiveAction;
use Laravel\Nova\Http\Requests\NovaRequest;

class OverridePayFastStatus extends DestructiveAction
{
Expand Down Expand Up @@ -54,7 +55,7 @@ public function handle(ActionFields $fields, Collection $models)
*
* @return array
*/
public function fields()
public function fields(NovaRequest $request)
{
return [
Select::make('Payfast Status')
Expand Down
2 changes: 1 addition & 1 deletion Nova/Receipts.php → Nova/Receipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Laravel\Nova\Fields\DateTime;
use Laravel\Nova\Http\Requests\NovaRequest;

class Receipts extends Resource
class Receipt extends Resource
{
/**
* The model the resource corresponds to.
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ Requirements:

- PHP 8.1
- Laravel 9.x

- A [PayFast Sandbox account](https://sandbox.payfast.co.za/)
- A [PayFast account](https://www.payfast.co.za/registration)

If you want to use Laravel Nova, version 4 is required for the `Subscription` and `Receipt` resources.

## Installation

Install the package via composer:
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
"guzzlehttp/guzzle": "^7.4.5",
"livewire/livewire": "^2.8",
"moneyphp/money": "^4.0",
"spatie/ray": "^1.34",
"illuminate/contracts": "^9.35",
"spatie/ray": "^1.34",
"nunomaduro/collision": "^6.3"
},
"require-dev": {
Expand Down
59 changes: 32 additions & 27 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions resources/views/components/billing.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<!-- Subscriptions -->
<div class="mt-10 sm:mt-0">
@livewire('subscriptions', ['mergeFields' => [
'name_first' => Auth()->user()->first_name,
'name_last' => Auth()->user()->last_name,
'name_first' => Auth()->user()->first_name ?? Auth()->user()->name,
'name_last' => Auth()->user()->last_name ?? Auth()->user()->name,
'item_description' => config('app.name') . " Subscription",
]] )
</div>
Expand Down
5 changes: 4 additions & 1 deletion src/Http/Controllers/WebhookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ class WebhookController extends Controller
*/
public function __invoke(Request $request)
{
ray('Incoming Webhook from PayFast')->blue();
$message = 'Incoming Webhook from PayFast';
Log::info($message);
ray($message)->blue();

$payload = $request->all();

Log::debug($payload);
ray($payload)->green();

if (isset($payload['ping'])) {
Expand Down
2 changes: 1 addition & 1 deletion src/PayFast.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PayFast implements BillingProvider

public function __construct($client)
{
$this->testmode = $client['testmode'];
$this->testmode = $client['testmode'] ?? false;

if ($this->testmode == true) {
$this->merchant_id = $client['merchant_id_test'];
Expand Down

0 comments on commit b6f1ea8

Please sign in to comment.