Minor fixes for PayPalOM

This commit is contained in:
David Bomba 2024-09-06 08:54:26 +10:00
parent 7444355dee
commit 0017307e39
7 changed files with 39 additions and 29 deletions

View File

@ -481,6 +481,7 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
$data['guid'] = $this->risk_guid;
$data['identifier'] = "s:INN_".$this->company_gateway->getConfigField('merchantId')."_CHCK";
$data['pp_client_reference'] = $this->getClientHash();
$data['invoice_hash'] = $this->payment_hash->fee_invoice->hashed_id;
return $data;
}

View File

@ -434,7 +434,8 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
$data['guid'] = $this->risk_guid;
$data['identifier'] = "s:INN_ACDC_CHCK";
$data['pp_client_reference'] = $this->getClientHash();
$data['invoice_hash'] = $this->payment_hash->fee_invoice->hashed_id;
return $data;
}

1
public/build/assets/app-fee1da41.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,12 @@
@extends('portal.ninja2020.layout.payments', ['gateway_title' => ctrans('texts.paypal'), 'card_title' => ''])
@section('gateway_head')
<meta http-equiv="Content-Security-Policy" content="
frame-src 'self' https://c.paypal.com https://www.sandbox.paypal.com https://www.paypal.com https://www.paypalobjects.com;
script-src 'self' 'unsafe-inline' 'unsafe-eval' https://c.paypal.com https://www.paypalobjects.com https://www.paypal.com https://www.sandbox.paypal.com https://www.google-analytics.com;
img-src * data: 'self';
style-src 'self' 'unsafe-inline';"
>
@endsection
@section('gateway_content')
@ -82,6 +87,7 @@ inset: 6px;
},
onApprove: function(data, actions) {
document.getElementById('paypal-button-container').hidden = true;
document.getElementById('is_working').classList.remove('hidden');
document.getElementById("gateway_response").value =JSON.stringify( data );
@ -125,14 +131,19 @@ inset: 6px;
document.getElementById("server_response").submit();
})
.catch(error => {
document.getElementById('is_working').classList.add('hidden');
document.getElementById('paypal-button-container').hidden = false;
console.error('Error:', error);
document.getElementById('errors').textContent = `Sorry, your transaction could not be processed...\n\n${error.message}`;
document.getElementById('errors').hidden = false;
});
},
onCancel: function() {
window.location.href = "/client/invoices/";
window.location.href = "/client/invoices/{{ $invoice_hash }}";
},
onError: function(error) {
@ -143,14 +154,6 @@ inset: 6px;
document.getElementById("server_response").submit();
},
onClick: function (){
console.log(fundingSource);
if(fundingSource != 'card')
document.getElementById('paypal-button-container').hidden = true;
// document.getElementById('is_working').classList.remove('hidden');
document.querySelector('div[data-ref="required-fields-container').classList.add('hidden');
},
onInit: function (){

View File

@ -1,5 +1,14 @@
<div class="rounded-lg border bg-card text-card-foreground shadow-sm overflow-hidden p-5 bg-white sm:gap-4"
id="paypal-payment">
@section('gateway_head')
<meta http-equiv="Content-Security-Policy" content="
frame-src 'self' https://c.paypal.com https://www.sandbox.paypal.com https://www.paypal.com https://www.paypalobjects.com;
script-src 'self' 'unsafe-inline' 'unsafe-eval' https://c.paypal.com https://www.paypalobjects.com https://www.paypal.com https://www.sandbox.paypal.com https://www.google-analytics.com;
img-src * data: 'self';
style-src 'self' 'unsafe-inline';"
>
@endsection
<style type="text/css">
.loader {
width: 48px;
@ -106,8 +115,9 @@
},
onApprove: function(data, actions) {
console.log(data);
document.getElementById('paypal-button-container').hidden = true;
document.getElementById('is_working').classList.remove('hidden');
document.getElementById("gateway_response").value =JSON.stringify( data );
formData = JSON.stringify(Object.fromEntries(new FormData(document.getElementById("server_response")))),
@ -144,34 +154,27 @@
document.getElementById("server_response").submit();
})
.catch(error => {
document.getElementById('is_working').classList.add('hidden');
document.getElementById('paypal-button-container').hidden = false;
console.error('Error:', error);
document.getElementById('errors').textContent = `Sorry, your transaction could not be processed...\n\n${error.message}`;
document.getElementById('errors').hidden = false;
});
},
onCancel: function() {
window.location.href = "/client/invoices/";
window.location.href = "/client/invoices/{{ $invoice_hash }}";
},
onError: function(error) {
console.log("on error");
console.log(error);
document.getElementById("gateway_response").value = error;
document.getElementById("server_response").submit();
},
onClick: function (){
if(fundingSource != 'card')
document.getElementById('paypal-button-container').hidden = true;
document.getElementById('is_working').classList.remove('hidden');
// document.querySelector('div[data-ref="required-fields-container').classList.add('hidden');
onClick: function (data, actions){
},
onInit: function (){
console.log("init");
@ -192,5 +195,7 @@
document.getElementById("server_response").classList.add('is-submitting');
});
</script>
@endscript

View File

@ -185,8 +185,7 @@
},
onCancel: function() {
window.location.href = "/client/invoices/";
window.location.href = "/client/invoices/{{ $invoice_hash }}";
},
onClick: function (){

View File

@ -167,7 +167,7 @@
},
onCancel: function() {
window.location.href = "/client/invoices/";
window.location.href = "/client/invoices/{{ $invoice_hash }}";
},
// onError: function(error) {