@@ -32,15 +32,24 @@ public function createCustomer(
3232 ?string $ lastName = null ,
3333 ?string $ mobile = null ,
3434 ):Customer {
35+ // This isn't typically the way URL-encoded data will be passed, if + or -
36+ // characters are present, Spektrix's servers will fail.
37+ $ email = rawurlencode ($ email );
38+ $ email = str_replace ("+ " , "%2b " , $ email );
39+ $ firstName = rawurlencode ($ firstName ?? "" );
40+ $ firstName = str_replace ("' " , "%27 " , $ firstName );
41+ $ lastName = rawurlencode ($ lastName ?? "" );
42+ $ lastName = str_replace ("' " , "%27 " , $ lastName );
43+
3544 $ endpoint = Endpoint::createCustomer;
3645 $ authenticatedRequest = new AuthenticatedRequest (
3746 $ this ->secretKey ,
3847 $ endpoint ,
3948 $ this ->client ,
4049 [
4150 "email " => $ email ,
42- "firstName " => $ firstName ?? "" ,
43- "lastName " => $ lastName ?? "" ,
51+ "firstName " => $ firstName ,
52+ "lastName " => $ lastName ,
4453 "mobile " => $ mobile ?? "" ,
4554 "birthDate " => ("D, d M Y H:i:s T " ),
4655 "friendlyId " => uniqid (),
0 commit comments