Merge pull request #684 from cuneytsenturk/paypalstandard-dev

Paypal Standard re-factoring
This commit is contained in:
Cüneyt Şentürk 2018-12-18 13:04:37 +03:00 committed by GitHub
commit dcfa5a6ad1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 42 additions and 87 deletions

View File

@ -1,7 +0,0 @@
<?php
return [
'name' => 'PaypalStandard',
];

View File

@ -1,21 +0,0 @@
<?php
namespace Modules\PaypalStandard\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class PaypalStandardDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
// $this->call("OthersTableSeeder");
}
}

View File

@ -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
{
@ -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();
}
/**
@ -44,22 +40,6 @@ class PaypalStandardServiceProvider extends ServiceProvider
//
}
/**
* 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.
*
@ -96,15 +76,14 @@ class PaypalStandardServiceProvider extends ServiceProvider
}
}
/**
* 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);
}
/**

View File

@ -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',
];

View File

@ -1,17 +0,0 @@
<?php
return [
'paypalstandard' => 'Paypal Standard',
'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',
];

View File

@ -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">
@ -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>

View File

@ -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,
@ -28,7 +28,7 @@
{
"type": "textGroup",
"name": "email",
"title": "paypalstandard::paypalstandard.email",
"title": "paypalstandard::general.form.email",
"icon": "envelope-o",
"attributes": {
"required": "required"
@ -37,7 +37,7 @@
{
"type": "selectGroup",
"name": "mode",
"title": "paypalstandard::paypalstandard.mode",
"title": "paypalstandard::general.form.mode",
"icon": "plane",
"values": {
"live": "Live",
@ -49,7 +49,7 @@
{
"type": "selectGroup",
"name": "transaction",
"title": "paypalstandard::paypalstandard.transaction",
"title": "paypalstandard::general.form.transaction",
"icon": "exchange",
"values": {
"authorization": "Authorization",
@ -61,7 +61,7 @@
{
"type": "radioGroup",
"name": "customer",
"title": "paypalstandard::paypalstandard.customer",
"title": "paypalstandard::general.form.customer",
"enable": "general.yes",
"disable": "general.no",
"attributes": {}
@ -69,7 +69,7 @@
{
"type": "radioGroup",
"name": "debug",
"title": "paypalstandard::paypalstandard.debug",
"title": "paypalstandard::general.form.debug",
"enable": "general.yes",
"disable": "general.no",
"attributes": {}
@ -77,7 +77,7 @@
{
"type": "textGroup",
"name": "order",
"title": "paypalstandard::paypalstandard.order",
"title": "paypalstandard::general.form.order",
"icon": "sort",
"attributes": {}
}