0nepeop1e 3 лет назад
Родитель
Сommit
60971cbdcb

+ 3
- 0
.idea/php.xml Просмотреть файл

35
       <path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-idn" />
35
       <path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-idn" />
36
       <path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher-contracts" />
36
       <path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher-contracts" />
37
       <path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher" />
37
       <path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher" />
38
+      <path value="$PROJECT_DIR$/vendor/symfony/http-client-contracts" />
39
+      <path value="$PROJECT_DIR$/vendor/illuminate/macroable" />
40
+      <path value="$PROJECT_DIR$/vendor/illuminate/collections" />
38
     </include_path>
41
     </include_path>
39
   </component>
42
   </component>
40
   <component name="PhpProjectSharedConfiguration" php_language_level="7.1" />
43
   <component name="PhpProjectSharedConfiguration" php_language_level="7.1" />

+ 2
- 2
composer.json Просмотреть файл

6
     "readme": "README.md",
6
     "readme": "README.md",
7
     "require": {
7
     "require": {
8
         "php": ">=7.1",
8
         "php": ">=7.1",
9
-        "illuminate/support": ">=5.0 <8.0",
10
-        "illuminate/http": ">=5.0 <8.0"
9
+        "illuminate/support": ">=5.0 <9.0",
10
+        "illuminate/http": ">=5.0 <9.0"
11
     },
11
     },
12
     "suggest": {
12
     "suggest": {
13
         "mirfalah/laravel-payment-senangpay": "^1.0",
13
         "mirfalah/laravel-payment-senangpay": "^1.0",

+ 9
- 1
src/Contracts/PaymentGatewayDriver.php Просмотреть файл

15
 
15
 
16
     public function verifyGatewayCallback(Request $request, Response &$response = null): bool;
16
     public function verifyGatewayCallback(Request $request, Response &$response = null): bool;
17
 
17
 
18
-    public function getBillIdFromRequest(Request $request);
18
+    public function getBillIdFromRequest(Request $request): string;
19
+
20
+    public function getBillStatus(Request $request): int;
21
+
22
+    public function isBillSuccess(Request $request): bool;
23
+
24
+    public function isBillFailed(Request $request): bool;
25
+
26
+    public function isBillPending(Request $request): bool;
19
 }
27
 }

+ 10
- 0
src/Events/CallbackVerifiedEvent.php Просмотреть файл

1
+<?php
2
+
3
+
4
+namespace MirfalahTech\Laravel\Payment\Events;
5
+
6
+
7
+class CallbackVerifiedEvent extends PaymentGatewayEvent
8
+{
9
+
10
+}

+ 10
- 0
src/Events/PaymentFailedEvent.php Просмотреть файл

1
+<?php
2
+
3
+
4
+namespace MirfalahTech\Laravel\Payment\Events;
5
+
6
+
7
+class PaymentFailedEvent extends PaymentGatewayEvent
8
+{
9
+
10
+}

+ 46
- 0
src/Events/PaymentGatewayEvent.php Просмотреть файл

1
+<?php
2
+
3
+
4
+namespace MirfalahTech\Laravel\Payment\Events;
5
+
6
+
7
+use Illuminate\Http\Request;
8
+use MirfalahTech\Laravel\Payment\Contracts\PaymentGatewayDriver;
9
+
10
+abstract class PaymentGatewayEvent
11
+{
12
+    protected $gateway;
13
+    protected $gatewayDriver;
14
+    protected $request;
15
+
16
+    public function __construct(string $gateway, PaymentGatewayDriver $gatewayDriver, Request $request)
17
+    {
18
+        $this->gateway = $gateway;
19
+        $this->gatewayDriver = $gatewayDriver;
20
+        $this->request = $request;
21
+    }
22
+
23
+    /**
24
+     * @return string
25
+     */
26
+    public function getGateway(): string
27
+    {
28
+        return $this->gateway;
29
+    }
30
+
31
+    /**
32
+     * @return PaymentGatewayDriver
33
+     */
34
+    public function getDriver(): PaymentGatewayDriver
35
+    {
36
+        return $this->gatewayDriver;
37
+    }
38
+
39
+    /**
40
+     * @return Request
41
+     */
42
+    public function getRequest(): Request
43
+    {
44
+        return $this->request;
45
+    }
46
+}

+ 10
- 0
src/Events/PaymentPendingEvent.php Просмотреть файл

1
+<?php
2
+
3
+
4
+namespace MirfalahTech\Laravel\Payment\Events;
5
+
6
+
7
+class PaymentPendingEvent extends PaymentGatewayEvent
8
+{
9
+
10
+}

+ 10
- 0
src/Events/PaymentSuccessEvent.php Просмотреть файл

1
+<?php
2
+
3
+
4
+namespace MirfalahTech\Laravel\Payment\Events;
5
+
6
+
7
+class PaymentSuccessEvent extends PaymentGatewayEvent
8
+{
9
+
10
+}

+ 10
- 0
src/Events/ReturnVerifiedEvent.php Просмотреть файл

1
+<?php
2
+
3
+
4
+namespace MirfalahTech\Laravel\Payment\Events;
5
+
6
+
7
+class ReturnVerifiedEvent extends PaymentGatewayEvent
8
+{
9
+
10
+}

+ 4
- 0
src/Facade/Payment.php Просмотреть файл

22
  */
22
  */
23
 class Payment extends Facade
23
 class Payment extends Facade
24
 {
24
 {
25
+    const SUCCESS = 1;
26
+    const FAILED = -1;
27
+    const PENDING = 0;
28
+
25
     protected static function getFacadeAccessor()
29
     protected static function getFacadeAccessor()
26
     {
30
     {
27
         return 'payment';
31
         return 'payment';

+ 25
- 0
src/Traits/BillStatusBoolean.php Просмотреть файл

1
+<?php
2
+/** @noinspection PhpUndefinedMethodInspection */
3
+
4
+namespace MirfalahTech\Laravel\Payment\Traits;
5
+
6
+
7
+use Illuminate\Http\Request;
8
+
9
+trait BillStatusBoolean
10
+{
11
+    public function isBillSuccess(Request $request): bool
12
+    {
13
+        return $this->getBillStatus($request) > 0;
14
+    }
15
+
16
+    public function isBillFailed(Request $request): bool
17
+    {
18
+        return $this->getBillStatus($request) < 0;
19
+    }
20
+
21
+    public function isBillPending(Request $request): bool
22
+    {
23
+        return $this->getBillStatus($request) == 0;
24
+    }
25
+}

Загрузка…
Отмена
Сохранить