diff --git a/app/PaymentDrivers/CBAPowerBoard/Customer.php b/app/PaymentDrivers/CBAPowerBoard/Customer.php index 92ac86ab5778..9078b5d4e58b 100644 --- a/app/PaymentDrivers/CBAPowerBoard/Customer.php +++ b/app/PaymentDrivers/CBAPowerBoard/Customer.php @@ -68,52 +68,15 @@ class Customer $search_results = $r->object(); - nlog("find customer"); - nlog($search_results); $customers = $search_results->resource->data; - nlog($customers); return reset($customers); // returns first element or false } - /* - token +2 string(UIID) One-time token with all the payment source information - reference - string Manually defined reference for customer in payment systems - description - string Customer description. This is customer internal description - company_name - string Customer company name - first_name - string Customer first name - last_name - string Customer last name - email - string Customer email - phone - string(E.164) Customer phone in E.164 international notation (Example: +12345678901) - default_source + string (24 hex characters) Payment source used by default - payment_source + object Object with payment information - payment_source.gateway_id -4 string (24 hex characters) Gateway id - payment_source.vault_token +3 string (UIID) Vault token - payment_source.type + string Type of payment. card for payment with credit card - payment_source.card_name +1 string Cardholder name (as on card) - payment_source.card_number +1 string(numeric) Card number - payment_source.expire_month +1 string(mm) Card expiration month mm - payment_source.expire_year +1 string(yyyy) Card expiration year - payment_source.card_ccv -1 string(numeric) Card CCV number - payment_source.address_line1 - string Customer Address, line 1 - payment_source.address_line2 - string Customer Address, line 2 - payment_source.address_state - string Customer Address, State - payment_source.address_country - string Customer Address, Country Code - payment_source.address_city - string Customer Address, City - payment_source.address_postcode - */ public function createCustomer(array $data = []): object { - nlog("creating customer flow"); - - // 'address_line1' => $this->powerboard->client->address1 ?? '', - // 'address_line2' => $this->powerboard->client->address2 ?? '', - // 'address_state' => $this->powerboard->client->state ?? '', - // 'address_country' => $this->powerboard->client->country->iso_3166_3 ?? '', - // 'address_city' => $this->powerboard->client->city ?? '', - // 'address_postcode' => $this->powerboard->client->postal_code ?? '', - + $payload = [ 'company_name' => $this->powerboard->client->present()->name(), 'first_name' => $this->powerboard->client->present()->first_name(), @@ -145,59 +108,6 @@ class Customer } - /* - { - "status": 201, - "error": null, - "resource": { - "type": "customer", - "data": { - "statistics": { - "successful_transactions": 0, - "total_collected_amount": 0 - }, - "_check_expire_date": false, - "archived": false, - "_source_ip_address": "130.41.62.108", - "_id": "64b09a3d1e04e51be27f16c5", - "company_id": "63cf32a154a870183bf2398a", - "email": "john@test.com", - "first_name": "John", - "last_name": "Customer", - "phone": "+61111111111", - "reference": "Customer 1", - "default_source": "64b09a341e04e51be27f16c2", - "_service": { - "default_gateway_id": "63cf37b142194166721498e9" - }, - "payment_sources": [ - { - "type": "card", - "_id": "64b09a341e04e51be27f16c2", - "expire_month": 1, - "expire_year": 2039, - "card_name": "John Customer", - "card_scheme": "mastercard", - "card_number_last4": "1118", - "card_number_bin": "51111111", - "ref_token": "9191664642213170", - "status": "active", - "created_at": "2023-07-14T00:43:32.375Z", - "gateway_id": "63cf37b142194166721498e9", - "gateway_type": "MasterCard", - "gateway_name": "CommWeb", - "vault_token": "b944dfb0-35f4-47d6-a306-2b79cebf34f3", - "updated_at": "2023-07-14T00:43:41.169Z" - } - ], - "payment_destinations": [], - "updated_at": "2023-07-14T00:43:41.170Z", - "created_at": "2023-07-14T00:43:41.170Z", - "__v": 0 - } - } - } - */ private function storePaymentMethod(mixed $customer): ClientGatewayToken { @@ -241,11 +151,5 @@ class Customer return $r->successful() ? $r->object() : $r->throw(); } - - - // public function updateCustomer(string $id, $data): object - // { - - // } } diff --git a/app/PaymentDrivers/CBAPowerBoard/Models/Customers.php b/app/PaymentDrivers/CBAPowerBoard/Models/Customers.php new file mode 100644 index 000000000000..ea3c5ac2f27a --- /dev/null +++ b/app/PaymentDrivers/CBAPowerBoard/Models/Customers.php @@ -0,0 +1,18 @@ +