Fixes for translations

This commit is contained in:
David Bomba 2024-07-21 11:12:07 +10:00
parent d967329bc5
commit 3981d59ef3
7 changed files with 74 additions and 59 deletions

View File

@ -525,6 +525,7 @@ class PayPalBasePaymentDriver extends BaseDriver
$this->init(); $this->init();
PayPalWebhook::dispatch($request->all(), $request->headers->all(), $this->access_token); PayPalWebhook::dispatch($request->all(), $request->headers->all(), $this->access_token);
} }
public function createNinjaPayment($request, $response) public function createNinjaPayment($request, $response)

View File

@ -306,7 +306,6 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
* *
* @param mixed $request * @param mixed $request
* @param array $response * @param array $response
* @return void
*/ */
public function processTokenPayment($request, array $response) public function processTokenPayment($request, array $response)
{ {
@ -363,6 +362,9 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
$response = $r->json(); $response = $r->json();
if(isset($response['purchase_units'][0]['payments']['captures'][0]['status']) && $response['purchase_units'][0]['payments']['captures'][0]['status'] == 'COMPLETED')
{
$data = [ $data = [
'payment_type' => $this->getPaymentMethod($request->gateway_type_id), 'payment_type' => $this->getPaymentMethod($request->gateway_type_id),
'amount' => $response['purchase_units'][0]['payments']['captures'][0]['amount']['value'], 'amount' => $response['purchase_units'][0]['payments']['captures'][0]['amount']['value'],
@ -382,6 +384,9 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
); );
return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]); return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]);
}
return response()->json(['message' => 'Error processing token payment'], 400);
} }
@ -431,6 +436,8 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
} }
$response = $r->json(); $response = $r->json();
if(isset($response['purchase_units'][0]['payments']['captures'][0]['status']) && $response['purchase_units'][0]['payments']['captures'][0]['status'] == 'COMPLETED')
{
$data = [ $data = [
'payment_type' => $this->getPaymentMethod((string)$cgt->gateway_type_id), 'payment_type' => $this->getPaymentMethod((string)$cgt->gateway_type_id),
@ -450,7 +457,15 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
$this->client->company, $this->client->company,
); );
}
$this->processInternallyFailedPayment($this, new \Exception('Auto billing failed.', 400));
SystemLogger::dispatch($response, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_PAYPAL, $this->client, $this->client->company);
} }
} }

View File

@ -340,9 +340,7 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
} }
return response()->json(['message' => 'Error processing token payment'], 400);
} }
@ -413,11 +411,12 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
$this->client, $this->client,
$this->client->company, $this->client->company,
); );
} }
$this->processInternallyFailedPayment($this, new \Exception('Auto billing failed.', 400)); $this->processInternallyFailedPayment($this, new \Exception('Auto billing failed.', 400));
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_PAYPAL, $this->client, $this->client->company); SystemLogger::dispatch($response, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_PAYPAL, $this->client, $this->client->company);
} }
} }

View File

@ -5238,7 +5238,7 @@ $lang = array(
'local_domain_help' => 'EHLO domain (optional)', 'local_domain_help' => 'EHLO domain (optional)',
'port_help' => 'ie. 25,587,465', 'port_help' => 'ie. 25,587,465',
'host_help' => 'ie. smtp.gmail.com', 'host_help' => 'ie. smtp.gmail.com',
'always_show_required_fields' => 'Allows show required fields form', 'always_show_required_fields' => 'Always show required fields form',
'always_show_required_fields_help' => 'Displays the required fields form always at checkout', 'always_show_required_fields_help' => 'Displays the required fields form always at checkout',
'advanced_cards' => 'Advanced Cards', 'advanced_cards' => 'Advanced Cards',
'activity_140' => 'Statement sent to :client', 'activity_140' => 'Statement sent to :client',

View File

@ -30,16 +30,6 @@
@push('footer') @push('footer')
<script type="application/json" fncls="fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99">
{
"f":"{{ $guid }}",
"s":"paypal.pay" // unique ID for each web page
}
</script>
<script type="text/javascript" src="https://c.paypal.com/da/r/fb.js"></script>
<style type="text/css"> <style type="text/css">
.loader { .loader {
width: 48px; width: 48px;
@ -92,7 +82,7 @@ inset: 6px;
}, },
onApprove: function(data, actions) { onApprove: function(data, actions) {
console.log(data); document.getElementById('is_working').classList.remove('hidden');
document.getElementById("gateway_response").value =JSON.stringify( data ); document.getElementById("gateway_response").value =JSON.stringify( data );
@ -108,10 +98,15 @@ inset: 6px;
body: formData, body: formData,
}) })
.then(response => { .then(response => {
if (!response.ok) { if (!response.ok) {
throw new Error('Network response was not ok ' + response.statusText); return response.json().then(errorData => {
throw new Error(errorData.message ?? 'Unknown error.');
});
} }
return response.json(); // or response.json() if the response is JSON
return response.json();
}) })
.then(data => { .then(data => {
@ -135,8 +130,6 @@ inset: 6px;
document.getElementById('errors').hidden = false; document.getElementById('errors').hidden = false;
}); });
}, },
onCancel: function() { onCancel: function() {
window.location.href = "/client/invoices/"; window.location.href = "/client/invoices/";
@ -151,11 +144,12 @@ inset: 6px;
}, },
onClick: function (){ onClick: function (){
console.log(fundingSource);
if(fundingSource != 'card') if(fundingSource != 'card')
document.getElementById('paypal-button-container').hidden = true; document.getElementById('paypal-button-container').hidden = true;
document.getElementById('is_working').classList.remove('hidden'); // document.getElementById('is_working').classList.remove('hidden');
document.querySelector('div[data-ref="required-fields-container').classList.add('hidden'); document.querySelector('div[data-ref="required-fields-container').classList.add('hidden');
}, },
@ -176,6 +170,7 @@ inset: 6px;
} }
document.getElementById("server_response").classList.add('is-submitting'); document.getElementById("server_response").classList.add('is-submitting');
}); });
</script> </script>

View File

@ -66,10 +66,15 @@
body: formData, body: formData,
}) })
.then(response => { .then(response => {
if (!response.ok) { if (!response.ok) {
throw new Error('Network response was not ok ' + response.statusText); return response.json().then(errorData => {
throw new Error(errorData.message ?? 'Unknown error.');
});
} }
return response.json(); return response.json();
}) })
.then(data => { .then(data => {