Skip to content

Commit e7c8493

Browse files
Merge pull request #181 from theJohnCode/create-customer
allowed the Paystack::createCustomer() method to accept a data parameter
2 parents 3aafa89 + 244dc70 commit e7c8493

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

.phpunit.result.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":1,"defects":[],"times":{"Unicodeveloper\\Paystack\\Test\\HelpersTest::it_returns_instance_of_paystack":0.213,"Unicodeveloper\\Paystack\\Test\\PaystackTest::testAllCustomersAreReturned":0.089,"Unicodeveloper\\Paystack\\Test\\PaystackTest::testAllTransactionsAreReturned":0.001,"Unicodeveloper\\Paystack\\Test\\PaystackTest::testAllPlansAreReturned":0.001}}

src/Paystack.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -412,17 +412,20 @@ public function updatePlan($plan_code)
412412
/**
413413
* Create a customer
414414
*/
415-
public function createCustomer()
415+
public function createCustomer($data = null)
416416
{
417-
$data = [
418-
"email" => request()->email,
419-
"first_name" => request()->fname,
420-
"last_name" => request()->lname,
421-
"phone" => request()->phone,
422-
"metadata" => request()->additional_info /* key => value pairs array */
417+
if ($data == null) {
423418

424-
];
419+
$data = [
420+
"email" => request()->email,
421+
"first_name" => request()->fname,
422+
"last_name" => request()->lname,
423+
"phone" => request()->phone,
424+
"metadata" => request()->additional_info /* key => value pairs array */
425425

426+
];
427+
}
428+
426429
$this->setRequestOptions();
427430
return $this->setHttpResponse('/customer', 'POST', $data)->getResponse();
428431
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy