From 5a6b41db0ca393b5c329ee111ebb1ce00ffe707f Mon Sep 17 00:00:00 2001 From: Ali Faraun Date: Wed, 27 Dec 2023 18:44:23 +0200 Subject: [PATCH] added laravel pint --- composer.json | 3 +- composer.lock | 69 ++++++++- src/Events/ApprovedRefundTransaction.php | 1 - src/Events/ApprovedSaleTransaction.php | 1 - src/Events/ApprovedTransaction.php | 1 - src/Events/ApprovedVoidRefundTransaction.php | 1 - src/Events/ApprovedVoidSaleTransaction.php | 1 - src/Events/BaseTransactionEvent.php | 4 - src/Events/DisallowedRequestEvent.php | 2 - src/Events/UnverfiedTransaction.php | 1 - src/Events/VerfiedTransaction.php | 1 - src/Http/Controllers/ConfigController.php | 11 +- .../Controllers/NotificationController.php | 23 ++- src/Http/Middleware/AllowedIps.php | 2 +- .../Requests/GenerateSecureKeyRequest.php | 10 +- src/Models/MoamalatPayNotification.php | 12 +- src/Pay.php | 1 - src/Providers/MoamalatPayProvider.php | 22 ++- src/Refund.php | 57 ++++---- src/Transaction.php | 49 ++++--- src/config/moamalat-pay.php | 113 +++++++------- tests/Feature/ConfigAPITest.php | 37 +++-- tests/Feature/GetTransactionTest.php | 138 +++++++++--------- tests/Feature/NotificationsAPITest.php | 34 ++--- tests/Feature/PayTest.php | 4 +- tests/Feature/RefundTest.php | 86 ++++++----- tests/TestCase.php | 31 ++-- 27 files changed, 372 insertions(+), 343 deletions(-) diff --git a/composer.json b/composer.json index 250a0c9..ae358f4 100644 --- a/composer.json +++ b/composer.json @@ -39,6 +39,7 @@ "nunomaduro/larastan": "^2.4", "guzzlehttp/guzzle": "7.5.x-dev", "nunomaduro/collision": "^7.0", - "laravel/legacy-factories": "1.x-dev" + "laravel/legacy-factories": "1.x-dev", + "laravel/pint": "dev-main" } } diff --git a/composer.lock b/composer.lock index 390f5ac..73746e7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "006fbbb0cb08cc99919678599abaca22", + "content-hash": "e56dcd5b9fa6b0288a684e702087a584", "packages": [ { "name": "brick/math", @@ -5428,6 +5428,73 @@ }, "time": "2023-01-09T14:49:00+00:00" }, + { + "name": "laravel/pint", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/laravel/pint.git", + "reference": "6cfe8bcba370548365eb8f3550d7e75ede4fdeaa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/pint/zipball/6cfe8bcba370548365eb8f3550d7e75ede4fdeaa", + "reference": "6cfe8bcba370548365eb8f3550d7e75ede4fdeaa", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "ext-tokenizer": "*", + "ext-xml": "*", + "php": "^8.1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.38.0", + "illuminate/view": "^10.30.1", + "larastan/larastan": "^2.7.0", + "laravel-zero/framework": "^10.3.0", + "mockery/mockery": "^1.6.6", + "nunomaduro/termwind": "^1.15.1", + "pestphp/pest": "^2.24.2" + }, + "default-branch": true, + "bin": [ + "builds/pint" + ], + "type": "project", + "autoload": { + "psr-4": { + "App\\": "app/", + "Database\\Seeders\\": "database/seeders/", + "Database\\Factories\\": "database/factories/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "An opinionated code formatter for PHP.", + "homepage": "https://laravel.com", + "keywords": [ + "format", + "formatter", + "lint", + "linter", + "php" + ], + "support": { + "issues": "https://github.com/laravel/pint/issues", + "source": "https://github.com/laravel/pint" + }, + "time": "2023-12-08T08:41:24+00:00" + }, { "name": "mockery/mockery", "version": "1.6.x-dev", diff --git a/src/Events/ApprovedRefundTransaction.php b/src/Events/ApprovedRefundTransaction.php index a685340..f102df7 100644 --- a/src/Events/ApprovedRefundTransaction.php +++ b/src/Events/ApprovedRefundTransaction.php @@ -2,7 +2,6 @@ namespace MoamalatPay\Events; - class ApprovedRefundTransaction extends BaseTransactionEvent { // diff --git a/src/Events/ApprovedSaleTransaction.php b/src/Events/ApprovedSaleTransaction.php index 2880688..71162a9 100644 --- a/src/Events/ApprovedSaleTransaction.php +++ b/src/Events/ApprovedSaleTransaction.php @@ -2,7 +2,6 @@ namespace MoamalatPay\Events; - class ApprovedSaleTransaction extends BaseTransactionEvent { // diff --git a/src/Events/ApprovedTransaction.php b/src/Events/ApprovedTransaction.php index 9f33883..1a5ad0e 100644 --- a/src/Events/ApprovedTransaction.php +++ b/src/Events/ApprovedTransaction.php @@ -2,7 +2,6 @@ namespace MoamalatPay\Events; - class ApprovedTransaction extends BaseTransactionEvent { // diff --git a/src/Events/ApprovedVoidRefundTransaction.php b/src/Events/ApprovedVoidRefundTransaction.php index 9504279..833d6a0 100644 --- a/src/Events/ApprovedVoidRefundTransaction.php +++ b/src/Events/ApprovedVoidRefundTransaction.php @@ -2,7 +2,6 @@ namespace MoamalatPay\Events; - class ApprovedVoidRefundTransaction extends BaseTransactionEvent { // diff --git a/src/Events/ApprovedVoidSaleTransaction.php b/src/Events/ApprovedVoidSaleTransaction.php index 608e34c..8c7a725 100644 --- a/src/Events/ApprovedVoidSaleTransaction.php +++ b/src/Events/ApprovedVoidSaleTransaction.php @@ -2,7 +2,6 @@ namespace MoamalatPay\Events; - class ApprovedVoidSaleTransaction extends BaseTransactionEvent { // diff --git a/src/Events/BaseTransactionEvent.php b/src/Events/BaseTransactionEvent.php index d92028f..39affb2 100644 --- a/src/Events/BaseTransactionEvent.php +++ b/src/Events/BaseTransactionEvent.php @@ -12,8 +12,6 @@ abstract class BaseTransactionEvent { use Dispatchable, InteractsWithSockets, SerializesModels; - - /** * The notification instance. * @@ -21,11 +19,9 @@ abstract class BaseTransactionEvent */ public $notification; - /** * Create a new event instance. * - * @param MoamalatPayNotification $notification * @return void */ public function __construct(MoamalatPayNotification $notification) diff --git a/src/Events/DisallowedRequestEvent.php b/src/Events/DisallowedRequestEvent.php index 6cbbd88..afe462c 100644 --- a/src/Events/DisallowedRequestEvent.php +++ b/src/Events/DisallowedRequestEvent.php @@ -3,12 +3,10 @@ namespace MoamalatPay\Events; use Illuminate\Broadcasting\InteractsWithSockets; -use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; class DisallowedRequestEvent { - use Dispatchable, InteractsWithSockets, SerializesModels; } diff --git a/src/Events/UnverfiedTransaction.php b/src/Events/UnverfiedTransaction.php index f23b6cb..1d08bd3 100644 --- a/src/Events/UnverfiedTransaction.php +++ b/src/Events/UnverfiedTransaction.php @@ -2,7 +2,6 @@ namespace MoamalatPay\Events; - class UnverfiedTransaction extends BaseTransactionEvent { // diff --git a/src/Events/VerfiedTransaction.php b/src/Events/VerfiedTransaction.php index e714187..9d391c5 100644 --- a/src/Events/VerfiedTransaction.php +++ b/src/Events/VerfiedTransaction.php @@ -2,7 +2,6 @@ namespace MoamalatPay\Events; - class VerfiedTransaction extends BaseTransactionEvent { // diff --git a/src/Http/Controllers/ConfigController.php b/src/Http/Controllers/ConfigController.php index c7ab4c5..4b7c335 100644 --- a/src/Http/Controllers/ConfigController.php +++ b/src/Http/Controllers/ConfigController.php @@ -8,14 +8,11 @@ /** * Class ConfigController */ - class ConfigController extends BaseController { - /** * Genearte SecureHash for use in payment transaction * - * @param GenerateSecureKeyRequest $request * @return \Illuminate\Http\JsonResponse */ public function generateSecureKey(GenerateSecureKeyRequest $request) @@ -24,13 +21,13 @@ public function generateSecureKey(GenerateSecureKeyRequest $request) $MerchantId = config('moamalat-pay.merchant_id'); $amount = $request->amount; $merchantReference = $request->merchantReference; - $key = pack("H*", config('moamalat-pay.key')); - $DateTimeLocalTrxn = time(); + $key = pack('H*', config('moamalat-pay.key')); + $DateTimeLocalTrxn = time(); $encode_data = "Amount={$amount}&DateTimeLocalTrxn={$DateTimeLocalTrxn}&MerchantId={$MerchantId}&MerchantReference={$merchantReference}&TerminalId={$TerminalId}"; return response()->json([ - 'secureHash' => hash_hmac('sha256', $encode_data, $key), - 'DateTimeLocalTrxn' => $DateTimeLocalTrxn + 'secureHash' => hash_hmac('sha256', $encode_data, $key), + 'DateTimeLocalTrxn' => $DateTimeLocalTrxn, ]); } } diff --git a/src/Http/Controllers/NotificationController.php b/src/Http/Controllers/NotificationController.php index 533138c..a32dd32 100644 --- a/src/Http/Controllers/NotificationController.php +++ b/src/Http/Controllers/NotificationController.php @@ -2,22 +2,21 @@ namespace MoamalatPay\Http\Controllers; +use Exception; use Illuminate\Http\Request; use Illuminate\Routing\Controller as BaseController; -use Exception; -use MoamalatPay\Events\UnverfiedTransaction; -use MoamalatPay\Events\VerfiedTransaction; -use MoamalatPay\Events\ApprovedTransaction; -use MoamalatPay\Events\ApprovedSaleTransaction; use MoamalatPay\Events\ApprovedRefundTransaction; -use MoamalatPay\Events\ApprovedVoidSaleTransaction; +use MoamalatPay\Events\ApprovedSaleTransaction; +use MoamalatPay\Events\ApprovedTransaction; use MoamalatPay\Events\ApprovedVoidRefundTransaction; +use MoamalatPay\Events\ApprovedVoidSaleTransaction; +use MoamalatPay\Events\UnverfiedTransaction; +use MoamalatPay\Events\VerfiedTransaction; use MoamalatPay\Models\MoamalatPayNotification; /** * Class NotificationController */ - class NotificationController extends BaseController { public function store(Request $request) @@ -39,7 +38,6 @@ public function store(Request $request) 'ActionCode' => 'nullable', ]); - $data['ip'] = $request->ip(); $data['request'] = json_encode($request->all()); $data['verified'] = $this->validateSecureHas( @@ -51,18 +49,18 @@ public function store(Request $request) $request->input('TerminalId') ); - $notification = MoamalatPayNotification::create($data); + $notification = MoamalatPayNotification::create($data); $this->dispatchEvents($notification); - return response()->json(["Message" => 'Success', 'Success' => true]); + return response()->json(['Message' => 'Success', 'Success' => true]); } protected function dispatchEvents(MoamalatPayNotification $notification) { if ($notification->verified) { VerfiedTransaction::dispatch($notification); - if (/* $notification->Message == 'Approved' && */$notification->ActionCode === '00') { // aproved + if (/* $notification->Message == 'Approved' && */ $notification->ActionCode === '00') { // aproved ApprovedTransaction::dispatch($notification); switch ($notification->TxnType) { case '1': @@ -91,7 +89,8 @@ protected function validateSecureHas($secureHash, $Amount, $Currency, $DateTimeL { try { $encode_data = "Amount=$Amount&Currency=$Currency&DateTimeLocalTrxn=$DateTimeLocalTrxn&MerchantId=$MerchantId&TerminalId=$TerminalId"; - $key = pack("H*", config('moamalat-pay.notification.key')); + $key = pack('H*', config('moamalat-pay.notification.key')); + return strtoupper(hash_hmac('sha256', $encode_data, $key)) === strtoupper($secureHash); } catch (Exception $e) { return false; diff --git a/src/Http/Middleware/AllowedIps.php b/src/Http/Middleware/AllowedIps.php index f982ea2..e9f9c1a 100644 --- a/src/Http/Middleware/AllowedIps.php +++ b/src/Http/Middleware/AllowedIps.php @@ -16,7 +16,7 @@ class AllowedIps public function handle($request, Closure $next) { $allowed = config('moamalat-pay.notification.allowed_ips'); - if (!in_array('*', $allowed) && !in_array($request->ip(), $allowed)) { + if (! in_array('*', $allowed) && ! in_array($request->ip(), $allowed)) { DisallowedRequestEvent::dispatch(); abort(403); } diff --git a/src/Http/Requests/GenerateSecureKeyRequest.php b/src/Http/Requests/GenerateSecureKeyRequest.php index 788b181..1ce3e70 100644 --- a/src/Http/Requests/GenerateSecureKeyRequest.php +++ b/src/Http/Requests/GenerateSecureKeyRequest.php @@ -15,8 +15,8 @@ class GenerateSecureKeyRequest extends FormRequest public function rules(): array { return [ - "MID" => "required", - "TID" => "required", + 'MID' => 'required', + 'TID' => 'required', 'amount' => 'required|integer|min:1', 'merchantReference' => 'nullable', ]; @@ -30,14 +30,14 @@ public function after(): array return [ function (Validator $validator) { - if (!$validator->errors()->has('MID') && $this->MID != config('moamalat-pay.merchant_id')) { + if (! $validator->errors()->has('MID') && $this->MID != config('moamalat-pay.merchant_id')) { $validator->errors()->add('MID', 'The MID is incorrect'); } - if (!$validator->errors()->has('TID') && $this->TID != config('moamalat-pay.terminal_id')) { + if (! $validator->errors()->has('TID') && $this->TID != config('moamalat-pay.terminal_id')) { $validator->errors()->add('TID', 'The TID is incorrect'); } - } + }, ]; } diff --git a/src/Models/MoamalatPayNotification.php b/src/Models/MoamalatPayNotification.php index cd4bb2f..a5640d8 100644 --- a/src/Models/MoamalatPayNotification.php +++ b/src/Models/MoamalatPayNotification.php @@ -4,13 +4,12 @@ use Illuminate\Database\Eloquent\Model; - /** * Class MoamalatPayNotification - * @package MoamalatPay\Models + * * @version Sep 17, 2022, 5:12 pm UTC * - * @property integer $id + * @property int $id * @property string $MerchantId * @property string $TerminalId * @property string $DateTimeLocalTrxn @@ -26,12 +25,11 @@ * @property string $PayerName * @property string $ActionCode * @property string $request - * @property boolean $verified + * @property bool $verified * @property string $ip */ class MoamalatPayNotification extends Model { - public $fillable = [ 'MerchantId', 'TerminalId', @@ -49,7 +47,7 @@ class MoamalatPayNotification extends Model 'ActionCode', 'request', 'verified', - 'ip' + 'ip', ]; protected $casts = [ @@ -81,8 +79,6 @@ public function getTable() return config('moamalat-pay.notification.table', parent::getTable()); } - - /** * Scope a query to only include approved transactions. * diff --git a/src/Pay.php b/src/Pay.php index 6125387..e029fe5 100644 --- a/src/Pay.php +++ b/src/Pay.php @@ -4,7 +4,6 @@ class Pay { - public function init() { return view('moamalat-pay::pay')->render(); diff --git a/src/Providers/MoamalatPayProvider.php b/src/Providers/MoamalatPayProvider.php index 5257c46..4dd5ae7 100644 --- a/src/Providers/MoamalatPayProvider.php +++ b/src/Providers/MoamalatPayProvider.php @@ -2,13 +2,13 @@ namespace MoamalatPay\Providers; -use Illuminate\Support\ServiceProvider; -use Illuminate\Support\Facades\Blade; -use MoamalatPay\Pay; -use MoamalatPay\View\Components\Pay as PayComponent; use Illuminate\Routing\Router; +use Illuminate\Support\Facades\Blade; +use Illuminate\Support\ServiceProvider; use MoamalatPay\Http\Middleware\AllowedIps; +use MoamalatPay\Pay; use MoamalatPay\Refund; +use MoamalatPay\View\Components\Pay as PayComponent; class MoamalatPayProvider extends ServiceProvider { @@ -19,17 +19,16 @@ class MoamalatPayProvider extends ServiceProvider */ public function boot() { - $this->loadViewsFrom(__DIR__ . '/../views', 'moamalat-pay'); - $this->loadRoutesFrom(__DIR__ . '/../routes/api.php'); - $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); - $this->loadFactoriesFrom(__DIR__ . '/../database/factories'); + $this->loadViewsFrom(__DIR__.'/../views', 'moamalat-pay'); + $this->loadRoutesFrom(__DIR__.'/../routes/api.php'); + $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); + $this->loadFactoriesFrom(__DIR__.'/../database/factories'); Blade::component('moamalat-pay', PayComponent::class); $router = $this->app->make(Router::class); $router->aliasMiddleware('moamalat-allowed-ips', AllowedIps::class); } - /** * Register any application services. * @@ -38,11 +37,10 @@ public function boot() public function register() { $this->publishes([ - __DIR__ . '/../config/moamalat-pay.php' => config_path('moamalat-pay.php'), + __DIR__.'/../config/moamalat-pay.php' => config_path('moamalat-pay.php'), ], 'moamalat-pay'); - $this->mergeConfigFrom(__DIR__ . '/../config/moamalat-pay.php', 'moamalat-pay'); - + $this->mergeConfigFrom(__DIR__.'/../config/moamalat-pay.php', 'moamalat-pay'); $this->app->singleton('moamalat-pay', function ($app) { return new Pay(); diff --git a/src/Refund.php b/src/Refund.php index 566423f..1f0d0da 100644 --- a/src/Refund.php +++ b/src/Refund.php @@ -7,32 +7,34 @@ class Refund { - /** * Response + * * @var array */ private $response; /** * Terminad ID - * @var string|integer + * + * @var string|int */ private $terminal_id; /** * Merchant ID - * @var string|integer + * + * @var string|int */ private $merchant_id; /** * Secure Key + * * @var string */ private $key; - /** * Create a new refund instance. * @@ -42,70 +44,75 @@ public function __construct() { $this->terminal_id = config('moamalat-pay.terminal_id'); $this->merchant_id = config('moamalat-pay.merchant_id'); - $this->key = pack("H*", config(('moamalat-pay.key'))); + $this->key = pack('H*', config(('moamalat-pay.key'))); } /** * Refund transaction - * @param array $extra + * + * @param array $extra * @return mixed */ protected function refund($extra) { - $DateTimeLocalTrxn = time(); + $DateTimeLocalTrxn = time(); $encode_data = "DateTimeLocalTrxn={$DateTimeLocalTrxn}&MerchantId={$this->merchant_id}&TerminalId={$this->terminal_id}"; if (config('moamalat-pay.production')) { - $url = "https://npg.moamalat.net/cube/paylink.svc/api/RefundTransaction"; + $url = 'https://npg.moamalat.net/cube/paylink.svc/api/RefundTransaction'; } else { - $url = "https://tnpg.moamalat.net/cube/paylink.svc/api/RefundTransaction"; + $url = 'https://tnpg.moamalat.net/cube/paylink.svc/api/RefundTransaction'; } $response = Http::post($url, array_merge([ - "TerminalId" => $this->terminal_id, - "MerchantId" => $this->merchant_id, - "DateTimeLocalTrxn" => $DateTimeLocalTrxn, - "SecureHash" => hash_hmac('sha256', $encode_data, $this->key), + 'TerminalId' => $this->terminal_id, + 'MerchantId' => $this->merchant_id, + 'DateTimeLocalTrxn' => $DateTimeLocalTrxn, + 'SecureHash' => hash_hmac('sha256', $encode_data, $this->key), ], $extra)); - if ($response->status() != 200 || $response["Success"] != true) { - throw new Exception($response->offsetGet("Message")); + if ($response->status() != 200 || $response['Success'] != true) { + throw new Exception($response->offsetGet('Message')); } $this->response = $response->json(); + return $this; } /** * Refund transaction by system reference of transaction - * @param string|integer $systemReference - * @param string|integer $amount + * + * @param string|int $systemReference + * @param string|int $amount * @return $this */ public function refundBySystemReference($systemReference, $amount) { return $this->refund([ 'SystemReference' => $systemReference, - 'AmountTrxn' => $amount + 'AmountTrxn' => $amount, ]); } /** * Refund transaction by network reference of transaction - * @param string|integer $networkReference - * @param string|integer $amount + * + * @param string|int $networkReference + * @param string|int $amount * @return $this */ public function refundByNetworkReference($networkReference, $amount) { return $this->refund([ 'NetworkReference' => $networkReference, - 'AmountTrxn' => $amount + 'AmountTrxn' => $amount, ]); } /** * Get all properties of reponse + * * @return array */ public function getAll() @@ -115,6 +122,7 @@ public function getAll() /** * Get property of transaction + * * @param $property key * @return mixed */ @@ -126,8 +134,6 @@ public function get($property) /** * Get property of reponse , if property not exists return default value * - * @param $property - * @param $default * @return mixed */ public function getWithDefault($property, $default = null) @@ -135,13 +141,14 @@ public function getWithDefault($property, $default = null) if (array_key_exists($property, $this->response)) { return $this->response[$property]; } + return $default; } - /** * Get SystemReference of new refund transaction - * @return string|integer + * + * @return string|int */ public function getRefNumber() { diff --git a/src/Transaction.php b/src/Transaction.php index 7b8b39d..8910968 100644 --- a/src/Transaction.php +++ b/src/Transaction.php @@ -7,17 +7,17 @@ class Transaction { - /** * Response + * * @var \Illuminate\Http\Client\Response */ private $response; - /** * Transaction properties - * @var Array + * + * @var array */ private $data; @@ -32,29 +32,29 @@ public function __construct($networkReference, $merchantReference) { $TerminalId = config('moamalat-pay.terminal_id'); $MerchantId = config('moamalat-pay.merchant_id'); - $key = pack("H*", config(('moamalat-pay.key'))); - $DateTimeLocalTrxn = time(); + $key = pack('H*', config(('moamalat-pay.key'))); + $DateTimeLocalTrxn = time(); $encode_data = "DateTimeLocalTrxn={$DateTimeLocalTrxn}&MerchantId={$MerchantId}&TerminalId={$TerminalId}"; if (config('moamalat-pay.production')) { - $url = "https://npg.moamalat.net/cube/paylink.svc/api/FilterTransactions"; + $url = 'https://npg.moamalat.net/cube/paylink.svc/api/FilterTransactions'; } else { - $url = "https://tnpg.moamalat.net/cube/paylink.svc/api/FilterTransactions"; + $url = 'https://tnpg.moamalat.net/cube/paylink.svc/api/FilterTransactions'; } $response = Http::post($url, [ - "NetworkReference" => $networkReference, - "MerchantReference" => $merchantReference, - "TerminalId" => $TerminalId, - "MerchantId" => $MerchantId, - "DisplayLength" => 1, - "DisplayStart" => 0, - "DateTimeLocalTrxn" => $DateTimeLocalTrxn, - "SecureHash" => hash_hmac('sha256', $encode_data, $key), + 'NetworkReference' => $networkReference, + 'MerchantReference' => $merchantReference, + 'TerminalId' => $TerminalId, + 'MerchantId' => $MerchantId, + 'DisplayLength' => 1, + 'DisplayStart' => 0, + 'DateTimeLocalTrxn' => $DateTimeLocalTrxn, + 'SecureHash' => hash_hmac('sha256', $encode_data, $key), ]); - if ($response->status() != 200 || $response["TotalCountAllTransaction"] != 1) { - throw new Exception($response->offsetGet("Message")); + if ($response->status() != 200 || $response['TotalCountAllTransaction'] != 1) { + throw new Exception($response->offsetGet('Message')); } $this->response = $response->json(); @@ -63,7 +63,8 @@ public function __construct($networkReference, $merchantReference) /** * Get all properties of transaction - * @return Array + * + * @return array */ public function getAll() { @@ -72,6 +73,7 @@ public function getAll() /** * Get property of transaction + * * @param $property key * @return mixed */ @@ -83,8 +85,6 @@ public function get($property) /** * Get property of reponse , if property not exists return default value * - * @param $property - * @param $default * @return mixed */ public function getWithDefault($property, $default = null) @@ -92,11 +92,13 @@ public function getWithDefault($property, $default = null) if (array_key_exists($property, $this->data)) { return $this->data[$property]; } + return $default; } /** * Get all properties of reponse + * * @return \Illuminate\Http\Client\Response */ public function getResponse() @@ -107,9 +109,7 @@ public function getResponse() /** * Check status of transaction is Approved * - * @param $amount - * @param $card - * @return boolean + * @return bool */ public function checkApproved($amount = null, $card = null) { @@ -118,8 +118,9 @@ public function checkApproved($amount = null, $card = null) $result = /* $result && */ $this->data['AmountTrxn'] == $amount; } if ($card != null) { - $result = $result && $this->data['CardNo'] == $card; + $result = $result && $this->data['CardNo'] == $card; } + return $result && $this->data['Status'] == 'Approved'; } } diff --git a/src/config/moamalat-pay.php b/src/config/moamalat-pay.php index 51b0cb2..a6b21cd 100644 --- a/src/config/moamalat-pay.php +++ b/src/config/moamalat-pay.php @@ -2,13 +2,13 @@ return [ /* - |-------------------------------------------------------------------------- - | Moamalat Payment Gateway Config - |-------------------------------------------------------------------------- - | - | These options to set your configurations of muamalat - | - */ + |-------------------------------------------------------------------------- + | Moamalat Payment Gateway Config + |-------------------------------------------------------------------------- + | + | These options to set your configurations of muamalat + | + */ // MID => merchant_id or outlet_number 'merchant_id' => env('MOAMALATPAY_MID'), @@ -19,73 +19,70 @@ // Secure key 'key' => env('MOAMALATPAY_KEY'), - /* - |-------------------------------------------------------------------------- - | Production - |-------------------------------------------------------------------------- - | - | If the production is set to "true", you will work on production environment + |-------------------------------------------------------------------------- + | Production + |-------------------------------------------------------------------------- + | + | If the production is set to "true", you will work on production environment | otherwise it will use testing environment - | - */ + | + */ 'production' => env('MOAMALATPAY_PRODUCTION', false), /* - |-------------------------------------------------------------------------- - | Show - |-------------------------------------------------------------------------- - | - | If the show_logs is set to "true", you will see configurations + |-------------------------------------------------------------------------- + | Show + |-------------------------------------------------------------------------- + | + | If the show_logs is set to "true", you will see configurations | and response of requests in browser console - | - */ + | + */ 'show_logs' => false, - /* - |-------------------------------------------------------------------------- - | Generate Secure Hash api - |-------------------------------------------------------------------------- - | - | This is service (api) to generate secureHash to be used in pay in Lightbox. - | - | url is route of api of generate secureHash - | - | route_name is name of route of api of generate secureHash - | - */ + |-------------------------------------------------------------------------- + | Generate Secure Hash api + |-------------------------------------------------------------------------- + | + | This is service (api) to generate secureHash to be used in pay in Lightbox. + | + | url is route of api of generate secureHash + | + | route_name is name of route of api of generate secureHash + | + */ 'generate-securekey' => [ - 'url' => 'moamalat-pay/securekey', - 'route_name' => 'moamalat_pay.generate_securekey', + 'url' => 'moamalat-pay/securekey', + 'route_name' => 'moamalat_pay.generate_securekey', ], - /* - |-------------------------------------------------------------------------- - | Notification (Webhook) api - |-------------------------------------------------------------------------- - | - | This is service from moamalat on any transaction you will receive notification - | on api (webhook) - | - | key is your private notification key to use it in validate transaction requests - | - | url is route to receive notification - | - | table is name of table that will be used to save notifications - | - | allowed_ips are ips that will receive notification from them - | ['*'] means receive from any ip but it is not secure to receive notifcations from anyone - | you should ask moamalat on ips of their servers and use them - | - */ + |-------------------------------------------------------------------------- + | Notification (Webhook) api + |-------------------------------------------------------------------------- + | + | This is service from moamalat on any transaction you will receive notification + | on api (webhook) + | + | key is your private notification key to use it in validate transaction requests + | + | url is route to receive notification + | + | table is name of table that will be used to save notifications + | + | allowed_ips are ips that will receive notification from them + | ['*'] means receive from any ip but it is not secure to receive notifcations from anyone + | you should ask moamalat on ips of their servers and use them + | + */ 'notification' => [ 'key' => env('MOAMALATPAY_NOTIFICATION_KEY'), - 'url' => 'moamalat-pay/notify', - 'route_name' => 'moamalat_pay.notification', + 'url' => 'moamalat-pay/notify', + 'route_name' => 'moamalat_pay.notification', 'table' => 'moamalat_pay_notifications', 'allowed_ips' => ['*'], - ] + ], ]; diff --git a/tests/Feature/ConfigAPITest.php b/tests/Feature/ConfigAPITest.php index c475144..998308d 100644 --- a/tests/Feature/ConfigAPITest.php +++ b/tests/Feature/ConfigAPITest.php @@ -2,12 +2,10 @@ namespace MoamalatPay\Tests\Feature; - use MoamalatPay\Tests\TestCase; class ConfigAPITest extends TestCase { - /** * Test that the Moamalat Pay config values are loaded. * @@ -47,22 +45,21 @@ public function test_generate_secure_key_validation() $this->getJson(route(config('moamalat-pay.generate-securekey.route_name'))) ->assertUnprocessable() ->assertJson([ - "message" => "The MID field is required. (and 2 more errors)", - "errors" => [ - "MID" => [ - "The MID field is required." + 'message' => 'The MID field is required. (and 2 more errors)', + 'errors' => [ + 'MID' => [ + 'The MID field is required.', ], - "TID" => [ - "The TID field is required." + 'TID' => [ + 'The TID field is required.', ], - "amount" => [ - "The amount field is required." - ] - ] + 'amount' => [ + 'The amount field is required.', + ], + ], ], true); } - /** * Test generating a secure key with incorrect merchant/terminal IDs. * @@ -79,15 +76,15 @@ public function test_generate_secure_key_with_incrorrect_configurations() $this->getJson(route(config('moamalat-pay.generate-securekey.route_name'), $params)) ->assertUnprocessable() ->assertJson([ - "message" => "The MID is incorrect (and 1 more error)", - "errors" => [ - "MID" => [ - "The MID is incorrect" + 'message' => 'The MID is incorrect (and 1 more error)', + 'errors' => [ + 'MID' => [ + 'The MID is incorrect', ], - "TID" => [ - "The TID is incorrect" + 'TID' => [ + 'The TID is incorrect', ], - ] + ], ], true); } } diff --git a/tests/Feature/GetTransactionTest.php b/tests/Feature/GetTransactionTest.php index b72933e..3ae18ff 100644 --- a/tests/Feature/GetTransactionTest.php +++ b/tests/Feature/GetTransactionTest.php @@ -9,10 +9,8 @@ class GetTransactionTest extends TestCase { - protected $transaction; - public function setUp(): void { parent::setUp(); @@ -20,57 +18,57 @@ public function setUp(): void // response of success requests $respone = [ - "Message" => null, - "Success" => true, - "TotalAmountAllTransaction" => 1000, - "TotalAmountTipsTransaction" => 0, - "TotalCountAllTransaction" => 1, - "Transactions" => [ + 'Message' => null, + 'Success' => true, + 'TotalAmountAllTransaction' => 1000, + 'TotalAmountTipsTransaction' => 0, + 'TotalCountAllTransaction' => 1, + 'Transactions' => [ [ - "Date" => "03/09/2022", - "DateTotalAmount" => "1000", - "DateTransactions" => [ + 'Date' => '03/09/2022', + 'DateTotalAmount' => '1000', + 'DateTransactions' => [ [ - "Amnt" => "1000", - "AmountTrxn" => "1000", - "AuthCode" => null, - "CardNo" => "639499XXXXXX2740", - "CardType" => "", - "Currency" => "LYD", - "ExternalTxnId" => null, - "FeeAmnt" => "0", - "HasToken" => true, - "ISForceSendCVCForRefund" => true, - "IsMustVoidTotalAmount" => false, - "IsPointTrasnaction" => false, - "IsRefund" => false, - "IsRefundEnabled" => true, - "IsSend" => false, - "MerchantReference" => "475217323", - "MobileNumber" => null, - "OriginalTxnId" => "", - "RRN" => "224601434990", - "ReceiptNo" => "224601434990", - "RefundButton" => 0, - "RefundReason" => "", - "RefundSource" => "", - "RefundUserCreator" => "", - "RelatedTxnTotalAmount" => null, - "RemainingRefundAmount" => "1000", - "ResCodeDesc" => "Approved", - "STAN" => "434990", - "SenderName" => "MS", - "Status" => "Approved", - "TipAmnt" => "0", - "TransType" => "Sale", - "TransactionChannel" => "Card", - "TransactionId" => "1233317", - "TxnDateTime" => "03/09/22 01:44", - "TxnIcon" => 2 - ] - ] - ] - ] + 'Amnt' => '1000', + 'AmountTrxn' => '1000', + 'AuthCode' => null, + 'CardNo' => '639499XXXXXX2740', + 'CardType' => '', + 'Currency' => 'LYD', + 'ExternalTxnId' => null, + 'FeeAmnt' => '0', + 'HasToken' => true, + 'ISForceSendCVCForRefund' => true, + 'IsMustVoidTotalAmount' => false, + 'IsPointTrasnaction' => false, + 'IsRefund' => false, + 'IsRefundEnabled' => true, + 'IsSend' => false, + 'MerchantReference' => '475217323', + 'MobileNumber' => null, + 'OriginalTxnId' => '', + 'RRN' => '224601434990', + 'ReceiptNo' => '224601434990', + 'RefundButton' => 0, + 'RefundReason' => '', + 'RefundSource' => '', + 'RefundUserCreator' => '', + 'RelatedTxnTotalAmount' => null, + 'RemainingRefundAmount' => '1000', + 'ResCodeDesc' => 'Approved', + 'STAN' => '434990', + 'SenderName' => 'MS', + 'Status' => 'Approved', + 'TipAmnt' => '0', + 'TransType' => 'Sale', + 'TransactionChannel' => 'Card', + 'TransactionId' => '1233317', + 'TxnDateTime' => '03/09/22 01:44', + 'TxnIcon' => 2, + ], + ], + ], + ], ]; @@ -80,26 +78,27 @@ public function setUp(): void 'https://tnpg.moamalat.net/cube/paylink.svc/api/FilterTransactions' => function ($r) use ($respone) { if ($r->offsetGet('MerchantId') == 'testing_authentication_failed') { // response for testing authentication failed return Http::response([ - "Message" => "Authentication failed.", - "StackTrace" => null, - "ExceptionType" => "System.InvalidOperationException" + 'Message' => 'Authentication failed.', + 'StackTrace' => null, + 'ExceptionType' => 'System.InvalidOperationException', ], 401); } if ($r->offsetGet('NetworkReference') == 'testing_not_found') { // response for testing transaction not found return Http::response([ - "Message" => "Transaction not found", - "Success" => true, - "TotalAmountAllTransaction" => 0, - "TotalAmountTipsTransaction" => null, - "TotalCountAllTransaction" => 0, - "Transactions" => [] + 'Message' => 'Transaction not found', + 'Success' => true, + 'TotalAmountAllTransaction' => 0, + 'TotalAmountTipsTransaction' => null, + 'TotalCountAllTransaction' => 0, + 'Transactions' => [], ]); } + return $respone; // response for testing success request }, ]); - $this->transaction = new Transaction("224601434990", "475217323"); + $this->transaction = new Transaction('224601434990', '475217323'); } /** @@ -108,7 +107,7 @@ public function setUp(): void public function test_transaction_not_found() { $this->expectExceptionMessage('Transaction not found'); - new Transaction("testing_not_found", "475217323"); + new Transaction('testing_not_found', '475217323'); } /** @@ -118,7 +117,7 @@ public function test_authentication_failed() { $this->expectExceptionMessage('Authentication failed.'); Config::set('moamalat-pay.merchant_id', 'testing_authentication_failed'); - new Transaction("224601434990", "475217323"); + new Transaction('224601434990', '475217323'); } /** @@ -150,7 +149,6 @@ public function test_check_approved() $this->assertNotTrue($this->transaction->checkApproved(2000, '639499XXXXXX2740')); } - /** * Test config. */ @@ -194,7 +192,7 @@ public function test_get_all() 'TxnDateTime', 'TxnIcon', ]; - $this->assertEquals($keys, array_keys($this->transaction->getAll()), "Keys are not equal"); + $this->assertEquals($keys, array_keys($this->transaction->getAll()), 'Keys are not equal'); } /** @@ -203,11 +201,11 @@ public function test_get_all() public function test_get_response() { $expected = [ - 'Message' => null, - 'Success' => true, - 'TotalAmountAllTransaction' => 1000, - 'TotalAmountTipsTransaction' => 0, - 'TotalCountAllTransaction' => 1 + 'Message' => null, + 'Success' => true, + 'TotalAmountAllTransaction' => 1000, + 'TotalAmountTipsTransaction' => 0, + 'TotalCountAllTransaction' => 1, ]; $actual = $this->transaction->getResponse(); unset($actual['Transactions']); diff --git a/tests/Feature/NotificationsAPITest.php b/tests/Feature/NotificationsAPITest.php index 0554eaa..7489db6 100644 --- a/tests/Feature/NotificationsAPITest.php +++ b/tests/Feature/NotificationsAPITest.php @@ -2,7 +2,6 @@ namespace MoamalatPay\Tests\Feature; - use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Event; @@ -20,7 +19,6 @@ class NotificationsAPITest extends TestCase { use RefreshDatabase; - /** * Test config. */ @@ -34,13 +32,12 @@ public function test_config_loaded() $this->assertNotNull(config('moamalat-pay.notification.key')); } - /** * Initialize base notifications api testing * - * @param array $dispatched events should dispatched - * @param array $notdispatched events should not dispatched - * @param array $extraData override or add extra properties to transaction + * @param array $dispatched events should dispatched + * @param array $notdispatched events should not dispatched + * @param array $extraData override or add extra properties to transaction * @return void */ public function init_test_api_notifications_transaction($dispatched, $notdispatched, $extraData = []) @@ -48,7 +45,7 @@ public function init_test_api_notifications_transaction($dispatched, $notdispatc Event::fake(); // load request from json to array - $data = json_decode(file_get_contents(__DIR__ . './../_fixtures/transactions/verfied.json'), true); + $data = json_decode(file_get_contents(__DIR__.'./../_fixtures/transactions/verfied.json'), true); $body = array_merge($data, $extraData); // call api notificaitons @@ -56,7 +53,7 @@ public function init_test_api_notifications_transaction($dispatched, $notdispatc //There is issuse with $this->postJson it sends body empty , that is why I use $this->withHeaders $this->withHeaders([])->post(route(config('moamalat-pay.notification.route_name')), $body) ->assertStatus(200) - ->assertJson(["Message" => 'Success', 'Success' => true]); + ->assertJson(['Message' => 'Success', 'Success' => true]); // assert dispatched events foreach ($dispatched as $e) { @@ -72,7 +69,6 @@ public function init_test_api_notifications_transaction($dispatched, $notdispatc $this->assertDatabaseCount(config('moamalat-pay.notification.table'), 1); } - /** * Test approved transaction notification */ @@ -89,12 +85,11 @@ public function test_api_notifications_approved_transaction() ApprovedVoidSaleTransaction::class, ApprovedVoidRefundTransaction::class, UnverfiedTransaction::class, - DisallowedRequestEvent::class + DisallowedRequestEvent::class, ] ); } - /** * Test approved refund transaction notification */ @@ -111,15 +106,14 @@ public function test_api_notifications_approved_refund_transaction() ApprovedVoidSaleTransaction::class, ApprovedVoidRefundTransaction::class, UnverfiedTransaction::class, - DisallowedRequestEvent::class + DisallowedRequestEvent::class, ], [ - 'TxnType' => 2 + 'TxnType' => 2, ] ); } - /** * Test approved void sale transaction notification */ @@ -136,15 +130,14 @@ public function test_api_notifications_approved_void_sale_transaction() ApprovedRefundTransaction::class, ApprovedVoidRefundTransaction::class, UnverfiedTransaction::class, - DisallowedRequestEvent::class + DisallowedRequestEvent::class, ], [ - 'TxnType' => 3 + 'TxnType' => 3, ] ); } - /** * Test approved void refund transaction notification */ @@ -161,16 +154,14 @@ public function test_api_notifications_approved_void_refund_transaction() ApprovedRefundTransaction::class, ApprovedVoidSaleTransaction::class, UnverfiedTransaction::class, - DisallowedRequestEvent::class + DisallowedRequestEvent::class, ], [ - 'TxnType' => 4 + 'TxnType' => 4, ] ); } - - /** * Test approved transaction notification */ @@ -195,7 +186,6 @@ public function test_api_notifications_unverfied_transaction() ); } - /** * Test notify from disallowed ip */ diff --git a/tests/Feature/PayTest.php b/tests/Feature/PayTest.php index 3aba870..3546e28 100644 --- a/tests/Feature/PayTest.php +++ b/tests/Feature/PayTest.php @@ -2,16 +2,14 @@ namespace MoamalatPay\Tests\Feature; +use Illuminate\Foundation\Testing\Concerns\InteractsWithViews; use MoamalatPay\Pay; use MoamalatPay\Tests\TestCase; -use Illuminate\Foundation\Testing\Concerns\InteractsWithViews; class PayTest extends TestCase { - use InteractsWithViews; - /** * Test config. */ diff --git a/tests/Feature/RefundTest.php b/tests/Feature/RefundTest.php index 704ea57..5181d83 100644 --- a/tests/Feature/RefundTest.php +++ b/tests/Feature/RefundTest.php @@ -9,7 +9,6 @@ class RefundTest extends TestCase { - protected $transaction; public function setUp(): void @@ -19,23 +18,23 @@ public function setUp(): void // response of success requests $respone = [ - "Message" => "Approved", - "Success" => true, - "ActionCode" => null, - "AuthCode" => null, - "DecimalFraction" => 3, - "ExternalTxnId" => null, - "IsEnableRefund" => false, - "MerchantReference" => null, - "NetworkReference" => null, - "ReceiptNumber" => null, - "ReceiverAccountNumber" => null, - "ReceiverName" => null, - "ReceiverScheme" => null, - "RefNumber" => "1233674", - "SystemReference" => 0, - "SystemTxnId" => 0, - "TxnDate" => null + 'Message' => 'Approved', + 'Success' => true, + 'ActionCode' => null, + 'AuthCode' => null, + 'DecimalFraction' => 3, + 'ExternalTxnId' => null, + 'IsEnableRefund' => false, + 'MerchantReference' => null, + 'NetworkReference' => null, + 'ReceiptNumber' => null, + 'ReceiverAccountNumber' => null, + 'ReceiverName' => null, + 'ReceiverScheme' => null, + 'RefNumber' => '1233674', + 'SystemReference' => 0, + 'SystemTxnId' => 0, + 'TxnDate' => null, ]; // set fake requests to make testing faster @@ -44,30 +43,30 @@ public function setUp(): void 'https://tnpg.moamalat.net/cube/paylink.svc/api/RefundTransaction' => function ($r) use ($respone) { if ($r->offsetGet('MerchantId') == 'testing_authentication_failed') { // response for testing authentication failed return Http::response([ - "Message" => "Authentication failed.", - "StackTrace" => null, - "ExceptionType" => "System.InvalidOperationException" + 'Message' => 'Authentication failed.', + 'StackTrace' => null, + 'ExceptionType' => 'System.InvalidOperationException', ], 401); } if ($r->offsetExists('NetworkReference') && $r->offsetGet('NetworkReference') == 'testing_already_refunded') { // response for testing authentication failed return Http::response([ - "Message" => "CUBEEX5250616:Transaction Already Refunded", - "Success" => false, - "ActionCode" => null, - "AuthCode" => null, - "DecimalFraction" => 3, - "ExternalTxnId" => null, - "IsEnableRefund" => false, - "MerchantReference" => null, - "NetworkReference" => null, - "ReceiptNumber" => null, - "ReceiverAccountNumber" => null, - "ReceiverName" => null, - "ReceiverScheme" => null, - "RefNumber" => null, - "SystemReference" => 0, - "SystemTxnId" => 0, - "TxnDate" => null + 'Message' => 'CUBEEX5250616:Transaction Already Refunded', + 'Success' => false, + 'ActionCode' => null, + 'AuthCode' => null, + 'DecimalFraction' => 3, + 'ExternalTxnId' => null, + 'IsEnableRefund' => false, + 'MerchantReference' => null, + 'NetworkReference' => null, + 'ReceiptNumber' => null, + 'ReceiverAccountNumber' => null, + 'ReceiverName' => null, + 'ReceiverScheme' => null, + 'RefNumber' => null, + 'SystemReference' => 0, + 'SystemTxnId' => 0, + 'TxnDate' => null, ], 200); } @@ -94,14 +93,13 @@ public function test_container_instance() $this->assertInstanceOf(Refund::class, app('moamalat-pay-refund')); } - /** * Test */ public function test_refund_by_system_reference() { $this->transaction->refundBySystemReference('226214209277', '10'); - $this->assertEquals($this->transaction->get("Message"), "Approved"); + $this->assertEquals($this->transaction->get('Message'), 'Approved'); } /** @@ -110,7 +108,7 @@ public function test_refund_by_system_reference() public function test_refund_by_network_reference() { $this->transaction->refundByNetworkReference('226214209277', '10'); - $this->assertEquals($this->transaction->get("Message"), "Approved"); + $this->assertEquals($this->transaction->get('Message'), 'Approved'); } /** @@ -119,7 +117,7 @@ public function test_refund_by_network_reference() public function test_already_refunded() { $this->expectExceptionMessage('Transaction Already Refunded'); - (new Refund())->refundByNetworkReference("testing_already_refunded", "10"); + (new Refund())->refundByNetworkReference('testing_already_refunded', '10'); } /** @@ -129,7 +127,7 @@ public function test_authentication_failed() { $this->expectExceptionMessage('Authentication failed.'); Config::set('moamalat-pay.merchant_id', 'testing_authentication_failed'); - (new Refund())->refundByNetworkReference("226214209277", "10"); + (new Refund())->refundByNetworkReference('226214209277', '10'); } /** @@ -186,6 +184,6 @@ public function test_get_all() 'SystemTxnId', 'TxnDate', ]; - $this->assertEquals($keys, array_keys($this->transaction->getAll()), "Keys are not equal"); + $this->assertEquals($keys, array_keys($this->transaction->getAll()), 'Keys are not equal'); } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 85385dd..40ff49a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -10,7 +10,7 @@ public function setUp(): void { parent::setUp(); // additional setup - $this->withFactories(__DIR__ . '/../src/database/factories'); + $this->withFactories(__DIR__.'/../src/database/factories'); } protected function getPackageProviders($app) @@ -20,26 +20,25 @@ protected function getPackageProviders($app) ]; } - protected function getEnvironmentSetUp($app) { $app['config']->set('moamalat-pay', [ - "merchant_id" => "10004188779", - "terminal_id" => "49077229", - "key" => "39353638663431622D303136622D343235322D623330632D383361633838383965373965", - "production" => false, - "show_logs" => true, + 'merchant_id' => '10004188779', + 'terminal_id' => '49077229', + 'key' => '39353638663431622D303136622D343235322D623330632D383361633838383965373965', + 'production' => false, + 'show_logs' => true, 'generate-securekey' => [ - 'url' => 'moamalat-pay/securekey', - 'route_name' => 'moamalat_pay.generate_securekey', + 'url' => 'moamalat-pay/securekey', + 'route_name' => 'moamalat_pay.generate_securekey', + ], + 'notification' => [ + 'key' => '39353638663431622D303136622D343235322D623330632D383361633838383965373965', + 'url' => 'moamalat-pay/notify', + 'route_name' => 'moamalat_pay.notification', + 'table' => 'moamalat_pay_notifications', + 'allowed_ips' => ['*'], ], - "notification" => [ - "key" => "39353638663431622D303136622D343235322D623330632D383361633838383965373965", - "url" => "moamalat-pay/notify", - "route_name" => "moamalat_pay.notification", - "table" => "moamalat_pay_notifications", - "allowed_ips" => ["*"] - ] ]); // perform environment setup }