mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Update client details in checkout.com if configured to do so
This commit is contained in:
parent
0ba333898e
commit
7f5ffe9f73
@ -174,6 +174,10 @@ class CreditCard implements MethodInterface
|
|||||||
return $this->attemptPaymentUsingToken($request);
|
return $this->attemptPaymentUsingToken($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($this->checkout->company_gateway->update_details) {
|
||||||
|
$this->checkout->updateCustomer();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->attemptPaymentUsingCreditCard($request);
|
return $this->attemptPaymentUsingCreditCard($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,7 +325,6 @@ class CreditCard implements MethodInterface
|
|||||||
|
|
||||||
return new PaymentFailed("There was a problem communicating with the API credentials for Checkout", $e->getCode());
|
return new PaymentFailed("There was a problem communicating with the API credentials for Checkout", $e->getCode());
|
||||||
|
|
||||||
// return $this->checkout->processInternallyFailedPayment($this->checkout, $human_exception);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,6 +217,9 @@ class CheckoutComPaymentDriver extends BaseDriver
|
|||||||
{
|
{
|
||||||
$this->init();
|
$this->init();
|
||||||
|
|
||||||
|
if($this->company_gateway->update_details)
|
||||||
|
$this->updateCustomer();
|
||||||
|
|
||||||
$request = new RefundRequest();
|
$request = new RefundRequest();
|
||||||
$request->reference = "{$payment->transaction_reference} ".now();
|
$request->reference = "{$payment->transaction_reference} ".now();
|
||||||
$request->amount = $this->convertToCheckoutAmount($amount, $this->client->getCurrencyCode());
|
$request->amount = $this->convertToCheckoutAmount($amount, $this->client->getCurrencyCode());
|
||||||
@ -303,9 +306,6 @@ class CheckoutComPaymentDriver extends BaseDriver
|
|||||||
$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) {
|
||||||
@ -334,16 +334,16 @@ class CheckoutComPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
public function updateCustomer()
|
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 {
|
try {
|
||||||
|
|
||||||
|
$request = new CustomerRequest();
|
||||||
|
|
||||||
|
$phone = new 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;
|
||||||
|
|
||||||
$response = $this->gateway->getCustomersClient()->update("customer_id", $request);
|
$response = $this->gateway->getCustomersClient()->update("customer_id", $request);
|
||||||
} catch (CheckoutApiException $e) {
|
} catch (CheckoutApiException $e) {
|
||||||
|
|
||||||
@ -385,6 +385,10 @@ class CheckoutComPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
$this->init();
|
$this->init();
|
||||||
|
|
||||||
|
if($this->company_gateway->update_details) {
|
||||||
|
$this->updateCustomer();
|
||||||
|
}
|
||||||
|
|
||||||
$paymentRequest = $this->bootTokenRequest($cgt->token);
|
$paymentRequest = $this->bootTokenRequest($cgt->token);
|
||||||
$paymentRequest->amount = $this->convertToCheckoutAmount($amount, $this->client->getCurrencyCode());
|
$paymentRequest->amount = $this->convertToCheckoutAmount($amount, $this->client->getCurrencyCode());
|
||||||
$paymentRequest->reference = '#'.$invoice->number.' - '.now();
|
$paymentRequest->reference = '#'.$invoice->number.' - '.now();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user