From 8fce334cb5a5370ee09d7ea8409a111bf1f2d669 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 26 Sep 2023 23:04:31 +1000 Subject: [PATCH] Minor update for checkout.com --- .../CheckoutComPaymentDriver.php | 39 +++++++++++++++---- composer.lock | 34 ++++++++-------- 2 files changed, 49 insertions(+), 24 deletions(-) diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index 103220c63d6d..94615b4d38f4 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -121,21 +121,24 @@ class CheckoutComPaymentDriver extends BaseDriver $this->is_four_api = true; //was four api, now known as previous. + /** @phpstan-ignore-next-line **/ $builder = CheckoutSdk::builder() ->previous() + ->environment($this->company_gateway->getConfigField('testMode') ? Environment::sandbox() : Environment::production()) /** phpstan-ignore-line **/ ->staticKeys() - ->environment($this->company_gateway->getConfigField('testMode') ? Environment::sandbox() : Environment::production()) ->publicKey($this->company_gateway->getConfigField('publicApiKey')) ->secretKey($this->company_gateway->getConfigField('secretApiKey')); $this->gateway = $builder->build(); } else { - - $builder = CheckoutSdk::builder()->staticKeys() + + /** @phpstan-ignore-next-line **/ + $builder = CheckoutSdk::builder() + ->environment($this->company_gateway->getConfigField('testMode') ? Environment::sandbox() : Environment::production()) /** phpstan-ignore-line **/ + ->staticKeys() ->publicKey($this->company_gateway->getConfigField('publicApiKey')) - ->secretKey($this->company_gateway->getConfigField('secretApiKey')) - ->environment($this->company_gateway->getConfigField('testMode') ? Environment::sandbox() : Environment::production()); + ->secretKey($this->company_gateway->getConfigField('secretApiKey')); $this->gateway = $builder->build(); @@ -268,13 +271,14 @@ class CheckoutComPaymentDriver extends BaseDriver $request = new CustomerRequest(); $phone = new Phone(); - // $phone->number = $this->client->present()->phone(); $phone->number = substr(str_pad($this->client->present()->phone(), 6, "0", STR_PAD_RIGHT), 0, 24); - $request->email = $this->client->present()->email(); $request->name = $this->client->present()->name(); $request->phone = $phone; + // if($this->company_gateway->update_details) + // $this->updateCustomer(); + try { $response = $this->gateway->getCustomersClient()->create($request); } catch (CheckoutApiException $e) { @@ -301,6 +305,27 @@ class CheckoutComPaymentDriver extends BaseDriver } } + public function updateCustomer() + { + $phone = new Phone(); + $phone->number = substr(str_pad($this->client->present()->phone(), 6, "0", STR_PAD_RIGHT), 0, 24); + + $request = new CustomerRequest(); + + $request->email = $this->client->present()->email(); + $request->name = $this->client->present()->name(); + $request->phone = $phone; + + try { + $response = $this->gateway->getCustomersClient()->update("customer_id", $request); + } catch (CheckoutApiException $e) { + + } catch (CheckoutAuthorizationException $e) { + + } + + } + /** * Boots a request for a token payment * diff --git a/composer.lock b/composer.lock index b54edc2dd8c5..2b184a2ecd53 100644 --- a/composer.lock +++ b/composer.lock @@ -485,16 +485,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.281.12", + "version": "3.281.13", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "22a92f08758db2b152843ea0875eeee5a467d8ff" + "reference": "5547757d891495713aa7d5770bf04124d48a6ab5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/22a92f08758db2b152843ea0875eeee5a467d8ff", - "reference": "22a92f08758db2b152843ea0875eeee5a467d8ff", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/5547757d891495713aa7d5770bf04124d48a6ab5", + "reference": "5547757d891495713aa7d5770bf04124d48a6ab5", "shasum": "" }, "require": { @@ -574,9 +574,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.281.12" + "source": "https://github.com/aws/aws-sdk-php/tree/3.281.13" }, - "time": "2023-09-22T18:12:27+00:00" + "time": "2023-09-25T18:07:38+00:00" }, { "name": "bacon/bacon-qr-code", @@ -6361,16 +6361,16 @@ }, { "name": "nesbot/carbon", - "version": "2.70.0", + "version": "2.71.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "d3298b38ea8612e5f77d38d1a99438e42f70341d" + "reference": "98276233188583f2ff845a0f992a235472d9466a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d3298b38ea8612e5f77d38d1a99438e42f70341d", - "reference": "d3298b38ea8612e5f77d38d1a99438e42f70341d", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/98276233188583f2ff845a0f992a235472d9466a", + "reference": "98276233188583f2ff845a0f992a235472d9466a", "shasum": "" }, "require": { @@ -6463,7 +6463,7 @@ "type": "tidelift" } ], - "time": "2023-09-07T16:43:50+00:00" + "time": "2023-09-25T11:31:05+00:00" }, { "name": "nette/schema", @@ -8127,16 +8127,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.24.1", + "version": "1.24.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01" + "reference": "bcad8d995980440892759db0c32acae7c8e79442" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01", - "reference": "9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bcad8d995980440892759db0c32acae7c8e79442", + "reference": "bcad8d995980440892759db0c32acae7c8e79442", "shasum": "" }, "require": { @@ -8168,9 +8168,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.2" }, - "time": "2023-09-18T12:18:02+00:00" + "time": "2023-09-26T12:28:12+00:00" }, { "name": "pragmarx/google2fa",