File tree Expand file tree Collapse file tree 2 files changed +48
-2
lines changed
src/Gateways/Asaas/Resources/Pix Expand file tree Collapse file tree 2 files changed +48
-2
lines changed Original file line number Diff line number Diff line change 17
17
*
18
18
* @return string $pixKey
19
19
*/
20
- $ pixKey = $ phpay
20
+ $ phpay
21
21
->pix ()
22
22
->createKey ();
23
23
24
- print_r ($ pixKey );
24
+ /**
25
+ * get all pix keys
26
+ *
27
+ * @return array $pixKeys
28
+ */
29
+ $ phpay
30
+ ->pix ()
31
+ ->getAll ();
Original file line number Diff line number Diff line change @@ -18,6 +18,11 @@ class Pix implements PixInterface
18
18
*/
19
19
private Client $ client ;
20
20
21
+ /**
22
+ * @var array<mixed>
23
+ */
24
+ private array $ queryParams = [];
25
+
21
26
/**
22
27
* construct
23
28
*
@@ -30,6 +35,19 @@ public function __construct(
30
35
$ this ->client = $ this ->clientAsaasBoot ();
31
36
}
32
37
38
+ /**
39
+ * set query params
40
+ *
41
+ * @param array<mixed> $queryParams
42
+ * @return PixInterface
43
+ */
44
+ public function setQueryParams (array $ queryParams ): PixInterface
45
+ {
46
+ $ this ->queryParams = $ queryParams ;
47
+
48
+ return $ this ;
49
+ }
50
+
33
51
/**
34
52
* create pix key
35
53
*
@@ -44,4 +62,25 @@ public function createKey(): array
44
62
'type ' => 'EVP ' ,
45
63
]);
46
64
}
65
+
66
+ /**
67
+ * get all pix keys
68
+ *
69
+ * @return array<mixed>
70
+ * @see params in https://docs.asaas.com/reference/list-keys
71
+ */
72
+ public function getAll (): array
73
+ {
74
+ $ params = $ this ->queryParams ;
75
+
76
+ if (empty ($ params )) {
77
+ $ params = [
78
+ 'offset ' => 0 ,
79
+ 'limit ' => 100 ,
80
+ 'status ' => 'ACTIVE ' ,
81
+ ];
82
+ }
83
+
84
+ return $ this ->get ('pix/addressKeys ' , $ params );
85
+ }
47
86
}
You can’t perform that action at this time.
0 commit comments