| @@ 49-64 (lines=16) @@ | ||
| 46 | * @param array $payload |
|
| 47 | * @return Model |
|
| 48 | */ |
|
| 49 | public function find($payload) |
|
| 50 | { |
|
| 51 | $this->method = 'GET'; |
|
| 52 | $this->payload = $payload; |
|
| 53 | $this->apiUrl = $this->apiUrl . $payload; |
|
| 54 | ||
| 55 | $this->setOptions([ |
|
| 56 | 'headers' => [ |
|
| 57 | 'Accept' => 'application/json', |
|
| 58 | 'Content-type' => 'application/json' |
|
| 59 | ], |
|
| 60 | 'auth' => [config('paymongo.secret_key'), ''], |
|
| 61 | ]); |
|
| 62 | ||
| 63 | return $this->request(); |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * Request a get all to API |
|
| @@ 92-105 (lines=14) @@ | ||
| 89 | * @param Webhook $webhook |
|
| 90 | * @return Model |
|
| 91 | */ |
|
| 92 | public function enable(Webhook $webhook) |
|
| 93 | { |
|
| 94 | $this->method = 'POST'; |
|
| 95 | $this->apiUrl = $this->apiUrl . "$webhook->id/enable"; |
|
| 96 | ||
| 97 | $this->setOptions([ |
|
| 98 | 'headers' => [ |
|
| 99 | 'Accept' => 'application/json', |
|
| 100 | ], |
|
| 101 | 'auth' => [config('paymongo.secret_key'), ''], |
|
| 102 | ]); |
|
| 103 | ||
| 104 | return $this->request(); |
|
| 105 | } |
|
| 106 | ||
| 107 | /** |
|
| 108 | * Disables the webhook |
|
| @@ 113-126 (lines=14) @@ | ||
| 110 | * @param Webhook $webhook |
|
| 111 | * @return Model |
|
| 112 | */ |
|
| 113 | public function disable(Webhook $webhook) |
|
| 114 | { |
|
| 115 | $this->method = 'POST'; |
|
| 116 | $this->apiUrl = $this->apiUrl . "$webhook->id/disable"; |
|
| 117 | ||
| 118 | $this->setOptions([ |
|
| 119 | 'headers' => [ |
|
| 120 | 'Accept' => 'application/json', |
|
| 121 | ], |
|
| 122 | 'auth' => [config('paymongo.secret_key'), ''], |
|
| 123 | ]); |
|
| 124 | ||
| 125 | return $this->request(); |
|
| 126 | } |
|
| 127 | ||
| 128 | /** |
|
| 129 | * Updates the webhook |
|