Minor update for checkout.com

This commit is contained in:
David Bomba 2023-09-26 23:04:31 +10:00
parent 31b8709a89
commit 8fce334cb5
2 changed files with 49 additions and 24 deletions

View File

@ -121,10 +121,11 @@ class CheckoutComPaymentDriver extends BaseDriver
$this->is_four_api = true; //was four api, now known as previous. $this->is_four_api = true; //was four api, now known as previous.
/** @phpstan-ignore-next-line **/
$builder = CheckoutSdk::builder() $builder = CheckoutSdk::builder()
->previous() ->previous()
->environment($this->company_gateway->getConfigField('testMode') ? Environment::sandbox() : Environment::production()) /** phpstan-ignore-line **/
->staticKeys() ->staticKeys()
->environment($this->company_gateway->getConfigField('testMode') ? Environment::sandbox() : Environment::production())
->publicKey($this->company_gateway->getConfigField('publicApiKey')) ->publicKey($this->company_gateway->getConfigField('publicApiKey'))
->secretKey($this->company_gateway->getConfigField('secretApiKey')); ->secretKey($this->company_gateway->getConfigField('secretApiKey'));
@ -132,10 +133,12 @@ class CheckoutComPaymentDriver extends BaseDriver
} else { } 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')) ->publicKey($this->company_gateway->getConfigField('publicApiKey'))
->secretKey($this->company_gateway->getConfigField('secretApiKey')) ->secretKey($this->company_gateway->getConfigField('secretApiKey'));
->environment($this->company_gateway->getConfigField('testMode') ? Environment::sandbox() : Environment::production());
$this->gateway = $builder->build(); $this->gateway = $builder->build();
@ -268,13 +271,14 @@ class CheckoutComPaymentDriver extends BaseDriver
$request = new CustomerRequest(); $request = new CustomerRequest();
$phone = new Phone(); $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); $phone->number = substr(str_pad($this->client->present()->phone(), 6, "0", STR_PAD_RIGHT), 0, 24);
$request->email = $this->client->present()->email(); $request->email = $this->client->present()->email();
$request->name = $this->client->present()->name(); $request->name = $this->client->present()->name();
$request->phone = $phone; $request->phone = $phone;
// if($this->company_gateway->update_details)
// $this->updateCustomer();
try { try {
$response = $this->gateway->getCustomersClient()->create($request); $response = $this->gateway->getCustomersClient()->create($request);
} catch (CheckoutApiException $e) { } 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 * Boots a request for a token payment
* *

34
composer.lock generated
View File

@ -485,16 +485,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.281.12", "version": "3.281.13",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "22a92f08758db2b152843ea0875eeee5a467d8ff" "reference": "5547757d891495713aa7d5770bf04124d48a6ab5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/22a92f08758db2b152843ea0875eeee5a467d8ff", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/5547757d891495713aa7d5770bf04124d48a6ab5",
"reference": "22a92f08758db2b152843ea0875eeee5a467d8ff", "reference": "5547757d891495713aa7d5770bf04124d48a6ab5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -574,9 +574,9 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "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", "name": "bacon/bacon-qr-code",
@ -6361,16 +6361,16 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "2.70.0", "version": "2.71.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "d3298b38ea8612e5f77d38d1a99438e42f70341d" "reference": "98276233188583f2ff845a0f992a235472d9466a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d3298b38ea8612e5f77d38d1a99438e42f70341d", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/98276233188583f2ff845a0f992a235472d9466a",
"reference": "d3298b38ea8612e5f77d38d1a99438e42f70341d", "reference": "98276233188583f2ff845a0f992a235472d9466a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -6463,7 +6463,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-09-07T16:43:50+00:00" "time": "2023-09-25T11:31:05+00:00"
}, },
{ {
"name": "nette/schema", "name": "nette/schema",
@ -8127,16 +8127,16 @@
}, },
{ {
"name": "phpstan/phpdoc-parser", "name": "phpstan/phpdoc-parser",
"version": "1.24.1", "version": "1.24.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git", "url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01" "reference": "bcad8d995980440892759db0c32acae7c8e79442"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01", "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bcad8d995980440892759db0c32acae7c8e79442",
"reference": "9f854d275c2dbf84915a5c0ec9a2d17d2cd86b01", "reference": "bcad8d995980440892759db0c32acae7c8e79442",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -8168,9 +8168,9 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types", "description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": { "support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues", "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", "name": "pragmarx/google2fa",