Skip to content

Commit

Permalink
Paypal Standard re-factoring
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Dec 18, 2018
1 parent df5eb71 commit a1756a6
Show file tree
Hide file tree
Showing 26 changed files with 42 additions and 87 deletions.
Empty file.
Empty file.
7 changes: 0 additions & 7 deletions modules/PaypalStandard/Config/config.php

This file was deleted.

Empty file.
Empty file.
Empty file.

This file was deleted.

Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
41 changes: 10 additions & 31 deletions modules/PaypalStandard/Providers/PaypalStandardServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
namespace Modules\PaypalStandard\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Factory;

use App\Events\PaymentGatewayListing;
use Modules\PaypalStandard\Events\Handlers\PaypalStandardGateway;
use Modules\PaypalStandard\Listeners\PaypalStandardGateway;

class PaypalStandardServiceProvider extends ServiceProvider
{
Expand All @@ -25,13 +24,10 @@ class PaypalStandardServiceProvider extends ServiceProvider
public function boot()
{
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->registerFactories();
$this->registerMigrations();

$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');

$this->app['events']->listen(PaymentGatewayListing::class, PaypalStandardGateway::class);
$this->registerEvents();
}

/**
Expand All @@ -44,22 +40,6 @@ public function register()
//
}

/**
* Register config.
*
* @return void
*/
protected function registerConfig()
{
$this->publishes([
__DIR__.'/../Config/config.php' => config_path('paypalstandard.php'),
], 'config');

$this->mergeConfigFrom(
__DIR__.'/../Config/config.php', 'paypalstandard'
);
}

/**
* Register views.
*
Expand Down Expand Up @@ -96,15 +76,14 @@ public function registerTranslations()
}
}

/**
* Register an additional directory of factories.
* @source https://github.com/sebastiaanluca/laravel-resource-flow/blob/develop/src/Modules/ModuleServiceProvider.php#L66
*/
public function registerFactories()
public function registerMigrations()
{
if (! app()->environment('production')) {
app(Factory::class)->load(__DIR__ . '/Database/factories');
}
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
}

public function registerEvents()
{
$this->app['events']->listen(PaymentGatewayListing::class, PaypalStandardGateway::class);
}

/**
Expand Down
Empty file.
Empty file.
21 changes: 21 additions & 0 deletions modules/PaypalStandard/Resources/lang/en-GB/general.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

return [

'title' => 'Paypal Standard',
'paypalstandard' => 'Paypal Standard',

'form' => [
'email' => 'Email',
'mode' => 'Mode',
'debug' => 'Debug',
'transaction' => 'Transaction',
'customer' => 'Show to Customer',
'order' => 'Order',
],

'test_mode' => 'Warning: The payment gateway is in \'Sandbox Mode\'. Your account will not be charged.',
'description' => 'Pay with PAYPAL',
'confirm' => 'Confirm',

];
17 changes: 0 additions & 17 deletions modules/PaypalStandard/Resources/lang/en-GB/paypalstandard.php

This file was deleted.

Empty file.
6 changes: 3 additions & 3 deletions modules/PaypalStandard/Resources/views/show.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<h2>{{ $gateway['name'] }}</h2>

@if($gateway['mode'] == 'sandbox')
<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ trans('paypalstandard::paypalstandard.test_mode') }}</div>
<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ trans('paypalstandard::general.test_mode') }}</div>
@endif

<div class="well well-sm">
{{ trans('paypalstandard::paypalstandard.description') }}
{{ trans('paypalstandard::general.description') }}
</div>

<form action="{{ $gateway['action'] }}" method="post">
Expand Down Expand Up @@ -42,7 +42,7 @@
<input type="hidden" name="bn" value="Akaunting_1.0_WPS" />
<div class="buttons">
<div class="pull-right">
<input type="submit" value="{{ trans('paypalstandard::paypalstandard.confirm') }}" class="btn btn-success" />
<input type="submit" value="{{ trans('paypalstandard::general.confirm') }}" class="btn btn-success" />
</div>
</div>
</form>
Empty file.
16 changes: 8 additions & 8 deletions modules/PaypalStandard/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "PaypalStandard",
"alias": "paypalstandard",
"description": "",
"version": "1.0.0",
"category": "payment-gateways",
"version": "1.0.1",
"category": "payment-gateway",
"keywords": [],
"active": 1,
"order": 0,
Expand All @@ -28,7 +28,7 @@
{
"type": "textGroup",
"name": "email",
"title": "paypalstandard::paypalstandard.email",
"title": "paypalstandard::general.form.email",
"icon": "envelope-o",
"attributes": {
"required": "required"
Expand All @@ -37,7 +37,7 @@
{
"type": "selectGroup",
"name": "mode",
"title": "paypalstandard::paypalstandard.mode",
"title": "paypalstandard::general.form.mode",
"icon": "plane",
"values": {
"live": "Live",
Expand All @@ -49,7 +49,7 @@
{
"type": "selectGroup",
"name": "transaction",
"title": "paypalstandard::paypalstandard.transaction",
"title": "paypalstandard::general.form.transaction",
"icon": "exchange",
"values": {
"authorization": "Authorization",
Expand All @@ -61,23 +61,23 @@
{
"type": "radioGroup",
"name": "customer",
"title": "paypalstandard::paypalstandard.customer",
"title": "paypalstandard::general.form.customer",
"enable": "general.yes",
"disable": "general.no",
"attributes": {}
},
{
"type": "radioGroup",
"name": "debug",
"title": "paypalstandard::paypalstandard.debug",
"title": "paypalstandard::general.form.debug",
"enable": "general.yes",
"disable": "general.no",
"attributes": {}
},
{
"type": "textGroup",
"name": "order",
"title": "paypalstandard::paypalstandard.order",
"title": "paypalstandard::general.form.order",
"icon": "sort",
"attributes": {}
}
Expand Down

0 comments on commit a1756a6

Please sign in to comment.