diff --git a/src/Paystack.php b/src/Paystack.php index f4b91dc..740c465 100644 --- a/src/Paystack.php +++ b/src/Paystack.php @@ -426,7 +426,7 @@ public function createCustomer($data = null) ]; } - + $this->setRequestOptions(); return $this->setHttpResponse('/customer', 'POST', $data)->getResponse(); } @@ -699,7 +699,7 @@ public function updateSubAccount($subaccount_code) return $this->setHttpResponse("/subaccount/{$subaccount_code}", "PUT", array_filter($data))->getResponse(); } - + /** * Get a list of all supported banks and their properties * @param $country - The country from which to obtain the list of supported banks, $per_page - Specifies how many records to retrieve per page , @@ -726,4 +726,79 @@ public function confirmAccount(string $account_number, string $bank_code) $this->setRequestOptions(); return $this->setHttpResponse("/bank/resolve/?account_number=" . $account_number . "&bank_code=" . $bank_code, "GET")->getResponse(); } + + /** + * Create a customer, validate the customer, and assign a DVA to the customer. + * @param array|null + * @return array + */ + + public function assignDedicatedAccount($data = null) + { + if (!$data) + $data = [ + "email" => request()->email, + "first_name" => request()->first_name, + "middle_name" => request()->middle_name, + "last_name" => request()->last_name, + "phone" => request()->phone, + "preferred_bank" => request()->preferred_bank, + "country" => request()->country ?? "NG" + ]; + + $this->setRequestOptions(); + return $this->setHttpResponse('/dedicated_account/assign', 'POST', array_filter($data))->getResponse(); + } + + /** + * Create a customer, validate the customer, and assign a DVA to the customer. + * @param array|null + * @return array + */ + + public function createDedicatedAccount($data = null) + { + if (!$data) + $data = [ + "customer" => request()->customer, + "first_name" => request()->first_name, + "middle_name" => request()->middle_name, + "last_name" => request()->last_name, + "phone" => request()->phone, + "preferred_bank" => request()->preferred_bank, + "country" => request()->country ?? "NG" + ]; + + $this->setRequestOptions(); + return $this->setHttpResponse('/dedicated_account', 'POST', array_filter($data))->getResponse(); + } + + + /** + * Create a transfer recipient. + * This method registers a recipient for future transfers. + * + * @param array $data - An array containing recipient details such as account number, bank code, and other relevant information. + * @return array - Response from the API containing the recipient details. + */ + public function createRecipient(array $data) + { + + $this->setRequestOptions(); + return $this->setHttpResponse("/transferrecipient", "POST", array_filter($data))->getResponse(); + } + + /** + * Initiate a fund transfer. + * This method starts a transfer to a registered recipient. + * + * @param array $data - An array containing transfer details such as recipient code, amount, currency, and other relevant information. + * @return array - Response from the API with transfer status and details. + */ + public function startTransfer(array $data) + { + + $this->setRequestOptions(); + return $this->setHttpResponse("/transfer", "POST", array_filter($data))->getResponse(); + } }