mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Fixes for Rotessa
This commit is contained in:
parent
286b2087cd
commit
ec144b4181
@ -100,8 +100,17 @@ class PaymentMethod implements MethodInterface
|
||||
|
||||
$customer = array_merge(['address' => $request->only('address_1','address_2','city','postal_code','province_code','country'), 'custom_identifier' => $request->input('custom_identifier') ], $request->all());
|
||||
|
||||
$this->rotessa->findOrCreateCustomer($customer);
|
||||
|
||||
try{
|
||||
$this->rotessa->findOrCreateCustomer($customer);
|
||||
}
|
||||
catch(\Exception $e){
|
||||
|
||||
$message = json_decode($e->getMessage(), true);
|
||||
|
||||
return redirect()->route('client.payment_methods.index')->withErrors(array_values($message['errors']));
|
||||
|
||||
}
|
||||
|
||||
return redirect()->route('client.payment_methods.index')->withMessage(ctrans('texts.payment_method_added'));
|
||||
|
||||
}
|
||||
|
@ -202,7 +202,6 @@ class RotessaPaymentDriver extends BaseDriver
|
||||
|
||||
public function findOrCreateCustomer(array $data)
|
||||
{
|
||||
nlog($data);
|
||||
|
||||
$result = null;
|
||||
try {
|
||||
@ -219,7 +218,6 @@ class RotessaPaymentDriver extends BaseDriver
|
||||
|
||||
if(!isset($data['id'])) {
|
||||
|
||||
nlog("no id, lets goo");
|
||||
$result = $this->gatewayRequest('post', 'customers', $data);
|
||||
|
||||
if($result->failed())
|
||||
@ -252,9 +250,16 @@ class RotessaPaymentDriver extends BaseDriver
|
||||
'code' => 500
|
||||
];
|
||||
|
||||
SystemLogger::dispatch(['server_response' => is_null($result) ? '' : $result->getMessage(), 'data' => $data], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, 880 , $this->client, $this->company_gateway->company);
|
||||
SystemLogger::dispatch(['server_response' => $data, 'data' => []], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, 880 , $this->client, $this->company_gateway->company);
|
||||
|
||||
throw $th;
|
||||
try{
|
||||
$errors = explode("422:", $th->getMessage())[1];
|
||||
}
|
||||
catch(\Exception){
|
||||
$errors = 'Unknown error occured';
|
||||
}
|
||||
|
||||
throw new \Exception($errors, $th->getCode());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,17 @@
|
||||
@section('meta_title', ctrans('texts.payment_methods'))
|
||||
|
||||
@section('body')
|
||||
|
||||
@section('header')
|
||||
@if($errors->any())
|
||||
<div class="alert alert-failure mb-4">
|
||||
@foreach($errors->all() as $error)
|
||||
<p>{{ $error }}</p>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
@endsection
|
||||
|
||||
<div class="flex flex-col">
|
||||
@livewire('payment-methods-table', ['client_id' => $client->id, 'db' => $company->db])
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user