Skip to content

Commit d13b6b7

Browse files
wychoonggithub-actions[bot]
authored andcommitted
Fix styling
1 parent ea844a4 commit d13b6b7

File tree

6 files changed

+20
-36
lines changed

6 files changed

+20
-36
lines changed

config/lunar-mpgs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
'payment-success' => null,
2727

2828
'payment-failed' => null,
29-
]
29+
],
3030

3131
];

src/Clients/Mpgs.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Exception;
77
use Illuminate\Http\Client\Response;
88
use Illuminate\Support\Facades\Http;
9-
use Illuminate\Support\Facades\Log;
109

1110
class Mpgs
1211
{
@@ -18,14 +17,14 @@ class Mpgs
1817

1918
protected static string $version;
2019

21-
private static Closure | array $setupUsing = [];
20+
private static Closure|array $setupUsing = [];
2221

2322
public function __construct()
2423
{
2524
$this->setupClient();
2625
}
2726

28-
public static function setupClientUsing(Closure | array $setupUsing)
27+
public static function setupClientUsing(Closure|array $setupUsing)
2928
{
3029
static::$setupUsing = $setupUsing;
3130
}
@@ -54,7 +53,7 @@ public static function config($key, $default = null): ?string
5453
{
5554
$value = config("lunar-mpgs.{$key}", $default);
5655

57-
if (!$value && str($key)->contains('action.')) {
56+
if (! $value && str($key)->contains('action.')) {
5857
$action = str($key)->afterLast('action.')->toString();
5958
$value = match ($action) {
6059
'initiate_checkout' => '/session',
@@ -69,7 +68,7 @@ public static function config($key, $default = null): ?string
6968

7069
protected function getUrl(string $action): string
7170
{
72-
return '{+gateway}/version/{version}/merchant/{merchantId}' . self::config("action.{$action}");
71+
return '{+gateway}/version/{version}/merchant/{merchantId}'.self::config("action.{$action}");
7372
}
7473

7574
protected function execute(string $method, string $action, array $data = [], array $urlParams = []): Response
@@ -81,13 +80,12 @@ protected function execute(string $method, string $action, array $data = [], arr
8180
], $urlParams));
8281

8382
return $client
84-
->withBasicAuth('merchant.' . static::$merchantId, static::$apiPassword)
83+
->withBasicAuth('merchant.'.static::$merchantId, static::$apiPassword)
8584
->{$method}($this->getUrl($action), $data);
8685
}
8786

8887
/**
8988
* Create a MPGS checkout session and return the result.
90-
*
9189
*/
9290
public static function initiateCheckout(array $data)
9391
{
@@ -104,7 +102,6 @@ public static function initiateCheckout(array $data)
104102

105103
/**
106104
* Retrieve MPGS checkout session details
107-
*
108105
*/
109106
public static function retrieveSession(string $sessionId)
110107
{
@@ -120,7 +117,6 @@ public static function retrieveSession(string $sessionId)
120117

121118
/**
122119
* Retrieve the order details from MPGS.
123-
*
124120
*/
125121
public static function retrieveOrder($orderId)
126122
{

src/Facades/Mpgs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace WyChoong\Mpgs\Facades;
44

5-
use WyChoong\Mpgs\Contracts\LunarMpgsInterface;
65
use Illuminate\Support\Facades\Facade;
6+
use WyChoong\Mpgs\Contracts\LunarMpgsInterface;
77

88
/**
99
* @see \WyChoong\Mpgs\MpgsPaymentType

src/Managers/MpgsManager.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@
88
use WyChoong\Mpgs\Clients\Mpgs;
99

1010
/**
11-
*
1211
* here to have Lunar logic
1312
*/
14-
1513
class MpgsManager
1614
{
1715
protected static Closure $initiateCheckoutUsing;
1816

1917
protected static ?Closure $notifyUsing = null;
2018

21-
public function setupClientUsing(Closure | array $setupUsing)
19+
public function setupClientUsing(Closure|array $setupUsing)
2220
{
2321
Mpgs::setupClientUsing($setupUsing);
2422
}
@@ -60,7 +58,7 @@ public function createIntent(Cart $cart): string
6058
$paymentIntent = $result['intent'];
6159
$orderId = $result['order_id'];
6260

63-
if (!$meta) {
61+
if (! $meta) {
6462
$cart->update([
6563
'meta' => [
6664
'payment_intent' => $paymentIntent->session->id,

src/MpgsPaymentServiceProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
namespace WyChoong\Mpgs;
44

5+
use Illuminate\Support\Facades\Blade;
56
use Livewire\Livewire;
67
use Lunar\Facades\Payments;
7-
use Illuminate\Support\Facades\Blade;
88
use Spatie\LaravelPackageTools\Package;
9-
use WyChoong\Mpgs\Managers\MpgsManager;
9+
use Spatie\LaravelPackageTools\PackageServiceProvider;
1010
use WyChoong\Mpgs\Components\PaymentForm;
1111
use WyChoong\Mpgs\Contracts\LunarMpgsInterface;
12-
use Spatie\LaravelPackageTools\PackageServiceProvider;
12+
use WyChoong\Mpgs\Managers\MpgsManager;
1313

1414
class MpgsPaymentServiceProvider extends PackageServiceProvider
1515
{

src/MpgsPaymentType.php

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,26 @@
33
namespace WyChoong\Mpgs;
44

55
use Exception;
6-
use Lunar\Models\Transaction;
7-
use WyChoong\Mpgs\Clients\Mpgs;
86
use Illuminate\Support\Facades\DB;
9-
use Lunar\PaymentTypes\AbstractPayment;
10-
use Lunar\Base\DataTransferObjects\PaymentRefund;
11-
use Lunar\Base\DataTransferObjects\PaymentCapture;
127
use Lunar\Base\DataTransferObjects\PaymentAuthorize;
8+
use Lunar\Base\DataTransferObjects\PaymentCapture;
9+
use Lunar\Base\DataTransferObjects\PaymentRefund;
1310
use Lunar\Models\Currency;
11+
use Lunar\Models\Transaction;
12+
use Lunar\PaymentTypes\AbstractPayment;
13+
use WyChoong\Mpgs\Clients\Mpgs;
1414

1515
class MpgsPaymentType extends AbstractPayment
1616
{
17-
1817
protected $orderResponse;
18+
1919
/**
2020
* Authorize the payment for processing.
21-
*
22-
* @return \Lunar\Base\DataTransferObjects\PaymentAuthorize
2321
*/
2422
public function authorize(): PaymentAuthorize
2523
{
26-
if (!$this->order) {
27-
if (!$this->order = $this->cart->order) {
24+
if (! $this->order) {
25+
if (! $this->order = $this->cart->order) {
2826
$this->order = $this->cart->createOrder();
2927
}
3028
}
@@ -55,9 +53,7 @@ public function authorize(): PaymentAuthorize
5553
/**
5654
* Capture a payment for a transaction.
5755
*
58-
* @param \Lunar\Models\Transaction $transaction
5956
* @param int $amount
60-
* @return \Lunar\Base\DataTransferObjects\PaymentCapture
6157
*/
6258
public function capture(Transaction $transaction, $amount = 0): PaymentCapture
6359
{
@@ -67,10 +63,7 @@ public function capture(Transaction $transaction, $amount = 0): PaymentCapture
6763
/**
6864
* Refund a captured transaction
6965
*
70-
* @param \Lunar\Models\Transaction $transaction
71-
* @param int $amount
7266
* @param string|null $notes
73-
* @return \Lunar\Base\DataTransferObjects\PaymentRefund
7467
*/
7568
public function refund(Transaction $transaction, int $amount = 0, $notes = null): PaymentRefund
7669
{
@@ -93,9 +86,6 @@ public function refund(Transaction $transaction, int $amount = 0, $notes = null)
9386

9487
/**
9588
* Return a successfully released payment.
96-
*
97-
* @return \Lunar\Base\DataTransferObjects\PaymentAuthorize
98-
*
9989
*/
10090
private function releaseSuccess(): PaymentAuthorize
10191
{

0 commit comments

Comments
 (0)