Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 66f0f63

Browse files
authored
Merge pull request #39 from grayloon/create-customer-account
Ability to create customer endpoint
2 parents 988db72 + 322e7ad commit 66f0f63

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/Api/Customers.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,15 @@ public function all($pageSize = 50, $currentPage = 1, $filters = [])
2020
'searchCriteria[currentPage]' => $currentPage,
2121
]));
2222
}
23+
24+
/**
25+
* Create customer account. Perform necessary business operations like sending email.
26+
*
27+
* @param array $body
28+
* @return array
29+
*/
30+
public function create($body)
31+
{
32+
return $this->post('/customers', $body);
33+
}
2334
}

tests/Api/CustomersTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,15 @@ public function test_can_call_magento_api_customers_all_with_filter()
3333

3434
$this->assertTrue($api->ok());
3535
}
36+
37+
public function test_can_create_customer()
38+
{
39+
Http::fake([
40+
'*rest/all/V1/customers' => Http::response([], 200),
41+
]);
42+
43+
$api = MagentoFacade::api('customers')->create(['foo' => 'bar']);
44+
45+
$this->assertTrue($api->ok());
46+
}
3647
}

0 commit comments

Comments
 (0)