mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
updated resources
This commit is contained in:
parent
b805bba375
commit
e61c2422ee
@ -369,13 +369,30 @@ class PayPalBasePaymentDriver extends BaseDriver
|
||||
|
||||
}
|
||||
|
||||
public function handleProcessingFailure(array $response)
|
||||
{
|
||||
|
||||
SystemLogger::dispatch(
|
||||
['response' => $response],
|
||||
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||
SystemLog::EVENT_GATEWAY_FAILURE,
|
||||
SystemLog::TYPE_PAYPAL,
|
||||
$this->client,
|
||||
$this->client->company ?? $this->company_gateway->company,
|
||||
);
|
||||
|
||||
switch ($response['name']) {
|
||||
case 'NOT_AUTHORIZED':
|
||||
throw new PaymentFailed("There was a permissions issue processing this payment, please contact the merchant. ", 401);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new PaymentFailed("Unknown error occurred processing payment. Please contact merchant.", 500);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function handleRetry($response, $request) {
|
||||
|
||||
// $response = $r->json();
|
||||
// nlog($response['details']);
|
||||
|
||||
// if(in_array($response['details'][0]['issue'], ['INSTRUMENT_DECLINED', 'PAYER_ACTION_REQUIRED']))
|
||||
|
||||
return response()->json($response->json());
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
|
||||
*/
|
||||
public function processPaymentResponse($request)
|
||||
{
|
||||
|
||||
nlog("response");
|
||||
$this->init();
|
||||
|
||||
$request['gateway_response'] = str_replace("Error: ", "", $request['gateway_response']);
|
||||
@ -73,12 +73,7 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
|
||||
|
||||
//capture
|
||||
|
||||
if(!isset($response['orderID']) && isset($response['name']) && $response['name'] == "UNPROCESSABLE_ENTITY"){
|
||||
$this->handleDuplicateInvoiceId($this->payment_hash->data->orderID);
|
||||
$response['orderID'] = $this->payment_hash->data->orderID;
|
||||
}
|
||||
|
||||
$orderID = $response['orderID'];
|
||||
$orderID = $response['orderID'] ?? $this->payment_hash->data->orderID;
|
||||
|
||||
if($this->company_gateway->require_shipping_address) {
|
||||
|
||||
@ -106,7 +101,10 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
|
||||
|
||||
if($r->status() == 422){
|
||||
//handle conditions where the client may need to try again.
|
||||
return $this->handleRetry($r, $request);
|
||||
|
||||
$r = $this->handleDuplicateInvoiceId($orderID);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -287,13 +285,19 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
|
||||
$r = $this->gatewayRequest('/v2/checkout/orders', 'post', $order);
|
||||
|
||||
nlog($r->json());
|
||||
|
||||
$this->payment_hash->withData("orderID", $r->json()['id']);
|
||||
$response = $r->json();
|
||||
|
||||
return $r->json()['id'];
|
||||
if(!isset($response['id']))
|
||||
$this->handleProcessingFailure($response);
|
||||
|
||||
$this->payment_hash->withData("orderID", $response['id']);
|
||||
|
||||
return $response['id'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* processTokenPayment
|
||||
*
|
||||
|
File diff suppressed because one or more lines are too long
@ -240,7 +240,7 @@
|
||||
"src": "resources/js/setup/setup.js"
|
||||
},
|
||||
"resources/sass/app.scss": {
|
||||
"file": "assets/app-d1d7e29f.css",
|
||||
"file": "assets/app-2a1d3e58.css",
|
||||
"isEntry": true,
|
||||
"src": "resources/sass/app.scss"
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div wire:ignore.self class="@unless($form_only) container mx-auto grid grid-cols-12 @endunless mb-4" data-ref="required-fields-container">
|
||||
<div wire:ignore.self class="@unless($form_only) container mx-auto grid grid-cols-12 @endunless mb-4 transition-height duration-1000 ease-in-out h-500" data-ref="required-fields-container">
|
||||
<div class="col-span-12 lg:col-span-6 lg:col-start-4 overflow-hidden @unless($form_only) bg-white shadow rounded-lg @endunless">
|
||||
@unless($form_only)
|
||||
<div class="px-4 py-5 border-b border-gray-200 sm:px-6">
|
||||
|
@ -16,7 +16,12 @@
|
||||
|
||||
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
||||
|
||||
<div id="paypal-button-container" class="paypal-button-container"></div>
|
||||
<div id="paypal-button-container" class="paypal-button-container">
|
||||
</div>
|
||||
|
||||
<div id="is_working" class="flex mt-4 place-items-center hidden">
|
||||
<span class="loader m-auto"></span>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@ -24,7 +29,40 @@
|
||||
@endsection
|
||||
|
||||
@push('footer')
|
||||
|
||||
<style type="text/css">
|
||||
.loader {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
animation: rotate 1s linear infinite
|
||||
}
|
||||
.loader::before , .loader::after {
|
||||
content: "";
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
inset: 0px;
|
||||
border-radius: 50%;
|
||||
border: 5px solid #454545;
|
||||
animation: prixClipFix 2s linear infinite ;
|
||||
}
|
||||
.loader::after{
|
||||
border-color: #FF3D00;
|
||||
animation: prixClipFix 2s linear infinite , rotate 0.5s linear infinite reverse;
|
||||
inset: 6px;
|
||||
}
|
||||
@keyframes rotate {
|
||||
0% {transform: rotate(0deg)}
|
||||
100% {transform: rotate(360deg)}
|
||||
}
|
||||
@keyframes prixClipFix {
|
||||
0% {clip-path:polygon(50% 50%,0 0,0 0,0 0,0 0,0 0)}
|
||||
25% {clip-path:polygon(50% 50%,0 0,100% 0,100% 0,100% 0,100% 0)}
|
||||
50% {clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,100% 100%,100% 100%)}
|
||||
75% {clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,0 100%,0 100%)}
|
||||
100% {clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,0 100%,0 0)}
|
||||
}
|
||||
</style>
|
||||
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}¤cy={!! $currency !!}&components=buttons,funding-eligibility&intent=capture&enable-funding={!! $funding_source !!}" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
|
||||
|
||||
<script>
|
||||
@ -106,6 +144,8 @@
|
||||
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');
|
||||
|
||||
},
|
||||
|
@ -75,7 +75,6 @@
|
||||
@endsection
|
||||
|
||||
@push('footer')
|
||||
<link rel="stylesheet" type="text/css" href=https://www.paypalobjects.com/webstatic/en_US/developer/docs/css/cardfields.css />
|
||||
|
||||
@if(isset($merchantId))
|
||||
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}&merchantId={!! $merchantId !!}&components=card-fields" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
|
||||
@ -87,24 +86,7 @@
|
||||
const clientId = "{{ $client_id }}";
|
||||
const orderId = "{!! $order_id !!}";
|
||||
|
||||
const cardStyle = {
|
||||
'input': {
|
||||
'font-size': '16px',
|
||||
'font-family': 'courier, monospace',
|
||||
'font-weight': 'lighter',
|
||||
'color': '#ccc',
|
||||
},
|
||||
'.invalid': {
|
||||
'color': 'purple',
|
||||
},
|
||||
'.expcvv': {
|
||||
'display': 'grid',
|
||||
'grid-template-columns': 'auto'
|
||||
}
|
||||
};
|
||||
|
||||
const cardField = paypal.CardFields({
|
||||
// style: cardStyle,
|
||||
client: clientId,
|
||||
createOrder: function(data, actions) {
|
||||
return orderId;
|
||||
@ -125,7 +107,6 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
let storeCard = document.querySelector('input[name=token-billing-checkbox]:checked');
|
||||
|
||||
if (storeCard) {
|
||||
@ -197,7 +178,6 @@
|
||||
const numberField = cardField.NumberField({
|
||||
inputEvents: {
|
||||
onChange: (event)=> {
|
||||
// console.log("returns a stateObject", event);
|
||||
}
|
||||
},
|
||||
});
|
||||
@ -207,7 +187,6 @@
|
||||
const cvvField = cardField.CVVField({
|
||||
inputEvents: {
|
||||
onChange: (event)=> {
|
||||
// console.log("returns a stateObject", event);
|
||||
}
|
||||
},
|
||||
});
|
||||
@ -216,7 +195,6 @@
|
||||
const expiryField = cardField.ExpiryField({
|
||||
inputEvents: {
|
||||
onChange: (event)=> {
|
||||
// console.log("returns a stateObject", event);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -50,8 +50,10 @@
|
||||
document.addEventListener('livewire:init', () => {
|
||||
|
||||
Livewire.on('passed-required-fields-check', () => {
|
||||
document.querySelector('div[data-ref="required-fields-container"]').classList.add('opacity-25');
|
||||
document.querySelector('div[data-ref="required-fields-container"]').classList.add('pointer-events-none');
|
||||
|
||||
document.querySelector('div[data-ref="required-fields-container"]').classList.toggle('h-0');
|
||||
// document.querySelector('div[data-ref="required-fields-container"]').classList.add('opacity-25');
|
||||
// document.querySelector('div[data-ref="required-fields-container"]').classList.add('pointer-events-none');
|
||||
|
||||
document.querySelector('div[data-ref="gateway-container"]').classList.remove('opacity-25');
|
||||
document.querySelector('div[data-ref="gateway-container"]').classList.remove('pointer-events-none');
|
||||
|
@ -15,6 +15,9 @@ module.exports = {
|
||||
fontFamily: {
|
||||
sans: ['Open Sans', ...defaultTheme.fontFamily.sans],
|
||||
},
|
||||
transitionProperty: {
|
||||
'height': 'height'
|
||||
}
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
|
Loading…
Reference in New Issue
Block a user