@@ 181-196 (lines=16) @@ | ||
178 | * Required fields - 'first_name', 'last_name', 'email', 'phone' |
|
179 | * Optional - 'address', 'company_name', 'type', 'settlement_bank', 'account_number' |
|
180 | */ |
|
181 | public function editClient( $client_id, array $client_data){ |
|
182 | if(!$client_id){ |
|
183 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid Client Id"); |
|
184 | } |
|
185 | ||
186 | $url = "/clients/{$client_id}"; |
|
187 | ||
188 | // Mandatory fields |
|
189 | $required_values = ['first_name', 'last_name', 'email', 'phone']; |
|
190 | ||
191 | if(!array_keys_exist($client_data, $required_values)){ |
|
192 | throw new RequiredValuesMissing("Missing required values :("); |
|
193 | } |
|
194 | ||
195 | return $this->sendRequest('put', $url, ['form_params' => $client_data]); |
|
196 | } |
|
197 | ||
198 | ||
199 | ||
@@ 547-564 (lines=18) @@ | ||
544 | * @param string $passcode [Mandatory - Wallet's passcode] |
|
545 | * @return object |
|
546 | */ |
|
547 | public function addWallet(string $name, string $passcode){ |
|
548 | if(!$name){ |
|
549 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid name"); |
|
550 | } |
|
551 | ||
552 | if(!$passcode || strlen($passcode) < 6){ |
|
553 | throw new IsNullOrInvalid("Error Processing Request - Null/Invalid passcode/ length"); |
|
554 | } |
|
555 | ||
556 | $url = "/wallets"; |
|
557 | ||
558 | $post_data = [ |
|
559 | 'name' => $name, |
|
560 | 'passcode' => $passcode, |
|
561 | ]; |
|
562 | ||
563 | return $this->sendRequest('post', $url, ['form_params' => $post_data]); |
|
564 | } |
|
565 | ||
566 | ||
567 |