mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for blank client address in Swiss QR Codes
This commit is contained in:
parent
08ca5ddb72
commit
896e5f88ac
@ -87,10 +87,10 @@ class SwissQrGenerator
|
|||||||
$qrBill->setUltimateDebtor(
|
$qrBill->setUltimateDebtor(
|
||||||
QrBill\DataGroup\Element\StructuredAddress::createWithStreet(
|
QrBill\DataGroup\Element\StructuredAddress::createWithStreet(
|
||||||
substr($this->client->present()->name(), 0 , 70),
|
substr($this->client->present()->name(), 0 , 70),
|
||||||
$this->client->address1 ? substr($this->client->address1, 0 , 70) : '',
|
$this->client->address1 ? substr($this->client->address1, 0 , 70) : '_',
|
||||||
$this->client->address2 ? substr($this->client->address2, 0 , 16) : '',
|
$this->client->address2 ? substr($this->client->address2, 0 , 16) : '_',
|
||||||
$this->client->postal_code ? substr($this->client->postal_code, 0, 16) : '',
|
$this->client->postal_code ? substr($this->client->postal_code, 0, 16) : '_',
|
||||||
$this->client->city ? substr($this->client->city, 0, 35) : '',
|
$this->client->city ? substr($this->client->city, 0, 35) : '_',
|
||||||
'CH'
|
'CH'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -306,10 +306,53 @@ class CheckoutComPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$response = $this->gateway->getCustomersClient()->create($request);
|
$response = $this->gateway->getCustomersClient()->create($request);
|
||||||
} catch (\Exception $e) {
|
|
||||||
// API error
|
|
||||||
throw new PaymentFailed($e->getMessage(), $e->getCode());
|
|
||||||
}
|
}
|
||||||
|
catch (CheckoutApiException $e) {
|
||||||
|
// API error
|
||||||
|
$request_id = $e->request_id;
|
||||||
|
$http_status_code = $e->http_status_code;
|
||||||
|
$error_details = $e->error_details;
|
||||||
|
|
||||||
|
if(is_array($error_details)) {
|
||||||
|
$error_details = end($e->error_details['error_codes']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$human_exception = $error_details ? new \Exception($error_details, 400) : $e;
|
||||||
|
|
||||||
|
|
||||||
|
throw new PaymentFailed($human_exception);
|
||||||
|
} catch (CheckoutArgumentException $e) {
|
||||||
|
// Bad arguments
|
||||||
|
|
||||||
|
$error_details = $e->error_details;
|
||||||
|
|
||||||
|
if(is_array($error_details)) {
|
||||||
|
$error_details = end($e->error_details['error_codes']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$human_exception = $error_details ? new \Exception($error_details, 400) : $e;
|
||||||
|
|
||||||
|
throw new PaymentFailed($human_exception);
|
||||||
|
} catch (CheckoutAuthorizationException $e) {
|
||||||
|
// Bad Invalid authorization
|
||||||
|
|
||||||
|
$error_details = $e->error_details;
|
||||||
|
|
||||||
|
if(is_array($error_details)) {
|
||||||
|
$error_details = end($e->error_details['error_codes']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$human_exception = $error_details ? new \Exception($error_details, 400) : $e;
|
||||||
|
|
||||||
|
throw new PaymentFailed($human_exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// catch (\Exception $e) {
|
||||||
|
// // API error
|
||||||
|
// throw new PaymentFailed($e->getMessage(), $e->getCode());
|
||||||
|
// }
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user