Merge branch 'v5-develop' into v5-develop

This commit is contained in:
David Bomba 2020-12-04 07:41:36 +11:00 committed by GitHub
commit 34463eac64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 119031 additions and 116886 deletions

View File

@ -19,7 +19,6 @@ use App\Exceptions\ResourceDependencyMissing;
use App\Exceptions\ResourceNotAvailableForMigration;
use App\Jobs\Util\Import;
use App\Jobs\Util\StartMigration;
use App\Libraries\MultiDB;
use App\Mail\MigrationFailed;
use App\Models\Account;
use App\Models\Company;
@ -85,7 +84,6 @@ class ImportMigrations extends Command
foreach ($directory as $file) {
if ($file->getExtension() === 'zip') {
$user = $this->getUser();
$company = $this->getUser()->companies()->first();
@ -99,24 +97,24 @@ class ImportMigrations extends Command
throw new ProcessingMigrationArchiveFailed('Processing migration archive failed. Migration file is possibly corrupted.');
}
$filename = pathinfo($file->getRealPath(), PATHINFO_FILENAME);
$filename = pathinfo($file->getRealPath(), PATHINFO_FILENAME);
$zip->extractTo(public_path("storage/migrations/{$filename}"));
$zip->close();
$zip->extractTo(public_path("storage/migrations/{$filename}"));
$zip->close();
$import_file = public_path("storage/migrations/$filename/migration.json");
$import_file = public_path("storage/migrations/$filename/migration.json");
Import::dispatch($import_file, $this->getUser()->companies()->first(), $this->getUser());
// StartMigration::dispatch($file->getRealPath(), $this->getUser(), $this->getUser()->companies()->first());
Import::dispatch($import_file, $this->getUser()->companies()->first(), $this->getUser());
// StartMigration::dispatch($file->getRealPath(), $this->getUser(), $this->getUser()->companies()->first());
} catch (NonExistingMigrationFile | ProcessingMigrationArchiveFailed | ResourceNotAvailableForMigration | MigrationValidatorFailed | ResourceDependencyMissing $e) {
\Mail::to($this->user)->send(new MigrationFailed($e, $e->getMessage()));
if (app()->environment() !== 'production') {
info($e->getMessage());
}
}
catch (NonExistingMigrationFile | ProcessingMigrationArchiveFailed | ResourceNotAvailableForMigration | MigrationValidatorFailed | ResourceDependencyMissing $e) {
\Mail::to($this->user)->send(new MigrationFailed($e, $e->getMessage()));
if (app()->environment() !== 'production') {
info($e->getMessage());
}
}}}
}
}
}
public function getUser(): User

View File

@ -23,14 +23,17 @@ class PaymentWebhookController extends Controller
$this->middleware('guest');
}
public function __invoke(PaymentWebhookRequest $request, string $company_key, string $gateway_key)
public function __invoke(PaymentWebhookRequest $request, string $company_key = null, string $gateway_key = null)
{
$transaction_reference = $this->getTransactionReference($request->all());
$transaction_reference = $this->getTransactionReference($request->all(), $request);
$payment = Payment::where('transaction_reference', $transaction_reference)->first();
if (is_null($payment)) {
return response([], 404); /* Record event, throw an exception.. */
return response([
'message' => 'Sorry, we couldn\'t find requested payment.',
'status_code' => 404,
], 404); /* Record event, throw an exception.. */
}
return $request
@ -40,12 +43,16 @@ class PaymentWebhookController extends Controller
->processWebhookRequest($request->all(), $request->company(), $request->companyGateway(), $payment);
}
public function getTransactionReference(array $data)
public function getTransactionReference(array $data, PaymentWebhookRequest $request)
{
$flatten = Arr::dot($data);
if (isset($flatten['data.object.id'])) {
return $flatten['data.object.id']; // Request from Stripe
return $flatten['data.object.id']; // stripe.com
}
if ($request->has('cko-session-id')) {
// checkout.com
}
}
}

View File

@ -176,7 +176,7 @@ class SetupController extends Controller
if (count($response_array) == 0) {
return response([], 200);
} else {
return response()->json($response_array, 200);
return response()->json(['message' => $response_array[0]], 400);
}
} catch (Exception $e) {
info(['message' => $e->getMessage(), 'action' => 'SetupController::checkMail()']);

View File

@ -13,6 +13,7 @@ namespace App\Http;
use App\Http\Middleware\ApiSecretCheck;
use App\Http\Middleware\Authenticate;
use App\Http\Middleware\CheckClientExistence;
use App\Http\Middleware\CheckForMaintenanceMode;
use App\Http\Middleware\ClientPortalEnabled;
use App\Http\Middleware\ContactKeyLogin;
@ -155,5 +156,6 @@ class Kernel extends HttpKernel
'shop_token_auth' => ShopTokenAuth::class,
'phantom_secret' => PhantomSecret::class,
'contact_key_login' => ContactKeyLogin::class,
'check_client_existence' => CheckClientExistence::class,
];
}

View File

@ -0,0 +1,54 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Middleware;
use App\Models\ClientContact;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class CheckClientExistence
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
$multiple_contacts = ClientContact::query()
->where('email', auth('contact')->user()->email)
->whereNotNull('email')
->distinct('company_id')
->whereHas('client', function ($query) {
return $query->whereNull('deleted_at');
})
->get();
if (count($multiple_contacts) == 0) {
Auth::logout();
return redirect()->route('client.login');
}
if (count($multiple_contacts) == 1) {
Auth::guard('contact')->login($multiple_contacts[0], true);
}
session()->put('multiple_contacts', $multiple_contacts);
return $next($request);
}
}

View File

@ -11,7 +11,6 @@
namespace App\Http\ViewComposers;
use App\Models\ClientContact;
use App\Utils\Ninja;
use App\Utils\TranslationHelper;
use Illuminate\Support\Facades\Lang;
@ -55,7 +54,7 @@ class PortalComposer
$data['settings'] = auth()->user()->client->getMergedSettings();
$data['currencies'] = TranslationHelper::getCurrencies();
$data['multiple_contacts'] = ClientContact::where('email', auth('contact')->user()->email)->whereNotNull('email')->distinct('company_id')->get();
$data['multiple_contacts'] = session()->get('multiple_contacts');
return $data;
}

View File

@ -32,6 +32,7 @@ class DownloadInvoices extends Mailable
{
return $this->from(config('mail.from.address'), config('mail.from.name'))
->subject(ctrans('texts.download_files'))
->markdown(
'email.admin.download_files',

View File

@ -83,7 +83,6 @@ class BaseEmailEngine implements EngineInterface
public function setAttachments($attachments)
{
$this->attachments = array_merge($this->getAttachments(), $attachments);
return $this;

View File

@ -29,6 +29,7 @@ class ExistingMigration extends Mailable
{
return $this->from(config('mail.from.address'), config('mail.from.name'))
->view('email.migration.existing');
}
}

View File

@ -33,6 +33,7 @@ class MigrationFailed extends Mailable
{
return $this->from(config('mail.from.address'), config('mail.from.name'))
->view('email.migration.failed');
}
}

View File

@ -109,7 +109,7 @@ class CreditCard
$checkout_response = $this->checkout->payment_hash->data->server_response;
$method = new TokenSource(
$checkout_response->cardToken
$checkout_response->token
);
return $this->completePayment($method, $request);

View File

@ -60,7 +60,7 @@ trait Utilities
'payment_method' => $_payment->source['id'],
'payment_type' => PaymentType::parseCardType(strtolower($_payment->source['scheme'])),
'amount' => $this->checkout->payment_hash->data->raw_value,
'transaction_reference' => $_payment->reference,
'transaction_reference' => $_payment->id,
];
$payment = $this->checkout->createPayment($data, \App\Models\Payment::STATUS_COMPLETED);
@ -104,9 +104,10 @@ trait Utilities
private function processPendingPayment(Payment $_payment)
{
$data = [
'payment_method' => $_payment->source['id'],
'payment_type' => PaymentType::parseCardType(strtolower($_payment->source['scheme'])),
'payment_method' => $_payment->source->id,
'payment_type' => PaymentType::CREDIT_CARD_OTHER,
'amount' => $this->checkout->payment_hash->data->value,
'transaction_reference' => $_payment->id,
];
$payment = $this->checkout->createPayment($data, \App\Models\Payment::STATUS_PENDING);

View File

@ -73,7 +73,6 @@ class RefundPayment
{
if ($this->refund_data['gateway_refund'] !== false && $this->total_refund > 0) {
if ($this->payment->company_gateway) {
$response = $this->payment->company_gateway->driver($this->payment->client)->refund($this->payment, $this->total_refund);
$this->payment->refunded += $this->total_refund;
@ -84,7 +83,6 @@ class RefundPayment
$this->payment->save();
throw new PaymentRefundFailed();
}
}
} else {
$this->payment->refunded += $this->total_refund;

View File

@ -221,10 +221,9 @@ class SystemHealth
}
try {
Mail::to(config('mail.from.address'))
->send(new TestMailServer('Email Server Works!', config('mail.from.address')));
Mail::to(config('mail.from.address'))->send(new TestMailServer('Email Server Works!', config('mail.from.address')));
} catch (Exception $e) {
return $e->getMessage();
return [$e->getMessage()];
}
/*

View File

@ -23,7 +23,7 @@ return [
'date_time_format' => 'Y-m-d H:i',
'daily_email_limit' => 300,
'error_email' => env('ERROR_EMAIL', ''),
'mailer' => env('MAIL_MAILER',''),
'mailer' => env('MAIL_MAILER', ''),
'company_id' => 0,
'hash_salt' => env('HASH_SALT', ''),
'currency_converter_api_key' => env('OPENEXCHANGE_APP_ID', ''),

View File

@ -1 +1 @@
{"assets/images/payment_types/ach.png":["assets/images/payment_types/ach.png"],"assets/images/payment_types/amex.png":["assets/images/payment_types/amex.png"],"assets/images/payment_types/carteblanche.png":["assets/images/payment_types/carteblanche.png"],"assets/images/payment_types/dinerscard.png":["assets/images/payment_types/dinerscard.png"],"assets/images/payment_types/discover.png":["assets/images/payment_types/discover.png"],"assets/images/google-icon.png":["assets/images/google-icon.png"],"assets/images/payment_types/jcb.png":["assets/images/payment_types/jcb.png"],"assets/images/payment_types/laser.png":["assets/images/payment_types/laser.png"],"assets/images/logo.png":["assets/images/logo.png"],"assets/images/payment_types/maestro.png":["assets/images/payment_types/maestro.png"],"assets/images/payment_types/mastercard.png":["assets/images/payment_types/mastercard.png"],"packages/material_design_icons_flutter/lib/fonts/materialdesignicons-webfont.ttf":["packages/material_design_icons_flutter/lib/fonts/materialdesignicons-webfont.ttf"],"assets/images/payment_types/other.png":["assets/images/payment_types/other.png"],"assets/images/payment_types/paypal.png":["assets/images/payment_types/paypal.png"],"assets/images/payment_types/solo.png":["assets/images/payment_types/solo.png"],"assets/images/payment_types/switch.png":["assets/images/payment_types/switch.png"],"assets/images/payment_types/unionpay.png":["assets/images/payment_types/unionpay.png"],"assets/images/payment_types/visa.png":["assets/images/payment_types/visa.png"]}
{"assets/images/google-icon.png":["assets/images/google-icon.png"],"assets/images/logo.png":["assets/images/logo.png"],"assets/images/payment_types/ach.png":["assets/images/payment_types/ach.png"],"assets/images/payment_types/amex.png":["assets/images/payment_types/amex.png"],"assets/images/payment_types/carteblanche.png":["assets/images/payment_types/carteblanche.png"],"assets/images/payment_types/dinerscard.png":["assets/images/payment_types/dinerscard.png"],"assets/images/payment_types/discover.png":["assets/images/payment_types/discover.png"],"assets/images/payment_types/jcb.png":["assets/images/payment_types/jcb.png"],"assets/images/payment_types/laser.png":["assets/images/payment_types/laser.png"],"assets/images/payment_types/maestro.png":["assets/images/payment_types/maestro.png"],"assets/images/payment_types/mastercard.png":["assets/images/payment_types/mastercard.png"],"assets/images/payment_types/other.png":["assets/images/payment_types/other.png"],"assets/images/payment_types/paypal.png":["assets/images/payment_types/paypal.png"],"assets/images/payment_types/solo.png":["assets/images/payment_types/solo.png"],"assets/images/payment_types/switch.png":["assets/images/payment_types/switch.png"],"assets/images/payment_types/unionpay.png":["assets/images/payment_types/unionpay.png"],"assets/images/payment_types/visa.png":["assets/images/payment_types/visa.png"],"packages/material_design_icons_flutter/lib/fonts/materialdesignicons-webfont.ttf":["packages/material_design_icons_flutter/lib/fonts/materialdesignicons-webfont.ttf"]}

File diff suppressed because it is too large Load Diff

View File

@ -5,10 +5,10 @@ const CACHE_NAME = 'flutter-app-cache';
const RESOURCES = {
"version.json": "32afcc2282ccf7746c00708ef0601017",
"favicon.ico": "51636d3a390451561744c42188ccd628",
"main.dart.js": "93b0d3c3a17ae9148c1dfd198f6b450e",
"main.dart.js": "b3c0b8b130688ccb988a28e1ec1f4a26",
"/": "23224b5e03519aaa87594403d54412cf",
"favicon.png": "dca91c54388f52eded692718d5a98b8b",
"assets/AssetManifest.json": "ea09ed4b9b8b6c83d6896248aac7c527",
"assets/AssetManifest.json": "659dcf9d1baf3aed3ab1b9c42112bf8f",
"assets/fonts/MaterialIcons-Regular.otf": "1288c9e28052e028aba623321f7826ac",
"assets/FontManifest.json": "cf3c681641169319e61b61bd0277378f",
"assets/packages/material_design_icons_flutter/lib/fonts/materialdesignicons-webfont.ttf": "c1242726c7eac4eb5e843d826f78fb1b",
@ -29,7 +29,7 @@ const RESOURCES = {
"assets/assets/images/payment_types/switch.png": "4fa11c45327f5fdc20205821b2cfd9cc",
"assets/assets/images/payment_types/jcb.png": "07e0942d16c5592118b72e74f2f7198c",
"assets/assets/images/payment_types/discover.png": "6c0a386a00307f87db7bea366cca35f5",
"assets/NOTICES": "02aa30cfaaab572341a87cc774e7ef24",
"assets/NOTICES": "7d8f2aa600c3ae24c9efdad38c9f53b4",
"manifest.json": "77215c1737c7639764e64a192be2f7b8",
"icons/Icon-192.png": "bb1cf5f6982006952211c7c8404ffbed",
"icons/Icon-512.png": "0f9aff01367f0a0c69773d25ca16ef35"

View File

@ -1,2 +1,2 @@
/*! For license information please see checkout.com.js.LICENSE.txt */
!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=8)}({8:function(e,t,n){e.exports=n("XYrq")},XYrq:function(e,t){document.getElementById("toggle-payment-with-token").addEventListener("click",(function(){document.getElementById("save-card--container").style.display="none",document.getElementById("checkout--container").style.display="none",document.getElementById("pay-now-with-token--container").style.display="block",document.querySelector("input[name=pay_with_token]").value=!0})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",(function(){document.getElementById("save-card--container").style.display="grid",document.getElementById("checkout--container").style.display="block",document.getElementById("pay-now-with-token--container").style.display="none",document.querySelector("input[name=pay_with_token]").value=!1}));var n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;e&&(document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.data)),document.querySelector('input[name="store_card"]').value=document.querySelector("input[name=token-billing-checkbox]:checked").value,document.getElementById("server-response").submit()};document.getElementById("pay-now-with-token").addEventListener("click",n),window.CKOConfig={publicKey:document.querySelector('meta[name="public-key"]').content,customerEmail:document.querySelector('meta[name="customer-email"]').content,value:document.querySelector('meta[name="value"]').content,currency:document.querySelector('meta[name="currency"]').content,paymentMode:"cards",cardFormMode:"cardTokenisation",cardTokenised:function(e){n(e)}}}});
!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=8)}({8:function(e,t,n){e.exports=n("XYrq")},XYrq:function(e,t){var n,o=document.getElementById("toggle-payment-with-token"),r=document.getElementById("toggle-payment-with-credit-card"),u=document.getElementById("pay-button"),a=document.getElementById("payment-form"),c=null!==(n=document.querySelector('meta[name="public-key"]').content)&&void 0!==n?n:"";o&&o.addEventListener("click",(function(){document.getElementById("save-card--container").style.display="none",document.getElementById("checkout--container").style.display="none",document.getElementById("pay-now-with-token--container").style.display="block",document.querySelector("input[name=pay_with_token]").value=!0})),r&&r.addEventListener("click",(function(){document.getElementById("save-card--container").style.display="grid",document.getElementById("checkout--container").style.display="block",document.getElementById("pay-now-with-token--container").style.display="none",document.querySelector("input[name=pay_with_token]").value=!1}));var d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;e&&(document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e)),document.querySelector('input[name="store_card"]').value=document.querySelector("input[name=token-billing-checkbox]:checked").value,document.getElementById("server-response").submit()};document.getElementById("pay-now-with-token")&&document.getElementById("pay-now-with-token").addEventListener("click",d),Frames.init(c),Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED,(function(e){u.disabled=!Frames.isCardValid()})),Frames.addEventHandler(Frames.Events.CARD_TOKENIZED,(function(e){d(e)})),a.addEventListener("submit",(function(e){e.preventDefault(),Frames.submitCard()}))}});

File diff suppressed because one or more lines are too long

234616
public/main.dart.js vendored

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@
"/js/clients/payment_methods/authorize-authorize-card.js": "/js/clients/payment_methods/authorize-authorize-card.js?id=cddcd46c630c71737bda",
"/js/clients/payments/authorize-credit-card-payment.js": "/js/clients/payments/authorize-credit-card-payment.js?id=caff3774673a6c683e74",
"/js/clients/payments/card-js.min.js": "/js/clients/payments/card-js.min.js?id=5469146cd629ea1b5c20",
"/js/clients/payments/checkout.com.js": "/js/clients/payments/checkout.com.js?id=4d5d992da65a0c422291",
"/js/clients/payments/checkout.com.js": "/js/clients/payments/checkout.com.js?id=ce184db42e52d403c21b",
"/js/clients/payments/stripe-ach.js": "/js/clients/payments/stripe-ach.js?id=c4012ad90f17d60432ad",
"/js/clients/payments/stripe-alipay.js": "/js/clients/payments/stripe-alipay.js?id=6dbe9316b98deea55421",
"/js/clients/payments/stripe-credit-card.js": "/js/clients/payments/stripe-credit-card.js?id=f4659d26a26d2f408397",
@ -15,6 +15,6 @@
"/js/clients/quotes/approve.js": "/js/clients/quotes/approve.js?id=85bcae0a646882e56b12",
"/js/clients/shared/multiple-downloads.js": "/js/clients/shared/multiple-downloads.js?id=5c35d28cf0a3286e7c45",
"/js/clients/shared/pdf.js": "/js/clients/shared/pdf.js?id=fa54bb4229aba6b0817c",
"/js/setup/setup.js": "/js/setup/setup.js?id=f42b2dee6575623822c2",
"/js/setup/setup.js": "/js/setup/setup.js?id=34b53878aeaca14a2b33",
"/css/card-js.min.css": "/css/card-js.min.css?id=62afeb675235451543ad"
}

View File

@ -8,9 +8,17 @@
* @license https://opensource.org/licenses/AAL
*/
document
.getElementById('toggle-payment-with-token')
.addEventListener('click', () => {
const paymentWithToken = document.getElementById('toggle-payment-with-token');
const paymentWithCreditCard = document.getElementById(
'toggle-payment-with-credit-card'
);
const payButton = document.getElementById('pay-button');
const form = document.getElementById('payment-form');
const publicKey =
document.querySelector('meta[name="public-key"]').content ?? '';
if (paymentWithToken) {
paymentWithToken.addEventListener('click', () => {
document.getElementById('save-card--container').style.display = 'none';
document.getElementById('checkout--container').style.display = 'none';
document.getElementById('pay-now-with-token--container').style.display =
@ -18,10 +26,10 @@ document
document.querySelector('input[name=pay_with_token]').value = true;
});
}
document
.getElementById('toggle-payment-with-credit-card')
.addEventListener('click', () => {
if (paymentWithCreditCard) {
paymentWithCreditCard.addEventListener('click', () => {
document.getElementById('save-card--container').style.display = 'grid';
document.getElementById('checkout--container').style.display = 'block';
document.getElementById('pay-now-with-token--container').style.display =
@ -29,12 +37,13 @@ document
document.querySelector('input[name=pay_with_token]').value = false;
});
}
const completePayment = (data = null) => {
if (data) {
document.querySelector(
'input[name="gateway_response"]'
).value = JSON.stringify(data.data);
).value = JSON.stringify(data);
}
document.querySelector(
@ -46,19 +55,36 @@ const completePayment = (data = null) => {
document.getElementById('server-response').submit();
};
document
.getElementById('pay-now-with-token')
.addEventListener('click', completePayment);
if (document.getElementById('pay-now-with-token')) {
document
.getElementById('pay-now-with-token')
.addEventListener('click', completePayment);
}
window.CKOConfig = {
publicKey: document.querySelector('meta[name="public-key"]').content,
customerEmail: document.querySelector('meta[name="customer-email"]')
.content,
value: document.querySelector('meta[name="value"]').content,
currency: document.querySelector('meta[name="currency"]').content,
paymentMode: 'cards',
cardFormMode: 'cardTokenisation',
cardTokenised: function(event) {
completePayment(event);
},
};
// window.CKOConfig = {
// publicKey: document.querySelector('meta[name="public-key"]').content,
// customerEmail: document.querySelector('meta[name="customer-email"]')
// .content,
// value: document.querySelector('meta[name="value"]').content,
// currency: document.querySelector('meta[name="currency"]').content,
// paymentMode: 'cards',
// cardFormMode: 'cardTokenisation',
// cardTokenised: function(event) {
// completePayment(event);
// },
// };
Frames.init(publicKey);
Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED, function(event) {
payButton.disabled = !Frames.isCardValid();
});
Frames.addEventHandler(Frames.Events.CARD_TOKENIZED, function(event) {
completePayment(event)
});
form.addEventListener('submit', function(event) {
event.preventDefault();
Frames.submitCard();
});

View File

@ -32,7 +32,9 @@ class Setup {
Axios.post('/setup/check_db', data)
.then((response) => this.handleSuccess(this.checkDbAlert))
.catch((e) => this.handleFailure(this.checkDbAlert, e.response.data.message));
.catch((e) =>
this.handleFailure(this.checkDbAlert, e.response.data.message)
);
}
handleSmtpCheck() {
@ -51,9 +53,14 @@ class Setup {
.value,
};
this.checkSmtpButton.disabled = true;
Axios.post('/setup/check_mail', data)
.then((response) => this.handleSuccess(this.checkSmtpAlert))
.catch((e) => this.handleFailure(this.checkSmtpAlert));
.catch((e) =>
this.handleFailure(this.checkSmtpAlert, e.response.data.message)
)
.finally(() => (this.checkSmtpButton.disabled = false));
}
handleTestPdfCheck() {
@ -71,7 +78,7 @@ class Setup {
})
.catch((error) => {
console.log(error);
this.handleFailure(this.checkPdfAlert)
this.handleFailure(this.checkPdfAlert);
});
}
@ -83,7 +90,9 @@ class Setup {
handleFailure(element, message = null) {
element.classList.remove('alert-success');
element.innerText = message ? message : "Oops, looks like something isn't correct!";
element.innerText = message
? message
: "Oops, looks like something isn't correct!";
element.classList.add('alert-failure');
}

View File

@ -3313,4 +3313,5 @@ return [
'shipping_country' => 'Shipping Country',
'service' => 'Service',
'pay' => 'Pay',
];

View File

@ -55,7 +55,7 @@
{!! \App\Utils\Number::formatMoney($payment->amount, $payment->client) !!}
</td>
<td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 text-gray-500">
{{ $payment->transaction_reference }}
{{ \Illuminate\Support\Str::limit($payment->transaction_reference, 35) }}
</td>
<td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 text-gray-500">
{!! \App\Models\Payment::badgeForStatus($payment->status_id) !!}

View File

@ -6,6 +6,9 @@
<meta name="value" content="{{ $value }}">
<meta name="currency" content="{{ $currency }}">
<meta name="reference" content="{{ $payment_hash }}">
<style>*,*::after,*::before{box-sizing:border-box}html{background-color:#FFF;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif}#payment-form{width:31.5rem;margin:0 auto}iframe{width:100%}.one-liner{display:flex;flex-direction:column}#pay-button{border:none;border-radius:3px;color:#FFF;font-weight:500;height:40px;width:100%;background-color:#13395E;box-shadow:0 1px 3px 0 rgba(19,57,94,0.4)}#pay-button:active{background-color:#0B2A49;box-shadow:0 1px 3px 0 rgba(19,57,94,0.4)}#pay-button:hover{background-color:#15406B;box-shadow:0 2px 5px 0 rgba(19,57,94,0.4)}#pay-button:disabled{background-color:#697887;box-shadow:none}#pay-button:not(:disabled){cursor:pointer}.card-frame{border:solid 1px #13395E;border-radius:3px;width:100%;margin-bottom:8px;height:40px;box-shadow:0 1px 3px 0 rgba(19,57,94,0.2)}.card-frame.frame--rendered{opacity:1}.card-frame.frame--rendered.frame--focus{border:solid 1px #13395E;box-shadow:0 2px 5px 0 rgba(19,57,94,0.15)}.card-frame.frame--rendered.frame--invalid{border:solid 1px #D96830;box-shadow:0 2px 5px 0 rgba(217,104,48,0.15)}.success-payment-message{color:#13395E;line-height:1.4}.token{color:#b35e14;font-size:0.9rem;font-family:monospace}@media screen and (min-width: 31rem){.one-liner{flex-direction:row}.card-frame{width:318px;margin-bottom:0}#pay-button{width:175px;margin-left:8px}}</style>
<script src="https://cdn.checkout.com/js/framesv2.min.js"></script>
@endsection
@section('gateway_content')
@ -34,13 +37,16 @@
@include('portal.ninja2020.gateways.includes.payment_details')
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.pay_with')])
<label class="mr-4">
<input
type="radio"
id="toggle-payment-with-token"
class="form-radio cursor-pointer" name="payment-type" />
<span class="ml-1 cursor-pointer">**** {{ $token->meta->last4 }}</span>
</label>
@isset($token)
<label class="mr-4">
<input
type="radio"
id="toggle-payment-with-token"
class="form-radio cursor-pointer" name="payment-type" />
<span class="ml-1 cursor-pointer">**** {{ $token->meta->last4 }}</span>
</label>
@endisset
<label>
<input
type="radio"
@ -55,13 +61,20 @@
@include('portal.ninja2020.gateways.includes.save_card')
@component('portal.ninja2020.components.general.card-element-single')
<form class="payment-form" method="POST" action="#" id="checkout--container">
@if(app()->environment() == 'production')
<script async src="https://cdn.checkout.com/js/checkout.js"></script>
@else
<script async src="https://cdn.checkout.com/sandbox/js/checkout.js"></script>
@endif
</form>
<div id="checkout--container">
<form id="payment-form" method="POST" action="#">
<div class="one-liner">
<div class="card-frame">
<!-- form will be added here -->
</div>
<!-- add submit button -->
<button id="pay-button" disabled>
{{ ctrans('texts.pay') }} {{ App\Utils\Number::formatMoney($total['amount_with_fee'], $client) }}
</button>
</div>
<p class="success-payment-message"></p>
</form>
</div>
@endcomponent
@component('portal.ninja2020.components.general.card-element-single')

View File

@ -180,6 +180,6 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
Route::post('support/messages/send', 'Support\Messages\SendingController');
});
Route::match(['get', 'post'], 'payment_webhook/{company_key}/{gateway_key}', 'PaymentWebhookController');
Route::match(['get', 'post'], 'payment_webhook/{company_key?}/{gateway_key?}', 'PaymentWebhookController');
Route::fallback('BaseController@notFound');

View File

@ -24,7 +24,7 @@ Route::get('tmp_pdf/{hash}', 'ClientPortal\TempRouteController@index')->name('tm
Route::get('client/key_login/{contact_key}', 'ClientPortal\ContactHashLoginController@login')->name('client.contact_login')->middleware(['contact_key_login']);
//todo implement domain DB
Route::group(['middleware' => ['auth:contact', 'locale'], 'prefix' => 'client', 'as' => 'client.'], function () {
Route::group(['middleware' => ['auth:contact', 'locale', 'check_client_existence'], 'prefix' => 'client', 'as' => 'client.'], function () {
Route::get('dashboard', 'ClientPortal\DashboardController@index')->name('dashboard'); // name = (dashboard. index / create / show / update / destroy / edit
Route::get('invoices', 'ClientPortal\InvoiceController@index')->name('invoices.index')->middleware('portal_enabled');