1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

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,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
*

34
composer.lock generated
View File

@ -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",