| @@ 386-400 (lines=15) @@ | ||
| 383 | /** |
|
| 384 | * Create a customer |
|
| 385 | */ |
|
| 386 | public function createCustomer( $data = null ) |
|
| 387 | { |
|
| 388 | if ($data == null){ |
|
| 389 | $data = [ |
|
| 390 | "email" => request()->email, |
|
| 391 | "first_name" => request()->fname, |
|
| 392 | "last_name" => request()->lname, |
|
| 393 | "phone" => request()->phone, |
|
| 394 | "metadata" => request()->additional_info /* key => value pairs array */ |
|
| 395 | ||
| 396 | ]; |
|
| 397 | } |
|
| 398 | $this->setRequestOptions(); |
|
| 399 | return $this->setHttpResponse('/customer', 'POST', $data)->getResponse(); |
|
| 400 | } |
|
| 401 | ||
| 402 | /** |
|
| 403 | * Fetch a customer based on id or code |
|
| @@ 418-433 (lines=16) @@ | ||
| 415 | * @param $customer_id |
|
| 416 | * @return array |
|
| 417 | */ |
|
| 418 | public function updateCustomer($customer_id, $data = null) |
|
| 419 | { |
|
| 420 | if ($data == null) { |
|
| 421 | $data = [ |
|
| 422 | "email" => request()->email, |
|
| 423 | "first_name" => request()->fname, |
|
| 424 | "last_name" => request()->lname, |
|
| 425 | "phone" => request()->phone, |
|
| 426 | "metadata" => request()->additional_info /* key => value pairs array */ |
|
| 427 | ||
| 428 | ]; |
|
| 429 | } |
|
| 430 | ||
| 431 | $this->setRequestOptions(); |
|
| 432 | return $this->setHttpResponse('/customer/'. $customer_id, 'PUT', $data)->getResponse(); |
|
| 433 | } |
|
| 434 | ||
| 435 | /** |
|
| 436 | * Export transactions in .CSV |
|