mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 12:44:31 -04:00
commit
582e6828d7
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
@ -49,6 +49,7 @@ jobs:
|
|||||||
sudo rm -rf bootstrap/cache/*
|
sudo rm -rf bootstrap/cache/*
|
||||||
sudo rm -rf node_modules
|
sudo rm -rf node_modules
|
||||||
sudo rm -rf .git
|
sudo rm -rf .git
|
||||||
|
sudo rm .env
|
||||||
|
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: |
|
run: |
|
||||||
|
@ -1 +1 @@
|
|||||||
5.3.29
|
5.3.30
|
@ -20,6 +20,7 @@ use App\Models\Company;
|
|||||||
use App\Models\CompanyLedger;
|
use App\Models\CompanyLedger;
|
||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
|
use App\Models\CreditInvitation;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\InvoiceInvitation;
|
use App\Models\InvoiceInvitation;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
@ -99,11 +100,17 @@ class CheckData extends Command
|
|||||||
config(['database.default' => $database]);
|
config(['database.default' => $database]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->checkInvoiceBalances();
|
// $this->checkInvoiceBalances();
|
||||||
$this->checkInvoicePayments();
|
$this->checkInvoiceBalancesNew();
|
||||||
$this->checkPaidToDates();
|
//$this->checkInvoicePayments();
|
||||||
|
|
||||||
|
//$this->checkPaidToDates();
|
||||||
|
|
||||||
|
$this->checkPaidToDatesNew();
|
||||||
|
|
||||||
// $this->checkPaidToCompanyDates();
|
// $this->checkPaidToCompanyDates();
|
||||||
$this->checkClientBalances();
|
$this->checkClientBalances();
|
||||||
|
|
||||||
$this->checkContacts();
|
$this->checkContacts();
|
||||||
$this->checkEntityInvitations();
|
$this->checkEntityInvitations();
|
||||||
$this->checkCompanyData();
|
$this->checkCompanyData();
|
||||||
@ -324,6 +331,7 @@ class CheckData extends Command
|
|||||||
RecurringInvoiceInvitation::where('deleted_at',"0000-00-00 00:00:00.000000")->withTrashed()->update(['deleted_at' => null]);
|
RecurringInvoiceInvitation::where('deleted_at',"0000-00-00 00:00:00.000000")->withTrashed()->update(['deleted_at' => null]);
|
||||||
InvoiceInvitation::where('deleted_at',"0000-00-00 00:00:00.000000")->withTrashed()->update(['deleted_at' => null]);
|
InvoiceInvitation::where('deleted_at',"0000-00-00 00:00:00.000000")->withTrashed()->update(['deleted_at' => null]);
|
||||||
QuoteInvitation::where('deleted_at',"0000-00-00 00:00:00.000000")->withTrashed()->update(['deleted_at' => null]);
|
QuoteInvitation::where('deleted_at',"0000-00-00 00:00:00.000000")->withTrashed()->update(['deleted_at' => null]);
|
||||||
|
CreditInvitation::where('deleted_at',"0000-00-00 00:00:00.000000")->withTrashed()->update(['deleted_at' => null]);
|
||||||
|
|
||||||
$entities = ['invoice', 'quote', 'credit', 'recurring_invoice'];
|
$entities = ['invoice', 'quote', 'credit', 'recurring_invoice'];
|
||||||
|
|
||||||
@ -406,6 +414,82 @@ class CheckData extends Command
|
|||||||
// });
|
// });
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
private function clientPaidToDateQuery()
|
||||||
|
{
|
||||||
|
$results = \DB::select( \DB::raw("
|
||||||
|
SELECT
|
||||||
|
clients.id as client_id,
|
||||||
|
clients.paid_to_date as client_paid_to_date,
|
||||||
|
SUM(coalesce(payments.amount - payments.refunded,0)) as payments_applied
|
||||||
|
FROM clients
|
||||||
|
INNER JOIN
|
||||||
|
payments ON
|
||||||
|
clients.id=payments.client_id
|
||||||
|
WHERE payments.status_id IN (1,4,5,6)
|
||||||
|
AND clients.is_deleted = false
|
||||||
|
AND payments.is_deleted = false
|
||||||
|
GROUP BY clients.id
|
||||||
|
HAVING payments_applied != client_paid_to_date
|
||||||
|
ORDER BY clients.id;
|
||||||
|
") );
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function clientCreditPaymentables($client)
|
||||||
|
{
|
||||||
|
$results = \DB::select( \DB::raw("
|
||||||
|
SELECT
|
||||||
|
SUM(paymentables.amount - paymentables.refunded) as credit_payment
|
||||||
|
FROM payments
|
||||||
|
LEFT JOIN paymentables
|
||||||
|
ON
|
||||||
|
payments.id = paymentables.payment_id
|
||||||
|
WHERE paymentable_type = 'App\\Models\\Credit'
|
||||||
|
AND paymentables.deleted_at is NULL
|
||||||
|
AND payments.client_id = ?;
|
||||||
|
"), [$client->id] );
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkPaidToDatesNew()
|
||||||
|
{
|
||||||
|
$clients_to_check = $this->clientPaidToDateQuery();
|
||||||
|
|
||||||
|
$this->wrong_paid_to_dates = 0;
|
||||||
|
|
||||||
|
foreach($clients_to_check as $_client)
|
||||||
|
{
|
||||||
|
$client = Client::withTrashed()->find($_client->client_id);
|
||||||
|
|
||||||
|
$credits_used_for_payments = $this->clientCreditPaymentables($client);
|
||||||
|
|
||||||
|
$total_paid_to_date = $_client->payments_applied + $credits_used_for_payments[0]->credit_payment;
|
||||||
|
|
||||||
|
if(round($total_paid_to_date,2) != round($_client->client_paid_to_date,2)){
|
||||||
|
|
||||||
|
$this->wrong_paid_to_dates++;
|
||||||
|
|
||||||
|
$this->logMessage($client->present()->name.' id = # '.$client->id." - Paid to date does not match Client Paid To Date = {$client->paid_to_date} - Invoice Payments = {$total_paid_to_date}");
|
||||||
|
|
||||||
|
$this->isValid = false;
|
||||||
|
|
||||||
|
if($this->option('paid_to_date')){
|
||||||
|
$this->logMessage("# {$client->id} " . $client->present()->name.' - '.$client->number." Fixing {$client->paid_to_date} to {$total_paid_to_date}");
|
||||||
|
$client->paid_to_date = $total_paid_to_date;
|
||||||
|
$client->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->logMessage("{$this->wrong_paid_to_dates} clients with incorrect paid to dates");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function checkPaidToDates()
|
private function checkPaidToDates()
|
||||||
{
|
{
|
||||||
@ -482,6 +566,29 @@ class CheckData extends Command
|
|||||||
$this->logMessage("{$this->wrong_paid_to_dates} clients with incorrect paid to dates");
|
$this->logMessage("{$this->wrong_paid_to_dates} clients with incorrect paid to dates");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
SELECT
|
||||||
|
SUM(payments.applied) as payments_applied,
|
||||||
|
SUM(invoices.amount - invoices.balance) as invoices_paid_amount,
|
||||||
|
SUM(credits.amount - credits.balance) as credits_balance,
|
||||||
|
SUM(invoices.balance) as invoices_balance,
|
||||||
|
clients.id
|
||||||
|
FROM payments
|
||||||
|
JOIN clients
|
||||||
|
ON clients.id = payments.client_id
|
||||||
|
JOIN credits
|
||||||
|
ON credits.client_id = clients.id
|
||||||
|
JOIN invoices
|
||||||
|
ON invoices.client_id = payments.client_id
|
||||||
|
WHERE payments.is_deleted = 0
|
||||||
|
AND payments.status_id IN (1,4,5,6)
|
||||||
|
AND invoices.is_deleted = 0
|
||||||
|
AND invoices.status_id != 1
|
||||||
|
GROUP BY clients.id
|
||||||
|
HAVING (payments_applied - credits_balance - invoices_balance) != invoices_paid_amount
|
||||||
|
ORDER BY clients.id;
|
||||||
|
*/
|
||||||
|
|
||||||
private function checkInvoicePayments()
|
private function checkInvoicePayments()
|
||||||
{
|
{
|
||||||
$this->wrong_balances = 0;
|
$this->wrong_balances = 0;
|
||||||
@ -496,8 +603,6 @@ class CheckData extends Command
|
|||||||
->pluck('p')
|
->pluck('p')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
// $total_paid = $total_amount - $total_refund;
|
|
||||||
|
|
||||||
$total_credit = $invoice->credits()->get()->sum('amount');
|
$total_credit = $invoice->credits()->get()->sum('amount');
|
||||||
|
|
||||||
$calculated_paid_amount = $invoice->amount - $invoice->balance - $total_credit;
|
$calculated_paid_amount = $invoice->amount - $invoice->balance - $total_credit;
|
||||||
@ -543,7 +648,26 @@ class CheckData extends Command
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private function clientBalanceQuery()
|
||||||
|
{
|
||||||
|
$results = \DB::select( \DB::raw("
|
||||||
|
SELECT
|
||||||
|
SUM(invoices.balance) as invoice_balance,
|
||||||
|
clients.id as client_id,
|
||||||
|
clients.balance as client_balance
|
||||||
|
FROM clients
|
||||||
|
LEFT JOIN
|
||||||
|
invoices ON
|
||||||
|
clients.id=invoices.client_id
|
||||||
|
WHERE invoices.is_deleted = false
|
||||||
|
AND invoices.status_id > 1
|
||||||
|
GROUP BY clients.id
|
||||||
|
HAVING invoice_balance != clients.balance
|
||||||
|
ORDER BY clients.id;
|
||||||
|
") );
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -553,26 +677,67 @@ class CheckData extends Command
|
|||||||
$this->wrong_balances = 0;
|
$this->wrong_balances = 0;
|
||||||
$this->wrong_paid_to_dates = 0;
|
$this->wrong_paid_to_dates = 0;
|
||||||
|
|
||||||
foreach (Client::cursor()->where('is_deleted', 0)->where('clients.updated_at', '>', now()->subDays(2)) as $client) {
|
$clients = $this->clientBalanceQuery();
|
||||||
//$invoice_balance = $client->invoices->where('is_deleted', false)->where('status_id', '>', 1)->sum('balance');
|
|
||||||
$invoice_balance = Invoice::where('client_id', $client->id)->where('is_deleted', false)->where('status_id', '>', 1)->withTrashed()->sum('balance');
|
|
||||||
$credit_balance = Credit::where('client_id', $client->id)->where('is_deleted', false)->withTrashed()->sum('balance');
|
|
||||||
|
|
||||||
/*Legacy - V4 will add credits to the balance - we may need to reverse engineer this and remove the credits from the client balance otherwise we need this hack here and in the invoice balance check.*/
|
foreach($clients as $client)
|
||||||
if($client->balance != $invoice_balance)
|
{
|
||||||
$invoice_balance -= $credit_balance;
|
$client = (array)$client;
|
||||||
|
|
||||||
$ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first();
|
// $credit_balance = Credit::withTrashed()->where('is_deleted', 0)
|
||||||
|
// ->where('client_id', $client['client_id'])
|
||||||
|
// ->where('status_id', '>', 1)->sum('balance');
|
||||||
|
|
||||||
if ($ledger && (string) $invoice_balance != (string) $client->balance) {
|
// $invoice_balance = $client['invoice_balance'] - $credit_balance;
|
||||||
|
$invoice_balance = $client['invoice_balance'];
|
||||||
|
|
||||||
|
$ledger = CompanyLedger::where('client_id', $client['client_id'])->orderBy('id', 'DESC')->first();
|
||||||
|
|
||||||
|
if ($ledger && (string) $invoice_balance != (string) $client['client_balance']) {
|
||||||
$this->wrong_paid_to_dates++;
|
$this->wrong_paid_to_dates++;
|
||||||
$this->logMessage($client->present()->name.' - '.$client->id." - calculated client balances do not match Invoice Balances = {$invoice_balance} - Client Balance = ".rtrim($client->balance, '0'). " Ledger balance = {$ledger->balance}");
|
|
||||||
|
$client_object = Client::withTrashed()->find($client['client_id']);
|
||||||
|
|
||||||
|
$this->logMessage($client_object->present()->name.' - '.$client_object->id." - calculated client balances do not match Invoice Balances = {$invoice_balance} - Client Balance = ".rtrim($client['client_balance'], '0'). " Ledger balance = {$ledger->balance}");
|
||||||
|
|
||||||
|
|
||||||
|
if($this->option('client_balance')){
|
||||||
|
|
||||||
|
$this->logMessage("# {$client_object->id} " . $client_object->present()->name.' - '.$client_object->number." Fixing {$client_object->balance} to {$invoice_balance}");
|
||||||
|
$client_object->balance = $invoice_balance;
|
||||||
|
$client_object->save();
|
||||||
|
|
||||||
|
$ledger->adjustment = $invoice_balance;
|
||||||
|
$ledger->balance = $invoice_balance;
|
||||||
|
$ledger->notes = 'Ledger Adjustment';
|
||||||
|
$ledger->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->isValid = false;
|
$this->isValid = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// foreach (Client::cursor()->where('is_deleted', 0)->where('clients.updated_at', '>', now()->subDays(2)) as $client) {
|
||||||
|
|
||||||
|
// $invoice_balance = Invoice::where('client_id', $client->id)->where('is_deleted', false)->where('status_id', '>', 1)->withTrashed()->sum('balance');
|
||||||
|
// $credit_balance = Credit::where('client_id', $client->id)->where('is_deleted', false)->withTrashed()->sum('balance');
|
||||||
|
|
||||||
|
// if($client->balance != $invoice_balance)
|
||||||
|
// $invoice_balance -= $credit_balance;
|
||||||
|
|
||||||
|
// $ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first();
|
||||||
|
|
||||||
|
// if ($ledger && (string) $invoice_balance != (string) $client->balance) {
|
||||||
|
// $this->wrong_paid_to_dates++;
|
||||||
|
// $this->logMessage($client->present()->name.' - '.$client->id." - calculated client balances do not match Invoice Balances = {$invoice_balance} - Client Balance = ".rtrim($client->balance, '0'). " Ledger balance = {$ledger->balance}");
|
||||||
|
|
||||||
|
// $this->isValid = false;
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
$this->logMessage("{$this->wrong_paid_to_dates} clients with incorrect client balances");
|
$this->logMessage("{$this->wrong_paid_to_dates} clients with incorrect client balances");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,6 +748,68 @@ class CheckData extends Command
|
|||||||
//$ledger_adjustment = $ledger->balance - $client->balance;
|
//$ledger_adjustment = $ledger->balance - $client->balance;
|
||||||
//$ledger->balance += $ledger_adjustment
|
//$ledger->balance += $ledger_adjustment
|
||||||
|
|
||||||
|
private function invoiceBalanceQuery()
|
||||||
|
{
|
||||||
|
$results = \DB::select( \DB::raw("
|
||||||
|
SELECT
|
||||||
|
clients.id,
|
||||||
|
clients.balance,
|
||||||
|
SUM(invoices.balance) as invoices_balance
|
||||||
|
FROM clients
|
||||||
|
JOIN invoices
|
||||||
|
ON invoices.client_id = clients.id
|
||||||
|
WHERE invoices.is_deleted = 0
|
||||||
|
AND clients.is_deleted = 0
|
||||||
|
AND invoices.status_id != 1
|
||||||
|
GROUP BY clients.id
|
||||||
|
HAVING(invoices_balance != clients.balance)
|
||||||
|
ORDER BY clients.id;
|
||||||
|
") );
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkInvoiceBalancesNew()
|
||||||
|
{
|
||||||
|
$this->wrong_balances = 0;
|
||||||
|
$this->wrong_paid_to_dates = 0;
|
||||||
|
|
||||||
|
$_clients = $this->invoiceBalanceQuery();
|
||||||
|
|
||||||
|
foreach($_clients as $_client)
|
||||||
|
{
|
||||||
|
$client = Client::withTrashed()->find($_client->id);
|
||||||
|
|
||||||
|
$invoice_balance = $client->invoices()->where('is_deleted', false)->where('status_id', '>', 1)->sum('balance');
|
||||||
|
|
||||||
|
$ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first();
|
||||||
|
|
||||||
|
if ($ledger && number_format($invoice_balance, 4) != number_format($client->balance, 4)) {
|
||||||
|
$this->wrong_balances++;
|
||||||
|
$this->logMessage("# {$client->id} " . $client->present()->name.' - '.$client->number." - Balance Failure - Invoice Balances = {$invoice_balance} Client Balance = {$client->balance} Ledger Balance = {$ledger->balance}");
|
||||||
|
|
||||||
|
$this->isValid = false;
|
||||||
|
|
||||||
|
|
||||||
|
if($this->option('client_balance')){
|
||||||
|
|
||||||
|
$this->logMessage("# {$client->id} " . $client->present()->name.' - '.$client->number." Fixing {$client->balance} to {$invoice_balance}");
|
||||||
|
$client->balance = $invoice_balance;
|
||||||
|
$client->save();
|
||||||
|
|
||||||
|
$ledger->adjustment = $invoice_balance;
|
||||||
|
$ledger->balance = $invoice_balance;
|
||||||
|
$ledger->notes = 'Ledger Adjustment';
|
||||||
|
$ledger->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->logMessage("{$this->wrong_balances} clients with incorrect balances");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private function checkInvoiceBalances()
|
private function checkInvoiceBalances()
|
||||||
{
|
{
|
||||||
$this->wrong_balances = 0;
|
$this->wrong_balances = 0;
|
||||||
|
@ -127,7 +127,7 @@ class ImportMigrations extends Command
|
|||||||
$user = User::factory()->create([
|
$user = User::factory()->create([
|
||||||
'account_id' => $account->id,
|
'account_id' => $account->id,
|
||||||
'email' => Str::random(10) . "@example.com",
|
'email' => Str::random(10) . "@example.com",
|
||||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
'confirmation_code' => $this->createDbHash($company->db),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
CompanyToken::unguard();
|
CompanyToken::unguard();
|
||||||
|
@ -51,9 +51,9 @@ class RecurringExpenseToExpenseFactory
|
|||||||
$expense->payment_type_id = $recurring_expense->payment_type_id;
|
$expense->payment_type_id = $recurring_expense->payment_type_id;
|
||||||
$expense->project_id = $recurring_expense->project_id;
|
$expense->project_id = $recurring_expense->project_id;
|
||||||
$expense->invoice_documents = $recurring_expense->invoice_documents;
|
$expense->invoice_documents = $recurring_expense->invoice_documents;
|
||||||
$expense->tax_amount1 = $recurring_expense->tax_amount1;
|
$expense->tax_amount1 = $recurring_expense->tax_amount1 ?: 0;
|
||||||
$expense->tax_amount2 = $recurring_expense->tax_amount2;
|
$expense->tax_amount2 = $recurring_expense->tax_amount2 ?: 0;
|
||||||
$expense->tax_amount3 = $recurring_expense->tax_amount3;
|
$expense->tax_amount3 = $recurring_expense->tax_amount3 ?: 0;
|
||||||
$expense->uses_inclusive_taxes = $recurring_expense->uses_inclusive_taxes;
|
$expense->uses_inclusive_taxes = $recurring_expense->uses_inclusive_taxes;
|
||||||
$expense->calculate_tax_by_amount = $recurring_expense->calculate_tax_by_amount;
|
$expense->calculate_tax_by_amount = $recurring_expense->calculate_tax_by_amount;
|
||||||
|
|
||||||
|
@ -213,12 +213,18 @@ abstract class QueryFilters
|
|||||||
public function with_trashed($value)
|
public function with_trashed($value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($value == 'true'){
|
if($value == 'false'){
|
||||||
|
|
||||||
$this->builder->withTrashed();
|
return $this->builder->where('is_deleted', 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if($value == 'true'){
|
||||||
|
|
||||||
|
// $this->builder->withTrashed();
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,8 @@ class ContactRegisterController extends Controller
|
|||||||
|
|
||||||
$client_contact->client_id = $client->id;
|
$client_contact->client_id = $client->id;
|
||||||
$client_contact->is_primary = true;
|
$client_contact->is_primary = true;
|
||||||
|
|
||||||
|
if(array_key_exists('password', $data))
|
||||||
$client_contact->password = Hash::make($data['password']);
|
$client_contact->password = Hash::make($data['password']);
|
||||||
|
|
||||||
$client_contact->save();
|
$client_contact->save();
|
||||||
|
@ -257,8 +257,8 @@ class BaseController extends Controller
|
|||||||
'company.groups' => function ($query) use ($updated_at, $user) {
|
'company.groups' => function ($query) use ($updated_at, $user) {
|
||||||
$query->where('updated_at', '>=', $updated_at)->with('documents');
|
$query->where('updated_at', '>=', $updated_at)->with('documents');
|
||||||
|
|
||||||
if(!$user->isAdmin())
|
// if(!$user->isAdmin())
|
||||||
$query->where('group_settings.user_id', $user->id);
|
// $query->where('group_settings.user_id', $user->id);
|
||||||
},
|
},
|
||||||
'company.invoices'=> function ($query) use ($updated_at, $user) {
|
'company.invoices'=> function ($query) use ($updated_at, $user) {
|
||||||
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
|
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
|
||||||
@ -499,8 +499,8 @@ class BaseController extends Controller
|
|||||||
'company.groups' => function ($query) use ($created_at, $user) {
|
'company.groups' => function ($query) use ($created_at, $user) {
|
||||||
$query->where('created_at', '>=', $created_at)->with('documents');
|
$query->where('created_at', '>=', $created_at)->with('documents');
|
||||||
|
|
||||||
if(!$user->isAdmin())
|
// if(!$user->isAdmin())
|
||||||
$query->where('group_settings.user_id', $user->id);
|
// $query->where('group_settings.user_id', $user->id);
|
||||||
},
|
},
|
||||||
'company.invoices'=> function ($query) use ($created_at, $user) {
|
'company.invoices'=> function ($query) use ($created_at, $user) {
|
||||||
$query->where('created_at', '>=', $created_at)->with('invitations', 'documents');
|
$query->where('created_at', '>=', $created_at)->with('invitations', 'documents');
|
||||||
|
@ -80,7 +80,10 @@ class InvitationController extends Controller
|
|||||||
$query->where('is_deleted',0);
|
$query->where('is_deleted',0);
|
||||||
})
|
})
|
||||||
->with('contact.client')
|
->with('contact.client')
|
||||||
->firstOrFail();
|
->first();
|
||||||
|
|
||||||
|
if(!$invitation)
|
||||||
|
return abort(404,'The resource is no longer available.');
|
||||||
|
|
||||||
/* Return early if we have the correct client_hash embedded */
|
/* Return early if we have the correct client_hash embedded */
|
||||||
$client_contact = $invitation->contact;
|
$client_contact = $invitation->contact;
|
||||||
|
@ -13,8 +13,12 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use App\Jobs\Account\CreateAccount;
|
use App\Jobs\Account\CreateAccount;
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Client;
|
||||||
|
use App\Models\ClientContact;
|
||||||
|
use App\Models\Company;
|
||||||
use App\Models\CompanyToken;
|
use App\Models\CompanyToken;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
|
||||||
class HostedMigrationController extends Controller
|
class HostedMigrationController extends Controller
|
||||||
{
|
{
|
||||||
@ -49,4 +53,39 @@ class HostedMigrationController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function confirmForwarding(Request $request)
|
||||||
|
{
|
||||||
|
if($request->header('X-API-HOSTED-SECRET') != config('ninja.ninja_hosted_secret'))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$input = $request->all();
|
||||||
|
|
||||||
|
MultiDB::findAndSetDbByCompanyKey($input['account_key']);
|
||||||
|
|
||||||
|
$company = Company::with('account')->where('company_key', $input['account_key'])->first();
|
||||||
|
$account = $company->account;
|
||||||
|
$client_id = false;
|
||||||
|
|
||||||
|
if($contact = ClientContact::on('db-ninja-01')->where(['email' => $input['email'], 'company_id' => config('ninja.ninja_default_company_id')])->first()){
|
||||||
|
$client_id = $contact->client_id;
|
||||||
|
}
|
||||||
|
else if($client = Client::on('db-ninja-01')->where(['custom_value2' => $account->key, 'company_id' => config('ninja.ninja_default_company_id')])->first()){
|
||||||
|
$client_id = $client->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//get ninja client_id;
|
||||||
|
|
||||||
|
if(strlen($input['gateway_reference']) >1 && $client_id){
|
||||||
|
|
||||||
|
Artisan::call('ninja:add-token', [
|
||||||
|
'--customer' => $input['gateway_reference'], '--client_id' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$forward_url = $company->domain();
|
||||||
|
|
||||||
|
return response()->json(['forward_url' => $forward_url], 200);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -522,6 +522,9 @@ class InvoiceController extends BaseController
|
|||||||
|
|
||||||
$ids = request()->input('ids');
|
$ids = request()->input('ids');
|
||||||
|
|
||||||
|
nlog($action);
|
||||||
|
nlog($ids);
|
||||||
|
|
||||||
$invoices = Invoice::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
|
$invoices = Invoice::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
|
||||||
|
|
||||||
if (! $invoices) {
|
if (! $invoices) {
|
||||||
@ -532,13 +535,14 @@ class InvoiceController extends BaseController
|
|||||||
* Download Invoice/s
|
* Download Invoice/s
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'download' && $invoices->count() > 1) {
|
if ($action == 'bulk_download' && $invoices->count() > 1) {
|
||||||
$invoices->each(function ($invoice) {
|
$invoices->each(function ($invoice) {
|
||||||
if (auth()->user()->cannot('view', $invoice)) {
|
if (auth()->user()->cannot('view', $invoice)) {
|
||||||
|
nlog("access denied");
|
||||||
return response()->json(['message' => ctrans('text.access_denied')]);
|
return response()->json(['message' => ctrans('text.access_denied')]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
nlog("bulky");
|
||||||
ZipInvoices::dispatch($invoices, $invoices->first()->company, auth()->user());
|
ZipInvoices::dispatch($invoices, $invoices->first()->company, auth()->user());
|
||||||
|
|
||||||
return response()->json(['message' => ctrans('texts.sent_message')], 200);
|
return response()->json(['message' => ctrans('texts.sent_message')], 200);
|
||||||
@ -713,13 +717,13 @@ class InvoiceController extends BaseController
|
|||||||
$this->itemResponse($invoice);
|
$this->itemResponse($invoice);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'reverse':
|
// case 'reverse':
|
||||||
$invoice = $invoice->service()->handleReversal()->deletePdf()->save();
|
// $invoice = $invoice->service()->handleReversal()->deletePdf()->save();
|
||||||
|
|
||||||
if (! $bulk) {
|
// if (! $bulk) {
|
||||||
$this->itemResponse($invoice);
|
// $this->itemResponse($invoice);
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
case 'email':
|
case 'email':
|
||||||
//check query parameter for email_type and set the template else use calculateTemplate
|
//check query parameter for email_type and set the template else use calculateTemplate
|
||||||
|
|
||||||
|
@ -217,8 +217,6 @@ class PreviewController extends BaseController
|
|||||||
if(!$request->has('entity_id'))
|
if(!$request->has('entity_id'))
|
||||||
$entity_obj->service()->fillDefaults()->save();
|
$entity_obj->service()->fillDefaults()->save();
|
||||||
|
|
||||||
// $entity_obj->load('client.contacts','client.company');
|
|
||||||
|
|
||||||
App::forgetInstance('translator');
|
App::forgetInstance('translator');
|
||||||
$t = app('translator');
|
$t = app('translator');
|
||||||
App::setLocale($entity_obj->client->locale());
|
App::setLocale($entity_obj->client->locale());
|
||||||
|
@ -31,6 +31,7 @@ class SubdomainController extends BaseController
|
|||||||
'cname',
|
'cname',
|
||||||
'sandbox',
|
'sandbox',
|
||||||
'stage',
|
'stage',
|
||||||
|
'html',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
@ -50,6 +50,9 @@ class TokenController extends BaseController
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->token_repo = $token_repo;
|
$this->token_repo = $token_repo;
|
||||||
|
|
||||||
|
$this->middleware('password_protected')->only(['store','update']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +19,7 @@ use App\Factory\UserFactory;
|
|||||||
use App\Filters\UserFilters;
|
use App\Filters\UserFilters;
|
||||||
use App\Http\Controllers\Traits\VerifiesUserEmail;
|
use App\Http\Controllers\Traits\VerifiesUserEmail;
|
||||||
use App\Http\Requests\User\AttachCompanyUserRequest;
|
use App\Http\Requests\User\AttachCompanyUserRequest;
|
||||||
|
use App\Http\Requests\User\BulkUserRequest;
|
||||||
use App\Http\Requests\User\CreateUserRequest;
|
use App\Http\Requests\User\CreateUserRequest;
|
||||||
use App\Http\Requests\User\DestroyUserRequest;
|
use App\Http\Requests\User\DestroyUserRequest;
|
||||||
use App\Http\Requests\User\DetachCompanyUserRequest;
|
use App\Http\Requests\User\DetachCompanyUserRequest;
|
||||||
@ -534,8 +535,9 @@ class UserController extends BaseController
|
|||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function bulk()
|
public function bulk(BulkUserRequest $request)
|
||||||
{
|
{
|
||||||
|
/* Validate restore() here and check if restoring the user will exceed their user quote (hosted only)*/
|
||||||
$action = request()->input('action');
|
$action = request()->input('action');
|
||||||
|
|
||||||
$ids = request()->input('ids');
|
$ids = request()->input('ids');
|
||||||
|
@ -26,6 +26,8 @@ use Illuminate\Support\Facades\App;
|
|||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use App\DataMapper\ClientSettings;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class BillingPortalPurchase extends Component
|
class BillingPortalPurchase extends Component
|
||||||
@ -241,7 +243,8 @@ class BillingPortalPurchase extends Component
|
|||||||
'contacts' => [
|
'contacts' => [
|
||||||
['email' => $this->email],
|
['email' => $this->email],
|
||||||
],
|
],
|
||||||
'settings' => [],
|
'client_hash' => Str::random(40),
|
||||||
|
'settings' => ClientSettings::defaults(),
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($this->request_data as $field => $value) {
|
foreach ($this->request_data as $field => $value) {
|
||||||
|
@ -74,7 +74,7 @@ class SetInviteDb
|
|||||||
if (request()->json) {
|
if (request()->json) {
|
||||||
return response()->json($error, 403);
|
return response()->json($error, 403);
|
||||||
} else {
|
} else {
|
||||||
abort(404,'I could not find the database for this object.');
|
abort(404,'I could not find this resource.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ namespace App\Http\Requests\Client;
|
|||||||
|
|
||||||
use App\DataMapper\ClientSettings;
|
use App\DataMapper\ClientSettings;
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
|
use App\Http\ValidationRules\Client\CountryCodeExistsRule;
|
||||||
use App\Http\ValidationRules\Ninja\CanStoreClientsRule;
|
use App\Http\ValidationRules\Ninja\CanStoreClientsRule;
|
||||||
use App\Http\ValidationRules\ValidClientGroupSettingsRule;
|
use App\Http\ValidationRules\ValidClientGroupSettingsRule;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
@ -51,6 +52,14 @@ class StoreClientRequest extends Request
|
|||||||
$rules['number'] = Rule::unique('clients')->where('company_id', auth()->user()->company()->id);
|
$rules['number'] = Rule::unique('clients')->where('company_id', auth()->user()->company()->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($this->currency_code)){
|
||||||
|
$rules['currency_code'] = 'sometimes|exists:currencies,code';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($this->country_code)){
|
||||||
|
$rules['country_code'] = new CountryCodeExistsRule();
|
||||||
|
}
|
||||||
|
|
||||||
/* Ensure we have a client name, and that all emails are unique*/
|
/* Ensure we have a client name, and that all emails are unique*/
|
||||||
//$rules['name'] = 'required|min:1';
|
//$rules['name'] = 'required|min:1';
|
||||||
$rules['settings'] = new ValidClientGroupSettingsRule();
|
$rules['settings'] = new ValidClientGroupSettingsRule();
|
||||||
@ -133,6 +142,7 @@ class StoreClientRequest extends Request
|
|||||||
// 'unique' => ctrans('validation.unique', ['attribute' => ['email','number']),
|
// 'unique' => ctrans('validation.unique', ['attribute' => ['email','number']),
|
||||||
//'required' => trans('validation.required', ['attribute' => 'email']),
|
//'required' => trans('validation.required', ['attribute' => 'email']),
|
||||||
'contacts.*.email.required' => ctrans('validation.email', ['attribute' => 'email']),
|
'contacts.*.email.required' => ctrans('validation.email', ['attribute' => 'email']),
|
||||||
|
'currency_code' => 'Currency code does not exist',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,6 +168,9 @@ class StoreClientRequest extends Request
|
|||||||
return $item->code == $code;
|
return $item->code == $code;
|
||||||
})->first();
|
})->first();
|
||||||
|
|
||||||
|
if($currency)
|
||||||
return (string) $currency->id;
|
return (string) $currency->id;
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
48
app/Http/Requests/User/BulkUserRequest.php
Normal file
48
app/Http/Requests/User/BulkUserRequest.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Http\Requests\User;
|
||||||
|
|
||||||
|
use App\Http\Requests\Request;
|
||||||
|
use App\Http\ValidationRules\Ninja\CanRestoreUserRule;
|
||||||
|
use App\Http\ValidationRules\UniqueUserRule;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
|
||||||
|
class BulkUserRequest extends Request
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize() : bool
|
||||||
|
{
|
||||||
|
return auth()->user()->isAdmin();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
|
||||||
|
$rules = [];
|
||||||
|
|
||||||
|
if(Ninja::isHosted() && $this->action && $this->action == 'restore')
|
||||||
|
$rules['ids'] = new CanRestoreUserRule();
|
||||||
|
|
||||||
|
return $rules;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function prepareForValidation()
|
||||||
|
{
|
||||||
|
$input = $this->all();
|
||||||
|
|
||||||
|
$this->replace($input);
|
||||||
|
}
|
||||||
|
}
|
60
app/Http/ValidationRules/Client/CountryCodeExistsRule.php
Normal file
60
app/Http/ValidationRules/Client/CountryCodeExistsRule.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Credit Ninja (https://creditninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/creditninja/creditninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Credit Ninja LLC (https://creditninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Http\ValidationRules\Client;
|
||||||
|
|
||||||
|
use App\Models\Country;
|
||||||
|
use Illuminate\Contracts\Validation\Rule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class UniqueCreditNumberRule.
|
||||||
|
*/
|
||||||
|
class CountryCodeExistsRule implements Rule
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $attribute
|
||||||
|
* @param mixed $value
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function passes($attribute, $value)
|
||||||
|
{
|
||||||
|
return $this->checkIfCodeExists($value); //if it exists, return false!
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function message()
|
||||||
|
{
|
||||||
|
return 'Country code does not exist';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function checkIfCodeExists($value) : bool
|
||||||
|
{
|
||||||
|
$country = Country::where('iso_3166_2', $value)
|
||||||
|
->orWhere('iso_3166_3', $value)
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if ($country)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
namespace App\Http\ValidationRules\Ninja;
|
namespace App\Http\ValidationRules\Ninja;
|
||||||
|
|
||||||
|
use App\Models\CompanyUser;
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Contracts\Validation\Rule;
|
use Illuminate\Contracts\Validation\Rule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +32,17 @@ class CanAddUserRule implements Rule
|
|||||||
*/
|
*/
|
||||||
public function passes($attribute, $value)
|
public function passes($attribute, $value)
|
||||||
{
|
{
|
||||||
return auth()->user()->company()->account->users->count() < auth()->user()->company()->account->num_users;
|
|
||||||
|
$count = CompanyUser::query()
|
||||||
|
->where('company_user.account_id', auth()->user()->account_id)
|
||||||
|
->join('users', 'users.id', '=', 'company_user.user_id')
|
||||||
|
->whereNull('users.deleted_at')
|
||||||
|
->whereNull('company_user.deleted_at')
|
||||||
|
->distinct()
|
||||||
|
->count('company_user.user_id');
|
||||||
|
|
||||||
|
return $count < auth()->user()->company()->account->num_users;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
55
app/Http/ValidationRules/Ninja/CanRestoreUserRule.php
Normal file
55
app/Http/ValidationRules/Ninja/CanRestoreUserRule.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Http\ValidationRules\Ninja;
|
||||||
|
|
||||||
|
use App\Models\CompanyUser;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Contracts\Validation\Rule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CanAddUserRule.
|
||||||
|
*/
|
||||||
|
class CanRestoreUserRule implements Rule
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $attribute
|
||||||
|
* @param mixed $value
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function passes($attribute, $value)
|
||||||
|
{
|
||||||
|
|
||||||
|
$count = CompanyUser::query()
|
||||||
|
->where('company_user.account_id', auth()->user()->account_id)
|
||||||
|
->join('users', 'users.id', '=', 'company_user.user_id')
|
||||||
|
->whereNull('users.deleted_at')
|
||||||
|
->whereNull('company_user.deleted_at')
|
||||||
|
->distinct()
|
||||||
|
->count('company_user.user_id');
|
||||||
|
|
||||||
|
return $count < auth()->user()->company()->account->num_users;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function message()
|
||||||
|
{
|
||||||
|
return ctrans('texts.limit_users', ['limit' => auth()->user()->company()->account->num_users]);
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,8 @@ class ValidProjectForClient implements Rule
|
|||||||
|
|
||||||
public $input;
|
public $input;
|
||||||
|
|
||||||
|
public $message;
|
||||||
|
|
||||||
public function __construct($input)
|
public function __construct($input)
|
||||||
{
|
{
|
||||||
$this->input = $input;
|
$this->input = $input;
|
||||||
@ -35,15 +37,20 @@ class ValidProjectForClient implements Rule
|
|||||||
*/
|
*/
|
||||||
public function passes($attribute, $value)
|
public function passes($attribute, $value)
|
||||||
{
|
{
|
||||||
|
$this->message = ctrans('texts.project_client_do_not_match');
|
||||||
|
|
||||||
if (empty($this->input['project_id'])) {
|
if (empty($this->input['project_id'])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($this->input['project_id'])) {
|
// if (is_string($this->input['project_id'])) {
|
||||||
$this->input['project_id'] = $this->decodePrimaryKey($this->input['project_id']);
|
// $this->input['project_id'] = $this->decodePrimaryKey($this->input['project_id']);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$project = Project::findOrFail($this->input['project_id']);
|
$project = Project::find($this->input['project_id']);
|
||||||
|
|
||||||
|
if(!$project)
|
||||||
|
$this->message = "Project not found";
|
||||||
|
|
||||||
return $project->client_id == $this->input['client_id'];
|
return $project->client_id == $this->input['client_id'];
|
||||||
}
|
}
|
||||||
@ -53,6 +60,6 @@ class ValidProjectForClient implements Rule
|
|||||||
*/
|
*/
|
||||||
public function message()
|
public function message()
|
||||||
{
|
{
|
||||||
return ctrans('texts.project_client_do_not_match');
|
return $this->message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ class CreateAccount
|
|||||||
$spaa9f78->fresh();
|
$spaa9f78->fresh();
|
||||||
|
|
||||||
if(Ninja::isHosted()){
|
if(Ninja::isHosted()){
|
||||||
nlog("welcome");
|
|
||||||
App::forgetInstance('translator');
|
App::forgetInstance('translator');
|
||||||
$t = app('translator');
|
$t = app('translator');
|
||||||
$t->replace(Ninja::transformTranslations($sp035a66->settings));
|
$t->replace(Ninja::transformTranslations($sp035a66->settings));
|
||||||
|
@ -338,14 +338,14 @@ class CompanyImport implements ShouldQueue
|
|||||||
|
|
||||||
if($this->account->plan == 'enterprise'){
|
if($this->account->plan == 'enterprise'){
|
||||||
|
|
||||||
$total_import_users = count($backup_users_emails);
|
// $total_import_users = count($backup_users_emails);
|
||||||
|
|
||||||
$account_plan_num_user = $this->account->num_users;
|
// $account_plan_num_user = $this->account->num_users;
|
||||||
|
|
||||||
if($total_import_users > $account_plan_num_user){
|
// if($total_import_users > $account_plan_num_user){
|
||||||
$this->message = "Total user count ({$total_import_users}) greater than your plan allows ({$account_plan_num_user})";
|
// $this->message = "Total user count ({$total_import_users}) greater than your plan allows ({$account_plan_num_user})";
|
||||||
$this->pre_flight_checks_pass = false;
|
// $this->pre_flight_checks_pass = false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1024,7 +1024,7 @@ class CompanyImport implements ShouldQueue
|
|||||||
foreach((object)$this->getObject("users") as $user)
|
foreach((object)$this->getObject("users") as $user)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(User::where('email', $user->email)->where('account_id', '!=', $this->account->id)->exists())
|
if(User::withTrashed()->where('email', $user->email)->where('account_id', '!=', $this->account->id)->exists())
|
||||||
throw new ImportCompanyFailed("{$user->email} is already in the system attached to a different account");
|
throw new ImportCompanyFailed("{$user->email} is already in the system attached to a different account");
|
||||||
|
|
||||||
$user_array = (array)$user;
|
$user_array = (array)$user;
|
||||||
@ -1032,7 +1032,9 @@ class CompanyImport implements ShouldQueue
|
|||||||
unset($user_array['hashed_id']);
|
unset($user_array['hashed_id']);
|
||||||
unset($user_array['id']);
|
unset($user_array['id']);
|
||||||
|
|
||||||
$new_user = User::firstOrNew(
|
/*Make sure we are searching for archived users also and restore if we find them.*/
|
||||||
|
|
||||||
|
$new_user = User::withTrashed()->firstOrNew(
|
||||||
['email' => $user->email],
|
['email' => $user->email],
|
||||||
$user_array,
|
$user_array,
|
||||||
);
|
);
|
||||||
@ -1062,7 +1064,7 @@ class CompanyImport implements ShouldQueue
|
|||||||
unset($cu_array['company_id']);
|
unset($cu_array['company_id']);
|
||||||
unset($cu_array['user_id']);
|
unset($cu_array['user_id']);
|
||||||
|
|
||||||
$new_cu = CompanyUser::firstOrNew(
|
$new_cu = CompanyUser::withTrashed()->firstOrNew(
|
||||||
['user_id' => $user_id, 'company_id' => $this->company->id],
|
['user_id' => $user_id, 'company_id' => $this->company->id],
|
||||||
$cu_array,
|
$cu_array,
|
||||||
);
|
);
|
||||||
@ -1076,8 +1078,6 @@ class CompanyImport implements ShouldQueue
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function transformDocumentId($id, $type)
|
private function transformDocumentId($id, $type)
|
||||||
{
|
{
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
@ -134,10 +134,6 @@ class CSVImport implements ShouldQueue {
|
|||||||
'company' => $this->company,
|
'company' => $this->company,
|
||||||
];
|
];
|
||||||
|
|
||||||
App::forgetInstance('translator');
|
|
||||||
$t = app('translator');
|
|
||||||
$t->replace(Ninja::transformTranslations($this->company->settings));
|
|
||||||
|
|
||||||
$nmo = new NinjaMailerObject;
|
$nmo = new NinjaMailerObject;
|
||||||
$nmo->mailable = new ImportCompleted($this->company, $data);
|
$nmo->mailable = new ImportCompleted($this->company, $data);
|
||||||
$nmo->company = $this->company;
|
$nmo->company = $this->company;
|
||||||
|
@ -70,7 +70,7 @@ class ZipInvoices implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{nlog("bulky");
|
||||||
# create new zip object
|
# create new zip object
|
||||||
$zip = new ZipArchive();
|
$zip = new ZipArchive();
|
||||||
|
|
||||||
|
@ -212,6 +212,8 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
|
|
||||||
$google->getClient()->setAccessToken(json_encode($user->oauth_user_token));
|
$google->getClient()->setAccessToken(json_encode($user->oauth_user_token));
|
||||||
|
|
||||||
|
//need to slow down gmail requests otherwise we hit 429's
|
||||||
|
sleep(1);
|
||||||
}
|
}
|
||||||
catch(\Exception $e) {
|
catch(\Exception $e) {
|
||||||
$this->logMailError('Gmail Token Invalid', $this->company->clients()->first());
|
$this->logMailError('Gmail Token Invalid', $this->company->clients()->first());
|
||||||
@ -225,9 +227,6 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
* just for this request.
|
* just for this request.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// config(['mail.driver' => 'gmail']);
|
|
||||||
// (new MailServiceProvider(app()))->register();
|
|
||||||
|
|
||||||
$token = $user->oauth_user_token->access_token;
|
$token = $user->oauth_user_token->access_token;
|
||||||
|
|
||||||
$this->nmo
|
$this->nmo
|
||||||
|
@ -36,7 +36,7 @@ class PaymentFailedMailer implements ShouldQueue
|
|||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, UserNotifies;
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, UserNotifies;
|
||||||
|
|
||||||
public PaymentHash $payment_hash;
|
public ?PaymentHash $payment_hash;
|
||||||
|
|
||||||
public string $error;
|
public string $error;
|
||||||
|
|
||||||
|
@ -120,6 +120,7 @@ class SendRecurring implements ShouldQueue
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
event('eloquent.created: App\Models\Invoice', $invoice);
|
||||||
|
|
||||||
//Admin notification for recurring invoice sent.
|
//Admin notification for recurring invoice sent.
|
||||||
if ($invoice->invitations->count() >= 1 ) {
|
if ($invoice->invitations->count() >= 1 ) {
|
||||||
@ -171,7 +172,7 @@ class SendRecurring implements ShouldQueue
|
|||||||
$this->recurring_invoice->invitations->each(function ($recurring_invitation) use($invoice){
|
$this->recurring_invoice->invitations->each(function ($recurring_invitation) use($invoice){
|
||||||
|
|
||||||
$ii = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id);
|
$ii = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id);
|
||||||
$ii->key = $this->createDbHash(config('database.default'));
|
$ii->key = $this->createDbHash($invoice->company->db);
|
||||||
$ii->invoice_id = $invoice->id;
|
$ii->invoice_id = $invoice->id;
|
||||||
$ii->client_contact_id = $recurring_invitation->client_contact_id;
|
$ii->client_contact_id = $recurring_invitation->client_contact_id;
|
||||||
$ii->save();
|
$ii->save();
|
||||||
|
@ -60,7 +60,7 @@ class CreateUser
|
|||||||
$user->account_id = $this->account->id;
|
$user->account_id = $this->account->id;
|
||||||
$user->password = $this->request['password'] ? bcrypt($this->request['password']) : '';
|
$user->password = $this->request['password'] ? bcrypt($this->request['password']) : '';
|
||||||
$user->accepted_terms_version = config('ninja.terms_version');
|
$user->accepted_terms_version = config('ninja.terms_version');
|
||||||
$user->confirmation_code = $this->createDbHash(config('database.default'));
|
$user->confirmation_code = $this->createDbHash($this->company->db);
|
||||||
$user->fill($this->request);
|
$user->fill($this->request);
|
||||||
$user->email = $this->request['email']; //todo need to remove this in production
|
$user->email = $this->request['email']; //todo need to remove this in production
|
||||||
$user->last_login = now();
|
$user->last_login = now();
|
||||||
|
@ -37,7 +37,7 @@ class VersionCheck implements ShouldQueue
|
|||||||
{
|
{
|
||||||
$version_file = trim(file_get_contents(config('ninja.version_url')));
|
$version_file = trim(file_get_contents(config('ninja.version_url')));
|
||||||
|
|
||||||
info("latest version = {$version_file}");
|
nlog("latest version = {$version_file}");
|
||||||
|
|
||||||
if ($version_file) {
|
if ($version_file) {
|
||||||
Account::whereNotNull('id')->update(['latest_version' => $version_file]);
|
Account::whereNotNull('id')->update(['latest_version' => $version_file]);
|
||||||
|
@ -127,8 +127,8 @@ class WebhookHandler implements ShouldQueue
|
|||||||
$this->company
|
$this->company
|
||||||
);
|
);
|
||||||
|
|
||||||
// if ($response->getStatusCode() == 410 || $response->getStatusCode() == 200)
|
// if ($response->getStatusCode() == 410)
|
||||||
// return true;// $subscription->delete();
|
// return true; $subscription->delete();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(\Exception $e){
|
catch(\Exception $e){
|
||||||
|
@ -42,7 +42,7 @@ class CreditEmailedNotification implements ShouldQueue
|
|||||||
|
|
||||||
$credit = $event->invitation->credit;
|
$credit = $event->invitation->credit;
|
||||||
$credit->last_sent_date = now();
|
$credit->last_sent_date = now();
|
||||||
$credit->save();
|
$credit->saveQuietly();
|
||||||
|
|
||||||
$nmo = new NinjaMailerObject;
|
$nmo = new NinjaMailerObject;
|
||||||
$nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'credit', $event->template))->build() );
|
$nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'credit', $event->template))->build() );
|
||||||
|
@ -42,7 +42,7 @@ class InvoiceEmailedNotification implements ShouldQueue
|
|||||||
|
|
||||||
$invoice = $event->invitation->invoice;
|
$invoice = $event->invitation->invoice;
|
||||||
$invoice->last_sent_date = now();
|
$invoice->last_sent_date = now();
|
||||||
$invoice->save();
|
$invoice->saveQuietly();
|
||||||
|
|
||||||
$nmo = new NinjaMailerObject;
|
$nmo = new NinjaMailerObject;
|
||||||
$nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'invoice', $event->template))->build() );
|
$nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'invoice', $event->template))->build() );
|
||||||
|
@ -43,7 +43,7 @@ class CreateQuoteInvitation implements ShouldQueue
|
|||||||
|
|
||||||
if (! $invitation && $contact->send_credit) {
|
if (! $invitation && $contact->send_credit) {
|
||||||
$ii = QuoteInvitationFactory::create($quote->company_id, $quote->user_id);
|
$ii = QuoteInvitationFactory::create($quote->company_id, $quote->user_id);
|
||||||
$ii->key = $this->createDbHash(config('database.default'));
|
$ii->key = $this->createDbHash($quote->company->db);
|
||||||
$ii->quote_id = $quote->id;
|
$ii->quote_id = $quote->id;
|
||||||
$ii->client_contact_id = $contact->id;
|
$ii->client_contact_id = $contact->id;
|
||||||
$ii->save();
|
$ii->save();
|
||||||
|
@ -42,7 +42,7 @@ class QuoteEmailedNotification implements ShouldQueue
|
|||||||
|
|
||||||
$quote = $event->invitation->quote;
|
$quote = $event->invitation->quote;
|
||||||
$quote->last_sent_date = now();
|
$quote->last_sent_date = now();
|
||||||
$quote->save();
|
$quote->saveQuietly();
|
||||||
|
|
||||||
$nmo = new NinjaMailerObject;
|
$nmo = new NinjaMailerObject;
|
||||||
$nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'quote', $event->template))->build() );
|
$nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'quote', $event->template))->build() );
|
||||||
|
@ -56,6 +56,10 @@ class ClientPaymentFailureObject
|
|||||||
|
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
|
if(!$this->payment_hash){
|
||||||
|
nlog("no payment has for failure notification - ClientPaymentFailureObject");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
App::forgetInstance('translator');
|
App::forgetInstance('translator');
|
||||||
/* Init a new copy of the translator*/
|
/* Init a new copy of the translator*/
|
||||||
|
@ -33,7 +33,7 @@ class PaymentFailureObject
|
|||||||
|
|
||||||
public $amount;
|
public $amount;
|
||||||
|
|
||||||
public PaymentHash $payment_hash;
|
public ?PaymentHash $payment_hash;
|
||||||
// private $invoices;
|
// private $invoices;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,9 +13,11 @@
|
|||||||
namespace App\Mail\Import;
|
namespace App\Mail\Import;
|
||||||
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
|
use App\Utils\Ninja;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
|
||||||
class ImportCompleted extends Mailable
|
class ImportCompleted extends Mailable
|
||||||
{
|
{
|
||||||
@ -45,6 +47,11 @@ class ImportCompleted extends Mailable
|
|||||||
*/
|
*/
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
App::forgetInstance('translator');
|
||||||
|
$t = app('translator');
|
||||||
|
$t->replace(Ninja::transformTranslations($this->company->settings));
|
||||||
|
|
||||||
$data = array_merge($this->data, [
|
$data = array_merge($this->data, [
|
||||||
'logo' => $this->company->present()->logo(),
|
'logo' => $this->company->present()->logo(),
|
||||||
'settings' => $this->company->settings,
|
'settings' => $this->company->settings,
|
||||||
|
@ -65,9 +65,10 @@ class SupportMessageSent extends Mailable
|
|||||||
$is_large = $company->is_large ? "L" : "S";
|
$is_large = $company->is_large ? "L" : "S";
|
||||||
$platform = array_key_exists('platform', $this->data) ? $this->data['platform'] : "U";
|
$platform = array_key_exists('platform', $this->data) ? $this->data['platform'] : "U";
|
||||||
$migrated = strlen($company->company_key) == 32 ? "M" : "";
|
$migrated = strlen($company->company_key) == 32 ? "M" : "";
|
||||||
|
$trial = $account->isTrial() ? "T" : "";
|
||||||
|
|
||||||
if(Ninja::isHosted())
|
if(Ninja::isHosted())
|
||||||
$subject = "{$priority}Hosted-{$db}-{$is_large}{$platform}{$migrated} :: {$plan} :: ".date('M jS, g:ia');
|
$subject = "{$priority}Hosted-{$db}-{$is_large}{$platform}{$migrated}{$trial} :: {$plan} :: ".date('M jS, g:ia');
|
||||||
else
|
else
|
||||||
$subject = "{$priority}Self Hosted :: {$plan} :: {$is_large}{$platform}{$migrated} :: ".date('M jS, g:ia');
|
$subject = "{$priority}Self Hosted :: {$plan} :: {$is_large}{$platform}{$migrated} :: ".date('M jS, g:ia');
|
||||||
|
|
||||||
|
@ -67,6 +67,13 @@ class Account extends BaseModel
|
|||||||
// 'plan_expires'
|
// 'plan_expires'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'updated_at' => 'timestamp',
|
||||||
|
'created_at' => 'timestamp',
|
||||||
|
'deleted_at' => 'timestamp',
|
||||||
|
'onboarding' => 'object'
|
||||||
|
];
|
||||||
|
|
||||||
const PLAN_FREE = 'free';
|
const PLAN_FREE = 'free';
|
||||||
const PLAN_PRO = 'pro';
|
const PLAN_PRO = 'pro';
|
||||||
const PLAN_ENTERPRISE = 'enterprise';
|
const PLAN_ENTERPRISE = 'enterprise';
|
||||||
|
@ -530,7 +530,7 @@ class Client extends BaseModel implements HasLocalePreference
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->country->iso_3166_3 == 'GBR' && in_array(GatewayType::DIRECT_DEBIT, array_column($pms, 'gateway_type_id'))) {
|
if ($this->country && $this->country->iso_3166_3 == 'GBR' && in_array(GatewayType::DIRECT_DEBIT, array_column($pms, 'gateway_type_id'))) {
|
||||||
foreach ($pms as $pm) {
|
foreach ($pms as $pm) {
|
||||||
if ($pm['gateway_type_id'] == GatewayType::DIRECT_DEBIT) {
|
if ($pm['gateway_type_id'] == GatewayType::DIRECT_DEBIT) {
|
||||||
$cg = CompanyGateway::find($pm['company_gateway_id']);
|
$cg = CompanyGateway::find($pm['company_gateway_id']);
|
||||||
|
@ -331,7 +331,6 @@ class CompanyGateway extends BaseModel
|
|||||||
|
|
||||||
if ($fees_and_limits->fee_amount) {
|
if ($fees_and_limits->fee_amount) {
|
||||||
$fee += $fees_and_limits->fee_amount;
|
$fee += $fees_and_limits->fee_amount;
|
||||||
nlog("fee after adding fee amount = {$fee}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fees_and_limits->fee_percent) {
|
if ($fees_and_limits->fee_percent) {
|
||||||
@ -340,7 +339,6 @@ class CompanyGateway extends BaseModel
|
|||||||
} else {
|
} else {
|
||||||
$fee += round(($amount * $fees_and_limits->fee_percent / 100), 2);
|
$fee += round(($amount * $fees_and_limits->fee_percent / 100), 2);
|
||||||
}
|
}
|
||||||
nlog("fee after adding fee percent = {$fee}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cap fee if we have to here. */
|
/* Cap fee if we have to here. */
|
||||||
@ -349,7 +347,6 @@ class CompanyGateway extends BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pre_tax_fee = $fee;
|
$pre_tax_fee = $fee;
|
||||||
nlog("fee after adding fee percent = {$fee}");
|
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
if ($include_taxes) {
|
if ($include_taxes) {
|
||||||
@ -368,7 +365,6 @@ class CompanyGateway extends BaseModel
|
|||||||
// info("fee after adding fee tax 3 = {$fee}");
|
// info("fee after adding fee tax 3 = {$fee}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nlog("fee after adding fee percent = {$fee}");
|
|
||||||
|
|
||||||
return $fee;
|
return $fee;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ class CompanyUser extends Pivot
|
|||||||
|
|
||||||
public function users()
|
public function users()
|
||||||
{
|
{
|
||||||
return $this->hasMany(User::class);
|
return $this->hasMany(User::class)->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*todo monitor this function - may fail under certain conditions*/
|
/*todo monitor this function - may fail under certain conditions*/
|
||||||
|
@ -30,7 +30,7 @@ class PaymentObserver
|
|||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if ($subscriptions) {
|
if ($subscriptions) {
|
||||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_PAYMENT, $payment, $payment->company, 'invoices');
|
WebhookHandler::dispatch(Webhook::EVENT_CREATE_PAYMENT, $payment, $payment->company, 'invoices,client');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class PaymentObserver
|
|||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if ($subscriptions) {
|
if ($subscriptions) {
|
||||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_PAYMENT, $payment, $payment->company, 'invoices');
|
WebhookHandler::dispatch(Webhook::EVENT_DELETE_PAYMENT, $payment, $payment->company, 'invoices,client');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +233,6 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$payment = PaymentFactory::create($this->client->company->id, $this->client->user->id);
|
$payment = PaymentFactory::create($this->client->company->id, $this->client->user->id);
|
||||||
$payment->client_id = $this->client->id;
|
$payment->client_id = $this->client->id;
|
||||||
$payment->company_gateway_id = $this->company_gateway->id;
|
$payment->company_gateway_id = $this->company_gateway->id;
|
||||||
@ -386,6 +385,9 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
} else
|
} else
|
||||||
$error = $e->getMessage();
|
$error = $e->getMessage();
|
||||||
|
|
||||||
|
if(!$this->payment_hash)
|
||||||
|
throw new PaymentFailed($error, $e->getCode());
|
||||||
|
|
||||||
$amount = array_sum(array_column($this->payment_hash->invoices(), 'amount')) + $this->payment_hash->fee_total;
|
$amount = array_sum(array_column($this->payment_hash->invoices(), 'amount')) + $this->payment_hash->fee_total;
|
||||||
|
|
||||||
$this->sendFailureMail($error);
|
$this->sendFailureMail($error);
|
||||||
@ -405,6 +407,10 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
public function sendFailureMail(string $error)
|
public function sendFailureMail(string $error)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (!is_null($this->payment_hash)) {
|
||||||
|
$this->unWindGatewayFees($this->payment_hash);
|
||||||
|
}
|
||||||
|
|
||||||
PaymentFailedMailer::dispatch(
|
PaymentFailedMailer::dispatch(
|
||||||
$this->payment_hash,
|
$this->payment_hash,
|
||||||
$this->client->company,
|
$this->client->company,
|
||||||
@ -419,7 +425,6 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
|
|
||||||
if ($this->payment_hash && is_array($this->payment_hash->invoices())) {
|
if ($this->payment_hash && is_array($this->payment_hash->invoices())) {
|
||||||
|
|
||||||
|
|
||||||
$nmo = new NinjaMailerObject;
|
$nmo = new NinjaMailerObject;
|
||||||
$nmo->mailable = new NinjaMailer((new ClientPaymentFailureObject($this->client, $error, $this->client->company, $this->payment_hash))->build());
|
$nmo->mailable = new NinjaMailer((new ClientPaymentFailureObject($this->client, $error, $this->client->company, $this->payment_hash))->build());
|
||||||
$nmo->company = $this->client->company;
|
$nmo->company = $this->client->company;
|
||||||
|
@ -164,6 +164,8 @@ class ACH implements MethodInterface
|
|||||||
$this->decodePrimaryKey($request->source)
|
$this->decodePrimaryKey($request->source)
|
||||||
)->firstOrFail();
|
)->firstOrFail();
|
||||||
|
|
||||||
|
$this->go_cardless->ensureMandateIsReady($token);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$payment = $this->go_cardless->gateway->payments()->create([
|
$payment = $this->go_cardless->gateway->payments()->create([
|
||||||
'params' => [
|
'params' => [
|
||||||
|
@ -156,6 +156,8 @@ class DirectDebit implements MethodInterface
|
|||||||
$this->decodePrimaryKey($request->source)
|
$this->decodePrimaryKey($request->source)
|
||||||
)->firstOrFail();
|
)->firstOrFail();
|
||||||
|
|
||||||
|
$this->go_cardless->ensureMandateIsReady($token);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$payment = $this->go_cardless->gateway->payments()->create([
|
$payment = $this->go_cardless->gateway->payments()->create([
|
||||||
'params' => [
|
'params' => [
|
||||||
|
@ -164,6 +164,8 @@ class SEPA implements MethodInterface
|
|||||||
$this->decodePrimaryKey($request->source)
|
$this->decodePrimaryKey($request->source)
|
||||||
)->firstOrFail();
|
)->firstOrFail();
|
||||||
|
|
||||||
|
$this->go_cardless->ensureMandateIsReady($token);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$payment = $this->go_cardless->gateway->payments()->create([
|
$payment = $this->go_cardless->gateway->payments()->create([
|
||||||
'params' => [
|
'params' => [
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\PaymentDrivers;
|
namespace App\PaymentDrivers;
|
||||||
|
|
||||||
|
use App\Events\Payment\PaymentFailed;
|
||||||
use App\Http\Requests\Payments\PaymentWebhookRequest;
|
use App\Http\Requests\Payments\PaymentWebhookRequest;
|
||||||
use App\Jobs\Util\SystemLogger;
|
use App\Jobs\Util\SystemLogger;
|
||||||
use App\Models\ClientGatewayToken;
|
use App\Models\ClientGatewayToken;
|
||||||
@ -258,4 +259,17 @@ class GoCardlessPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
return response()->json([], 200);
|
return response()->json([], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function ensureMandateIsReady(ClientGatewayToken $cgt)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$mandate = $this->gateway->mandates()->get($cgt->token);
|
||||||
|
|
||||||
|
if ($mandate->status !== 'active') {
|
||||||
|
throw new \Exception(ctrans('texts.gocardless_mandate_not_ready'));
|
||||||
|
}
|
||||||
|
} catch (\Exception $exception) {
|
||||||
|
throw new \App\Exceptions\PaymentFailed($exception->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ class MolliePaymentDriver extends BaseDriver
|
|||||||
try {
|
try {
|
||||||
$payment = $this->gateway->payments->get($request->id);
|
$payment = $this->gateway->payments->get($request->id);
|
||||||
|
|
||||||
$record = Payment::where('transaction_reference', $payment->id)->firstOrFail();
|
$record = Payment::withTrashed()->where('transaction_reference', $request->id)->firstOrFail();
|
||||||
$record->status_id = $codes[$payment->status];
|
$record->status_id = $codes[$payment->status];
|
||||||
$record->save();
|
$record->save();
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ class PayFastPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
|
|
||||||
echo '##PAYFAST## There was an exception: '.$e->getMessage();
|
nlog('##PAYFAST## There was an exception: '.$e->getMessage());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,8 +203,8 @@ class PayFastPaymentDriver extends BaseDriver
|
|||||||
{
|
{
|
||||||
|
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
nlog("payfast");
|
// nlog("payfast");
|
||||||
nlog($data);
|
// nlog($data);
|
||||||
|
|
||||||
if(array_key_exists('m_payment_id', $data))
|
if(array_key_exists('m_payment_id', $data))
|
||||||
{
|
{
|
||||||
|
215
app/PaymentDrivers/Stripe/BrowserPay.php
Normal file
215
app/PaymentDrivers/Stripe/BrowserPay.php
Normal file
@ -0,0 +1,215 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\PaymentDrivers\Stripe;
|
||||||
|
|
||||||
|
use App\Exceptions\PaymentFailed;
|
||||||
|
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
||||||
|
use App\Jobs\Util\SystemLogger;
|
||||||
|
use App\Models\GatewayType;
|
||||||
|
use App\Models\Payment;
|
||||||
|
use App\Models\PaymentType;
|
||||||
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Common\MethodInterface;
|
||||||
|
use App\PaymentDrivers\StripePaymentDriver;
|
||||||
|
use App\Utils\Ninja;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
use Stripe\ApplePayDomain;
|
||||||
|
use Stripe\Exception\ApiErrorException;
|
||||||
|
use Stripe\PaymentIntent;
|
||||||
|
|
||||||
|
class BrowserPay implements MethodInterface
|
||||||
|
{
|
||||||
|
protected StripePaymentDriver $stripe;
|
||||||
|
|
||||||
|
public function __construct(StripePaymentDriver $stripe)
|
||||||
|
{
|
||||||
|
$this->stripe = $stripe;
|
||||||
|
|
||||||
|
$this->stripe->init();
|
||||||
|
|
||||||
|
$this->ensureApplePayDomainIsValidated();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Authorization page for browser pay.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
* @return RedirectResponse
|
||||||
|
*/
|
||||||
|
public function authorizeView(array $data): RedirectResponse
|
||||||
|
{
|
||||||
|
return redirect()->route('client.payment_methods.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the authorization for browser pay.
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return RedirectResponse
|
||||||
|
*/
|
||||||
|
public function authorizeResponse(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
return redirect()->route('client.payment_methods.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function paymentView(array $data): View
|
||||||
|
{
|
||||||
|
$payment_intent_data = [
|
||||||
|
'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
|
||||||
|
'currency' => $this->stripe->client->getCurrencyCode(),
|
||||||
|
'customer' => $this->stripe->findOrCreateCustomer(),
|
||||||
|
'description' => $this->stripe->decodeUnicodeString(ctrans('texts.invoices') . ': ' . collect($data['invoices'])->pluck('invoice_number')),
|
||||||
|
];
|
||||||
|
|
||||||
|
$data['gateway'] = $this->stripe;
|
||||||
|
$data['pi_client_secret'] = $this->stripe->createPaymentIntent($payment_intent_data)->client_secret;
|
||||||
|
|
||||||
|
$data['payment_request_data'] = [
|
||||||
|
'country' => $this->stripe->client->country->iso_3166_2,
|
||||||
|
'currency' => strtolower(
|
||||||
|
$this->stripe->client->getCurrencyCode()
|
||||||
|
),
|
||||||
|
'total' => [
|
||||||
|
'label' => $payment_intent_data['description'],
|
||||||
|
'amount' => $payment_intent_data['amount'],
|
||||||
|
],
|
||||||
|
'requestPayerName' => true,
|
||||||
|
'requestPayerEmail' => true
|
||||||
|
];
|
||||||
|
|
||||||
|
return render('gateways.stripe.browser_pay.pay', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle payment response for browser pay.
|
||||||
|
*
|
||||||
|
* @param PaymentResponseRequest $request
|
||||||
|
* @return RedirectResponse|App\PaymentDrivers\Stripe\never
|
||||||
|
*/
|
||||||
|
public function paymentResponse(PaymentResponseRequest $request)
|
||||||
|
{
|
||||||
|
$gateway_response = json_decode($request->gateway_response);
|
||||||
|
|
||||||
|
$this->stripe->payment_hash
|
||||||
|
->withData('gateway_response', $gateway_response)
|
||||||
|
->withData('payment_intent', PaymentIntent::retrieve($gateway_response->id, $this->stripe->stripe_connect_auth));
|
||||||
|
|
||||||
|
if ($gateway_response->status === 'succeeded') {
|
||||||
|
return $this->processSuccessfulPayment();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->processUnsuccessfulPayment();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle successful payment for browser pay.
|
||||||
|
*
|
||||||
|
* @return RedirectResponse
|
||||||
|
*/
|
||||||
|
protected function processSuccessfulPayment()
|
||||||
|
{
|
||||||
|
$gateway_response = $this->stripe->payment_hash->data->gateway_response;
|
||||||
|
$payment_intent = $this->stripe->payment_hash->data->payment_intent;
|
||||||
|
|
||||||
|
$this->stripe->logSuccessfulGatewayResponse(['response' => $gateway_response, 'data' => $this->stripe->payment_hash], SystemLog::TYPE_STRIPE);
|
||||||
|
|
||||||
|
$payment_method = $this->stripe->getStripePaymentMethod($gateway_response->payment_method);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'payment_method' => $gateway_response->payment_method,
|
||||||
|
'payment_type' => PaymentType::parseCardType(strtolower($payment_method->card->brand)),
|
||||||
|
'amount' => $this->stripe->convertFromStripeAmount($gateway_response->amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
|
||||||
|
'transaction_reference' => optional($payment_intent->charges->data[0])->id,
|
||||||
|
'gateway_type_id' => GatewayType::APPLE_PAY,
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['amount' => $data['amount']]);
|
||||||
|
$this->stripe->payment_hash->save();
|
||||||
|
|
||||||
|
$payment = $this->stripe->createPayment($data, Payment::STATUS_COMPLETED);
|
||||||
|
|
||||||
|
SystemLogger::dispatch(
|
||||||
|
['response' => $gateway_response, 'data' => $data],
|
||||||
|
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||||
|
SystemLog::EVENT_GATEWAY_SUCCESS,
|
||||||
|
SystemLog::TYPE_STRIPE,
|
||||||
|
$this->stripe->client,
|
||||||
|
$this->stripe->client->company,
|
||||||
|
);
|
||||||
|
|
||||||
|
return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle unsuccessful payment for browser pay.
|
||||||
|
*
|
||||||
|
* @return never
|
||||||
|
*/
|
||||||
|
protected function processUnsuccessfulPayment()
|
||||||
|
{
|
||||||
|
$server_response = $this->stripe->payment_hash->data->gateway_response;
|
||||||
|
|
||||||
|
$this->stripe->sendFailureMail($server_response->cancellation_reason);
|
||||||
|
|
||||||
|
$message = [
|
||||||
|
'server_response' => $server_response,
|
||||||
|
'data' => $this->stripe->payment_hash->data,
|
||||||
|
];
|
||||||
|
|
||||||
|
SystemLogger::dispatch(
|
||||||
|
$message,
|
||||||
|
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||||
|
SystemLog::EVENT_GATEWAY_FAILURE,
|
||||||
|
SystemLog::TYPE_STRIPE,
|
||||||
|
$this->stripe->client,
|
||||||
|
$this->stripe->client->company,
|
||||||
|
);
|
||||||
|
|
||||||
|
throw new PaymentFailed('Failed to process the payment.', 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure Apple Pay domain is verified.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws ApiErrorException
|
||||||
|
*/
|
||||||
|
protected function ensureApplePayDomainIsValidated()
|
||||||
|
{
|
||||||
|
$config = $this->stripe->company_gateway->getConfig();
|
||||||
|
|
||||||
|
if (property_exists($config, 'apple_pay_domain_id')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$domain = config('ninja.app_url');
|
||||||
|
|
||||||
|
if (Ninja::isHosted()) {
|
||||||
|
$domain = isset($this->stripe->company_gateway->company->portal_domain)
|
||||||
|
? $this->stripe->company_gateway->company->portal_domain
|
||||||
|
: $this->stripe->company_gateway->company->domain();
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = ApplePayDomain::create([
|
||||||
|
'domain_name' => $domain,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$config->apple_pay_domain_id = $response->id;
|
||||||
|
|
||||||
|
$this->stripe->company_gateway->setConfig($config);
|
||||||
|
|
||||||
|
$this->stripe->company_gateway->save();
|
||||||
|
}
|
||||||
|
}
|
@ -40,6 +40,7 @@ use App\PaymentDrivers\Stripe\EPS;
|
|||||||
use App\PaymentDrivers\Stripe\Bancontact;
|
use App\PaymentDrivers\Stripe\Bancontact;
|
||||||
use App\PaymentDrivers\Stripe\BECS;
|
use App\PaymentDrivers\Stripe\BECS;
|
||||||
use App\PaymentDrivers\Stripe\ACSS;
|
use App\PaymentDrivers\Stripe\ACSS;
|
||||||
|
use App\PaymentDrivers\Stripe\BrowserPay;
|
||||||
use App\PaymentDrivers\Stripe\UpdatePaymentMethods;
|
use App\PaymentDrivers\Stripe\UpdatePaymentMethods;
|
||||||
use App\PaymentDrivers\Stripe\Utilities;
|
use App\PaymentDrivers\Stripe\Utilities;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
@ -82,7 +83,7 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
GatewayType::BANK_TRANSFER => ACH::class,
|
GatewayType::BANK_TRANSFER => ACH::class,
|
||||||
GatewayType::ALIPAY => Alipay::class,
|
GatewayType::ALIPAY => Alipay::class,
|
||||||
GatewayType::SOFORT => SOFORT::class,
|
GatewayType::SOFORT => SOFORT::class,
|
||||||
GatewayType::APPLE_PAY => ApplePay::class,
|
GatewayType::APPLE_PAY => BrowserPay::class,
|
||||||
GatewayType::SEPA => SEPA::class,
|
GatewayType::SEPA => SEPA::class,
|
||||||
GatewayType::PRZELEWY24 => PRZELEWY24::class,
|
GatewayType::PRZELEWY24 => PRZELEWY24::class,
|
||||||
GatewayType::GIROPAY => GIROPAY::class,
|
GatewayType::GIROPAY => GIROPAY::class,
|
||||||
@ -139,7 +140,7 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
{
|
{
|
||||||
$types = [
|
$types = [
|
||||||
// GatewayType::CRYPTO,
|
// GatewayType::CRYPTO,
|
||||||
GatewayType::CREDIT_CARD
|
GatewayType::CREDIT_CARD,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($this->client
|
if ($this->client
|
||||||
@ -218,6 +219,14 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
&& in_array($this->client->country->iso_3166_3, ["CAN", "USA"]))
|
&& in_array($this->client->country->iso_3166_3, ["CAN", "USA"]))
|
||||||
$types[] = GatewayType::ACSS;
|
$types[] = GatewayType::ACSS;
|
||||||
|
|
||||||
|
if (
|
||||||
|
$this->client
|
||||||
|
&& isset($this->client->country)
|
||||||
|
&& in_array($this->client->country->iso_3166_2, ['AE', 'AT', 'AU', 'BE', 'BG', 'BR', 'CA', 'CH', 'CI', 'CR', 'CY', 'CZ', 'DE', 'DK', 'DO', 'EE', 'ES', 'FI', 'FR', 'GB', 'GI', 'GR', 'GT', 'HK', 'HU', 'ID', 'IE', 'IN', 'IT', 'JP', 'LI', 'LT', 'LU', 'LV', 'MT', 'MX', 'MY', 'NL', 'NO', 'NZ', 'PE', 'PH', 'PL', 'PT', 'RO', 'SE', 'SG', 'SI', 'SK', 'SN', 'TH', 'TT', 'US', 'UY'])
|
||||||
|
) {
|
||||||
|
$types[] = GatewayType::APPLE_PAY;
|
||||||
|
}
|
||||||
|
|
||||||
return $types;
|
return $types;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,10 +525,13 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
foreach ($request->data as $transaction) {
|
foreach ($request->data as $transaction) {
|
||||||
$payment = Payment::query()
|
$payment = Payment::query()
|
||||||
->where('transaction_reference', $transaction['id'])
|
->where('transaction_reference', $transaction['payment_intent'])
|
||||||
->where('company_id', $request->getCompany()->id)
|
->where('company_id', $request->getCompany()->id)
|
||||||
|
->where(function ($query) use ($transaction) {
|
||||||
|
$query->where('transaction_reference', $transaction['payment_intent'])
|
||||||
|
->orWhere('transaction_reference', $transaction['id']);
|
||||||
|
})
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($payment) {
|
if ($payment) {
|
||||||
$payment->status_id = Payment::STATUS_COMPLETED;
|
$payment->status_id = Payment::STATUS_COMPLETED;
|
||||||
$payment->save();
|
$payment->save();
|
||||||
@ -537,10 +549,13 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
if ($charge->captured) {
|
if ($charge->captured) {
|
||||||
$payment = Payment::query()
|
$payment = Payment::query()
|
||||||
->where('transaction_reference', $transaction['id'])
|
->where('transaction_reference', $transaction['payment_intent'])
|
||||||
->where('company_id', $request->getCompany()->id)
|
->where('company_id', $request->getCompany()->id)
|
||||||
|
->where(function ($query) use ($transaction) {
|
||||||
|
$query->where('transaction_reference', $transaction['payment_intent'])
|
||||||
|
->orWhere('transaction_reference', $transaction['id']);
|
||||||
|
})
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($payment) {
|
if ($payment) {
|
||||||
$payment->status_id = Payment::STATUS_COMPLETED;
|
$payment->status_id = Payment::STATUS_COMPLETED;
|
||||||
$payment->save();
|
$payment->save();
|
||||||
|
@ -50,7 +50,7 @@ class ACH
|
|||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
// authorize the credit card
|
// authorize the credit card
|
||||||
|
|
||||||
nlog($data);
|
//nlog($data);
|
||||||
/*
|
/*
|
||||||
'_token' => '1Fk5CRj34up5ntKPvrFyMIAJhDdUNF3boqT3iIN3',
|
'_token' => '1Fk5CRj34up5ntKPvrFyMIAJhDdUNF3boqT3iIN3',
|
||||||
'company_gateway_id' => '39',
|
'company_gateway_id' => '39',
|
||||||
|
@ -277,7 +277,7 @@ class BaseRepository
|
|||||||
$new_invitation = $invitation_factory_class::create($model->company_id, $model->user_id);
|
$new_invitation = $invitation_factory_class::create($model->company_id, $model->user_id);
|
||||||
$new_invitation->{$lcfirst_resource_id} = $model->id;
|
$new_invitation->{$lcfirst_resource_id} = $model->id;
|
||||||
$new_invitation->client_contact_id = $contact->id;
|
$new_invitation->client_contact_id = $contact->id;
|
||||||
$new_invitation->key = $this->createDbHash(config('database.default'));
|
$new_invitation->key = $this->createDbHash($model->company->db);
|
||||||
$new_invitation->save();
|
$new_invitation->save();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ class UserRepository extends BaseRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$user->confirmation_code) {
|
if (!$user->confirmation_code) {
|
||||||
$user->confirmation_code = $this->createDbHash(config('database.default'));
|
$user->confirmation_code = $this->createDbHash($company->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->account_id = $account->id;
|
$user->account_id = $account->id;
|
||||||
|
@ -23,7 +23,7 @@ class CreateInvitations extends AbstractService
|
|||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
|
||||||
private $credit;
|
public $credit;
|
||||||
|
|
||||||
public function __construct(Credit $credit)
|
public function __construct(Credit $credit)
|
||||||
{
|
{
|
||||||
@ -45,11 +45,12 @@ class CreateInvitations extends AbstractService
|
|||||||
$invitation = CreditInvitation::whereCompanyId($this->credit->company_id)
|
$invitation = CreditInvitation::whereCompanyId($this->credit->company_id)
|
||||||
->whereClientContactId($contact->id)
|
->whereClientContactId($contact->id)
|
||||||
->whereCreditId($this->credit->id)
|
->whereCreditId($this->credit->id)
|
||||||
|
->withTrashed()
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (! $invitation) {
|
if (! $invitation) {
|
||||||
$ii = CreditInvitationFactory::create($this->credit->company_id, $this->credit->user_id);
|
$ii = CreditInvitationFactory::create($this->credit->company_id, $this->credit->user_id);
|
||||||
$ii->key = $this->createDbHash(config('database.default'));
|
$ii->key = $this->createDbHash($this->credit->company->db);
|
||||||
$ii->credit_id = $this->credit->id;
|
$ii->credit_id = $this->credit->id;
|
||||||
$ii->client_contact_id = $contact->id;
|
$ii->client_contact_id = $contact->id;
|
||||||
$ii->save();
|
$ii->save();
|
||||||
@ -58,6 +59,34 @@ class CreateInvitations extends AbstractService
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if($this->credit->invitations()->count() == 0) {
|
||||||
|
|
||||||
|
if($contacts->count() == 0){
|
||||||
|
$contact = $this->createBlankContact();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$contact = $contacts->first();
|
||||||
|
|
||||||
|
$invitation = CreditInvitation::where('company_id', $this->credit->company_id)
|
||||||
|
->where('client_contact_id', $contact->id)
|
||||||
|
->where('credit_id', $this->credit->id)
|
||||||
|
->withTrashed()
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if($invitation){
|
||||||
|
$invitation->restore();
|
||||||
|
return $this->credit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$ii = CreditInvitationFactory::create($this->credit->company_id, $this->credit->user_id);
|
||||||
|
$ii->key = $this->createDbHash($this->credit->company->db);
|
||||||
|
$ii->credit_id = $this->credit->id;
|
||||||
|
$ii->client_contact_id = $contact->id;
|
||||||
|
$ii->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this->credit;
|
return $this->credit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,13 +13,14 @@ namespace App\Services\Credit;
|
|||||||
|
|
||||||
use App\Jobs\Util\UnlinkFile;
|
use App\Jobs\Util\UnlinkFile;
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
|
use App\Services\Credit\CreateInvitations;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
class CreditService
|
class CreditService
|
||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
|
||||||
protected $credit;
|
public $credit;
|
||||||
|
|
||||||
public function __construct($credit)
|
public function __construct($credit)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,7 @@ class CreateInvitations extends AbstractService
|
|||||||
|
|
||||||
if (! $invitation && $contact->send_email) {
|
if (! $invitation && $contact->send_email) {
|
||||||
$ii = InvoiceInvitationFactory::create($this->invoice->company_id, $this->invoice->user_id);
|
$ii = InvoiceInvitationFactory::create($this->invoice->company_id, $this->invoice->user_id);
|
||||||
$ii->key = $this->createDbHash(config('database.default'));
|
$ii->key = $this->createDbHash($this->invoice->company->db);
|
||||||
$ii->invoice_id = $this->invoice->id;
|
$ii->invoice_id = $this->invoice->id;
|
||||||
$ii->client_contact_id = $contact->id;
|
$ii->client_contact_id = $contact->id;
|
||||||
$ii->save();
|
$ii->save();
|
||||||
@ -62,10 +62,26 @@ class CreateInvitations extends AbstractService
|
|||||||
|
|
||||||
if($this->invoice->invitations()->count() == 0) {
|
if($this->invoice->invitations()->count() == 0) {
|
||||||
|
|
||||||
|
if($contacts->count() == 0){
|
||||||
$contact = $this->createBlankContact();
|
$contact = $this->createBlankContact();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$contact = $contacts->first();
|
||||||
|
|
||||||
|
$invitation = InvoiceInvitation::where('company_id', $this->invoice->company_id)
|
||||||
|
->where('client_contact_id', $contact->id)
|
||||||
|
->where('invoice_id', $this->invoice->id)
|
||||||
|
->withTrashed()
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if($invitation){
|
||||||
|
$invitation->restore();
|
||||||
|
return $this->invoice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$ii = InvoiceInvitationFactory::create($this->invoice->company_id, $this->invoice->user_id);
|
$ii = InvoiceInvitationFactory::create($this->invoice->company_id, $this->invoice->user_id);
|
||||||
$ii->key = $this->createDbHash(config('database.default'));
|
$ii->key = $this->createDbHash($this->invoice->company->db);
|
||||||
$ii->invoice_id = $this->invoice->id;
|
$ii->invoice_id = $this->invoice->id;
|
||||||
$ii->client_contact_id = $contact->id;
|
$ii->client_contact_id = $contact->id;
|
||||||
$ii->save();
|
$ii->save();
|
||||||
|
@ -56,8 +56,15 @@ class HandleReversal extends AbstractService
|
|||||||
|
|
||||||
$paymentables->each(function ($paymentable) use ($total_paid) {
|
$paymentables->each(function ($paymentable) use ($total_paid) {
|
||||||
|
|
||||||
|
//new concept - when reversing, we unwind the payments
|
||||||
|
$payment = Payment::find($paymentable->payment_id);
|
||||||
|
|
||||||
$reversable_amount = $paymentable->amount - $paymentable->refunded;
|
$reversable_amount = $paymentable->amount - $paymentable->refunded;
|
||||||
$total_paid -= $reversable_amount;
|
$total_paid -= $reversable_amount;
|
||||||
|
|
||||||
|
$payment->applied -= $reversable_amount;
|
||||||
|
$payment->save();
|
||||||
|
|
||||||
$paymentable->amount = $paymentable->refunded;
|
$paymentable->amount = $paymentable->refunded;
|
||||||
$paymentable->save();
|
$paymentable->save();
|
||||||
|
|
||||||
@ -67,45 +74,45 @@ class HandleReversal extends AbstractService
|
|||||||
$notes = 'Credit for reversal of '.$this->invoice->number;
|
$notes = 'Credit for reversal of '.$this->invoice->number;
|
||||||
$credit = false;
|
$credit = false;
|
||||||
|
|
||||||
if ($total_paid > 0) {
|
// if ($total_paid > 0) {
|
||||||
|
|
||||||
$credit = CreditFactory::create($this->invoice->company_id, $this->invoice->user_id);
|
// $credit = CreditFactory::create($this->invoice->company_id, $this->invoice->user_id);
|
||||||
$credit->client_id = $this->invoice->client_id;
|
// $credit->client_id = $this->invoice->client_id;
|
||||||
$credit->invoice_id = $this->invoice->id;
|
// $credit->invoice_id = $this->invoice->id;
|
||||||
$credit->date = now();
|
// $credit->date = now();
|
||||||
|
|
||||||
$item = InvoiceItemFactory::create();
|
// $item = InvoiceItemFactory::create();
|
||||||
$item->quantity = 1;
|
// $item->quantity = 1;
|
||||||
$item->cost = (float) $total_paid;
|
// $item->cost = (float) $total_paid;
|
||||||
$item->notes = $notes;
|
// $item->notes = $notes;
|
||||||
|
|
||||||
$line_items[] = $item;
|
// $line_items[] = $item;
|
||||||
$credit->line_items = $line_items;
|
// $credit->line_items = $line_items;
|
||||||
$credit->save();
|
// $credit->save();
|
||||||
|
|
||||||
$credit_calc = new InvoiceSum($credit);
|
// $credit_calc = new InvoiceSum($credit);
|
||||||
$credit_calc->build();
|
// $credit_calc->build();
|
||||||
|
|
||||||
$credit = $credit_calc->purgeTaxes()->getCredit();
|
// $credit = $credit_calc->purgeTaxes()->getCredit();
|
||||||
$credit->service()->markSent()->save();
|
// $credit->service()->markSent()->save();
|
||||||
}
|
// }
|
||||||
|
|
||||||
/*If there is a payment linked, then the credit needs to be linked back to that payment in case of refund*/
|
/*If there is a payment linked, then the credit needs to be linked back to that payment in case of refund*/
|
||||||
if ($paymentables->count() > 0 && $credit) {
|
if ($paymentables->count() > 0 && $credit) {
|
||||||
$payment = $paymentables->first()->payment;
|
// $payment = $paymentables->first()->payment;
|
||||||
$payment->credits()->save($credit);
|
// $payment->credits()->save($credit);
|
||||||
|
|
||||||
$paymentable_credit = $payment->credits()
|
// $paymentable_credit = $payment->credits()
|
||||||
->wherePaymentableType(Credit::class)
|
// ->wherePaymentableType(Credit::class)
|
||||||
->wherePaymentableId($credit->id)
|
// ->wherePaymentableId($credit->id)
|
||||||
->first();
|
// ->first();
|
||||||
|
|
||||||
//harvest the credit record and add in the amount for the credit.
|
// //harvest the credit record and add in the amount for the credit.
|
||||||
$paymentable_credit->pivot->amount = $total_paid;
|
// $paymentable_credit->pivot->amount = $total_paid;
|
||||||
$paymentable_credit->pivot->save();
|
// $paymentable_credit->pivot->save();
|
||||||
|
|
||||||
$paymentable_credit->paid_to_date += $total_paid;
|
// $paymentable_credit->paid_to_date += $total_paid;
|
||||||
$paymentable_credit->save();
|
// $paymentable_credit->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set invoice balance to 0 */
|
/* Set invoice balance to 0 */
|
||||||
@ -124,7 +131,7 @@ class HandleReversal extends AbstractService
|
|||||||
|
|
||||||
$this->invoice->client->service()
|
$this->invoice->client->service()
|
||||||
->updateBalance($balance_remaining * -1)
|
->updateBalance($balance_remaining * -1)
|
||||||
->updatePaidToDate($total_paid * -1)
|
// ->updatePaidToDate($total_paid * -1)
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
event(new InvoiceWasReversed($this->invoice, $this->invoice->company, Ninja::eventVars()));
|
event(new InvoiceWasReversed($this->invoice, $this->invoice->company, Ninja::eventVars()));
|
||||||
|
@ -33,7 +33,7 @@ class InvoiceService
|
|||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
|
||||||
private $invoice;
|
public $invoice;
|
||||||
|
|
||||||
public function __construct($invoice)
|
public function __construct($invoice)
|
||||||
{
|
{
|
||||||
|
@ -112,7 +112,7 @@ class PaymentService
|
|||||||
/* Iterate through the invoices and apply credits to them */
|
/* Iterate through the invoices and apply credits to them */
|
||||||
collect($payment_hash->invoices())->each(function ($payable_invoice) use ($payment_hash) {
|
collect($payment_hash->invoices())->each(function ($payable_invoice) use ($payment_hash) {
|
||||||
|
|
||||||
$invoice = Invoice::find($this->decodePrimaryKey($payable_invoice->invoice_id));
|
$invoice = Invoice::withTrashed()->find($this->decodePrimaryKey($payable_invoice->invoice_id));
|
||||||
|
|
||||||
$amount = $payable_invoice->amount;
|
$amount = $payable_invoice->amount;
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ class UpdateInvoicePayment
|
|||||||
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->payment->save();
|
$this->payment->saveQuietly();
|
||||||
|
|
||||||
return $this->payment;
|
return $this->payment;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ class ConvertQuote
|
|||||||
foreach($quote->invitations as $quote_invitation){
|
foreach($quote->invitations as $quote_invitation){
|
||||||
|
|
||||||
$ii = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id);
|
$ii = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id);
|
||||||
$ii->key = $this->createDbHash(config('database.default'));
|
$ii->key = $this->createDbHash($invoice->company->db);
|
||||||
$ii->client_contact_id = $quote_invitation->client_contact_id;
|
$ii->client_contact_id = $quote_invitation->client_contact_id;
|
||||||
|
|
||||||
$invites[] = $ii;
|
$invites[] = $ii;
|
||||||
|
@ -50,7 +50,7 @@ class CreateInvitations
|
|||||||
|
|
||||||
if (! $invitation && $contact->send_email) {
|
if (! $invitation && $contact->send_email) {
|
||||||
$ii = QuoteInvitationFactory::create($this->quote->company_id, $this->quote->user_id);
|
$ii = QuoteInvitationFactory::create($this->quote->company_id, $this->quote->user_id);
|
||||||
$ii->key = $this->createDbHash(config('database.default'));
|
$ii->key = $this->createDbHash($this->quote->company->db);
|
||||||
$ii->quote_id = $this->quote->id;
|
$ii->quote_id = $this->quote->id;
|
||||||
$ii->client_contact_id = $contact->id;
|
$ii->client_contact_id = $contact->id;
|
||||||
$ii->save();
|
$ii->save();
|
||||||
@ -59,6 +59,33 @@ class CreateInvitations
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if($this->quote->invitations()->count() == 0) {
|
||||||
|
|
||||||
|
if($contacts->count() == 0){
|
||||||
|
$contact = $this->createBlankContact();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$contact = $contacts->first();
|
||||||
|
|
||||||
|
$invitation = QuoteInvitation::where('company_id', $this->quote->company_id)
|
||||||
|
->where('client_contact_id', $contact->id)
|
||||||
|
->where('quote_id', $this->quote->id)
|
||||||
|
->withTrashed()
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if($invitation){
|
||||||
|
$invitation->restore();
|
||||||
|
return $this->quote;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$ii = QuoteInvitationFactory::create($this->quote->company_id, $this->quote->user_id);
|
||||||
|
$ii->key = $this->createDbHash($this->quote->company->db);
|
||||||
|
$ii->quote_id = $this->quote->id;
|
||||||
|
$ii->client_contact_id = $contact->id;
|
||||||
|
$ii->save();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->quote->fresh();
|
return $this->quote->fresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class CreateRecurringInvitations extends AbstractService
|
|||||||
|
|
||||||
if (! $invitation && $contact->send_email) {
|
if (! $invitation && $contact->send_email) {
|
||||||
$ii = $this->invitation_factory::create($this->entity->company_id, $this->entity->user_id);
|
$ii = $this->invitation_factory::create($this->entity->company_id, $this->entity->user_id);
|
||||||
$ii->key = $this->createDbHash(config('database.default'));
|
$ii->key = $this->createDbHash($this->entity->company->db);
|
||||||
$ii->{$this->entity_id_name} = $this->entity->id;
|
$ii->{$this->entity_id_name} = $this->entity->id;
|
||||||
$ii->client_contact_id = $contact->id;
|
$ii->client_contact_id = $contact->id;
|
||||||
$ii->save();
|
$ii->save();
|
||||||
|
@ -264,4 +264,17 @@ class Helpers
|
|||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve the font from the supported fonts array.
|
||||||
|
*
|
||||||
|
* @param string $font
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function resolveFont(string $font = 'Arial'): array
|
||||||
|
{
|
||||||
|
return $font
|
||||||
|
? ['name' => str_replace('_', ' ', $font), 'url' => sprintf('https://fonts.googleapis.com/css2?family=%s&display=swap', str_replace('_', '+', $font))]
|
||||||
|
: ['name' => 'Arial', 'url' => ''];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,6 +151,7 @@ class HtmlEngine
|
|||||||
|
|
||||||
if($this->entity->project) {
|
if($this->entity->project) {
|
||||||
$data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project_name')];
|
$data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project_name')];
|
||||||
|
$data['$invoice.project'] = &$data['$project.name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,6 +446,8 @@ class HtmlEngine
|
|||||||
$data['_rate3'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
$data['_rate3'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
||||||
|
|
||||||
$data['$font_size'] = ['value' => $this->settings->font_size . 'px', 'label' => ''];
|
$data['$font_size'] = ['value' => $this->settings->font_size . 'px', 'label' => ''];
|
||||||
|
$data['$font_name'] = ['value' => Helpers::resolveFont($this->settings->primary_font)['name'], 'label' => ''];
|
||||||
|
$data['$font_url'] = ['value' => Helpers::resolveFont($this->settings->primary_font)['url'], 'label' => ''];
|
||||||
|
|
||||||
$data['$invoiceninja.whitelabel'] = ['value' => 'https://raw.githubusercontent.com/invoiceninja/invoiceninja/v5-develop/public/images/new_logo.png', 'label' => ''];
|
$data['$invoiceninja.whitelabel'] = ['value' => 'https://raw.githubusercontent.com/invoiceninja/invoiceninja/v5-develop/public/images/new_logo.png', 'label' => ''];
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ use App\Models\Client;
|
|||||||
use App\Models\ClientContact;
|
use App\Models\ClientContact;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\InvoiceInvitation;
|
use App\Models\InvoiceInvitation;
|
||||||
|
use App\Models\Quote;
|
||||||
|
use App\Models\QuoteInvitation;
|
||||||
use App\Services\PdfMaker\Designs\Utilities\DesignHelpers;
|
use App\Services\PdfMaker\Designs\Utilities\DesignHelpers;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
@ -254,6 +256,9 @@ class TemplateEngine
|
|||||||
'send_email' => true,
|
'send_email' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
if($this->entity == 'invoice')
|
||||||
|
{
|
||||||
$this->entity_obj = Invoice::factory()->create([
|
$this->entity_obj = Invoice::factory()->create([
|
||||||
'user_id' => auth()->user()->id,
|
'user_id' => auth()->user()->id,
|
||||||
'company_id' => auth()->user()->company()->id,
|
'company_id' => auth()->user()->company()->id,
|
||||||
@ -266,6 +271,23 @@ class TemplateEngine
|
|||||||
'invoice_id' => $this->entity_obj->id,
|
'invoice_id' => $this->entity_obj->id,
|
||||||
'client_contact_id' => $contact->id,
|
'client_contact_id' => $contact->id,
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->entity == 'quote')
|
||||||
|
{
|
||||||
|
$this->entity_obj = Quote::factory()->create([
|
||||||
|
'user_id' => auth()->user()->id,
|
||||||
|
'company_id' => auth()->user()->company()->id,
|
||||||
|
'client_id' => $client->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$invitation = QuoteInvitation::factory()->create([
|
||||||
|
'user_id' => auth()->user()->id,
|
||||||
|
'company_id' => auth()->user()->company()->id,
|
||||||
|
'quote_id' => $this->entity_obj->id,
|
||||||
|
'client_contact_id' => $contact->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$this->entity_obj->setRelation('invitations', $invitation);
|
$this->entity_obj->setRelation('invitations', $invitation);
|
||||||
$this->entity_obj->setRelation('client', $client);
|
$this->entity_obj->setRelation('client', $client);
|
||||||
|
@ -14,8 +14,8 @@ return [
|
|||||||
'require_https' => env('REQUIRE_HTTPS', true),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||||
'app_version' => '5.3.29',
|
'app_version' => '5.3.30',
|
||||||
'app_tag' => '5.3.29',
|
'app_tag' => '5.3.30',
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', ''),
|
'api_secret' => env('API_SECRET', ''),
|
||||||
|
21
database/migrations/2021_11_03_131308_onboarding.php
Normal file
21
database/migrations/2021_11_03_131308_onboarding.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class Onboarding extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('accounts', function (Blueprint $table) {
|
||||||
|
$table->boolean('is_onboarding')->default(false);
|
||||||
|
$table->mediumText('onboarding')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
8682
package-lock.json
generated
8682
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
33
package.json
33
package.json
@ -2,33 +2,34 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "npm run development",
|
"dev": "npm run development",
|
||||||
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
"development": "mix",
|
||||||
"watch": "npm run development -- --watch",
|
"watch": "mix watch",
|
||||||
"watch-poll": "npm run watch -- --watch-poll",
|
"watch-poll": "mix watch -- --watch-options-poll=1000",
|
||||||
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
|
"hot": "mix watch --hot",
|
||||||
"prod": "npm run production",
|
"production": "mix --production"
|
||||||
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/compat-data": "7.9.0",
|
"@babel/compat-data": "7.15.0",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
||||||
"laravel-mix-purgecss": "^5.0.0",
|
"laravel-mix-purgecss": "^6.0.0",
|
||||||
"vue-template-compiler": "^2.6.14"
|
"vue-template-compiler": "^2.6.14"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tailwindcss/ui": "^0.7",
|
"@tailwindcss/ui": "^0.7",
|
||||||
"axios": "^0.21.1",
|
"autoprefixer": "^10.3.7",
|
||||||
|
"axios": "^0.24.0",
|
||||||
"card-js": "^1.0.13",
|
"card-js": "^1.0.13",
|
||||||
"card-validator": "^6.2.0",
|
"card-validator": "^8.1.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"jsignature": "^2.1.3",
|
"jsignature": "^2.1.3",
|
||||||
"json-formatter-js": "^2.3.4",
|
"json-formatter-js": "^2.3.4",
|
||||||
"laravel-mix": "^5.0.9",
|
"laravel-mix": "^6.0.34",
|
||||||
"linkify-urls": "^3.1.1",
|
"linkify-urls": "^4.0.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"resolve-url-loader": "^3.1.4",
|
"postcss": "^8.3.11",
|
||||||
"sass": "^1.38.0",
|
"resolve-url-loader": "^4.0.0",
|
||||||
"sass-loader": "^8.0.0",
|
"sass": "^1.43.4",
|
||||||
"tailwindcss": "^1.9.6"
|
"sass-loader": "^12.3.0",
|
||||||
|
"tailwindcss": "^2.2.17"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
4
public/css/app.css
vendored
4
public/css/app.css
vendored
File diff suppressed because one or more lines are too long
2
public/css/card-js.min.css
vendored
2
public/css/card-js.min.css
vendored
@ -1 +1 @@
|
|||||||
.card-js input.card-number{padding-right:48px}.card-js .card-number-wrapper .card-type-icon{height:23px;width:32px;position:absolute;display:block;right:8px;top:7px;background:url(https://cardjs.co.uk/img/cards.png) 0 23px no-repeat;pointer-events:none;opacity:0;-webkit-transition:opacity .15s linear;-moz-transition:opacity .15s linear;-ms-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.card-js .card-number-wrapper .show{opacity:1}.card-js .card-number-wrapper .card-type-icon.visa{background-position:0 0}.card-js .card-number-wrapper .card-type-icon.master-card{background-position:-32px 0}.card-js .card-number-wrapper .card-type-icon.american-express{background-position:-64px 0}.card-js .card-number-wrapper .card-type-icon.discover{background-position:-96px 0}.card-js .card-number-wrapper .card-type-icon.diners{background-position:-128px 0}.card-js .card-number-wrapper .card-type-icon.jcb{background-position:-160px 0}.card-js .cvc-container{width:50%;float:right}.card-js .cvc-wrapper{box-sizing:border-box;margin-left:5px}.card-js .cvc-wrapper .cvc{display:block;width:100%}.card-js .expiry-container{width:50%;float:left}.card-js .expiry-wrapper{box-sizing:border-box;margin-right:5px}.card-js .expiry-wrapper .expiry{display:block;width:100%}.card-js .expiry-wrapper .expiry-month{border-top-right-radius:0;border-bottom-right-radius:0;padding-left:30px}.card-js .expiry-wrapper .expiry-year{border-top-left-radius:0;border-bottom-left-radius:0;border-left:0}.card-js .expiry-wrapper .expiry-month,.card-js .expiry-wrapper .expiry-year{display:inline-block}.card-js .expiry-wrapper .expiry{padding-left:38px}.card-js .icon{position:absolute;display:block;width:24px;height:17px;left:8px;top:10px;pointer-events:none}.card-js .icon.right{right:8px;left:auto}.card-js .icon.popup{cursor:pointer;pointer-events:auto}.card-js .icon .svg{fill:#888}.card-js .icon.popup .svg{fill:#aaa!important}.card-js .card-number-wrapper,.card-js .name-wrapper{margin-bottom:15px;width:100%}.card-js .card-number-wrapper,.card-js .cvc-wrapper,.card-js .expiry-wrapper,.card-js .name-wrapper{-webkit-box-shadow:0 1px 0 rgba(255,255,255,.7),inset 0 1px 0 rgba(255,255,255,.7);-moz-box-shadow:0 1px 0 rgba(255,255,255,.7),inset 0 1px 0 rgba(255,255,255,.7);-ms-box-shadow:0 1px 0 rgba(255,255,255,.7),inset 0 1px 0 rgba(255,255,255,.7);-o-box-shadow:0 1px 0 rgba(255,255,255,.7),inset 0 1px 0 rgba(255,255,255,.7);box-shadow:0 1px 0 rgba(255,255,255,.7),inset 0 1px 0 rgba(255,255,255,.7);position:relative}.card-js .card-number-wrapper,.card-js .cvc-container,.card-js .expiry-container,.card-js .name-wrapper{display:inline-block}.card-js::after{content:' ';display:table;clear:both}.card-js input,.card-js select{color:#676767;font-size:15px;font-weight:300;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;height:36px;border:1px solid #d9d9d9;border-radius:4px;box-shadow:none;background-color:#FDFDFD;box-sizing:border-box;padding:0;-webkit-transition:border-color .15s linear,box-shadow .15s linear;-moz-transition:border-color .15s linear,box-shadow .15s linear;-ms-transition:border-color .15s linear,box-shadow .15s linear;-o-transition:border-color .15s linear,box-shadow .15s linear;transition:border-color .15s linear,box-shadow .15s linear}.card-js select{-moz-appearance:none;text-indent:.01px;text-overflow:''}.card-js input[disabled],.card-js select[disabled]{background-color:#eee;color:#555}.card-js select option[hidden]{color:#ABA9A9}.card-js input:focus,.card-js select:focus{background-color:#fff;outline:0;border-color:#66afe9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.card-js input[readonly=readonly]:not([disabled]),.card-js input[readonly]:not([disabled]){background-color:#fff;cursor:pointer}.card-js .has-error input,.card-js .has-error input:focus{border-color:#F64B2F;box-shadow:none}.card-js input.card-number,.card-js input.cvc,.card-js input.name{padding-left:38px;width:100%}.card-js.stripe .icon .svg{fill:#559A28}
|
.card-js input.card-number{padding-right:48px}.card-js .card-number-wrapper .card-type-icon{height:23px;width:32px;position:absolute;display:block;right:8px;top:7px;background:url(https://cardjs.co.uk/img/cards.png) 0 23px no-repeat;pointer-events:none;opacity:0;-webkit-transition:opacity .15s linear;-moz-transition:opacity .15s linear;-ms-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.card-js .card-number-wrapper .show{opacity:1}.card-js .card-number-wrapper .card-type-icon.visa{background-position:0 0}.card-js .card-number-wrapper .card-type-icon.master-card{background-position:-32px 0}.card-js .card-number-wrapper .card-type-icon.american-express{background-position:-64px 0}.card-js .card-number-wrapper .card-type-icon.discover{background-position:-96px 0}.card-js .card-number-wrapper .card-type-icon.diners{background-position:-128px 0}.card-js .card-number-wrapper .card-type-icon.jcb{background-position:-160px 0}.card-js .cvc-container{width:50%;float:right}.card-js .cvc-wrapper{box-sizing:border-box;margin-left:5px}.card-js .cvc-wrapper .cvc{display:block;width:100%}.card-js .expiry-container{width:50%;float:left}.card-js .expiry-wrapper{box-sizing:border-box;margin-right:5px}.card-js .expiry-wrapper .expiry{display:block;width:100%}.card-js .expiry-wrapper .expiry-month{border-top-right-radius:0;border-bottom-right-radius:0;padding-left:30px}.card-js .expiry-wrapper .expiry-year{border-top-left-radius:0;border-bottom-left-radius:0;border-left:0}.card-js .expiry-wrapper .expiry-month,.card-js .expiry-wrapper .expiry-year{display:inline-block}.card-js .expiry-wrapper .expiry{padding-left:38px}.card-js .icon{position:absolute;display:block;width:24px;height:17px;left:8px;top:10px;pointer-events:none}.card-js .icon.right{right:8px;left:auto}.card-js .icon.popup{cursor:pointer;pointer-events:auto}.card-js .icon .svg{fill:#888}.card-js .icon.popup .svg{fill:#aaa!important}.card-js .card-number-wrapper,.card-js .name-wrapper{margin-bottom:15px;width:100%}.card-js .card-number-wrapper,.card-js .cvc-wrapper,.card-js .expiry-wrapper,.card-js .name-wrapper{-webkit-box-shadow:0 1px 0 rgba(255,255,255,.7),inset 0 1px 0 rgba(255,255,255,.7);-moz-box-shadow:0 1px 0 rgba(255,255,255,.7),inset 0 1px 0 rgba(255,255,255,.7);-ms-box-shadow:0 1px 0 rgba(255,255,255,.7),inset 0 1px 0 rgba(255,255,255,.7);-o-box-shadow:0 1px 0 rgba(255,255,255,.7),inset 0 1px 0 rgba(255,255,255,.7);box-shadow:0 1px 0 rgba(255,255,255,.7),inset 0 1px 0 rgba(255,255,255,.7);position:relative}.card-js .card-number-wrapper,.card-js .cvc-container,.card-js .expiry-container,.card-js .name-wrapper{display:inline-block}.card-js::after{content:' ';display:table;clear:both}.card-js input,.card-js select{color:#676767;font-size:15px;font-weight:300;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;height:36px;border:1px solid #d9d9d9;border-radius:4px;box-shadow:none;background-color:#fdfdfd;box-sizing:border-box;padding:0;-webkit-transition:border-color .15s linear,box-shadow .15s linear;-moz-transition:border-color .15s linear,box-shadow .15s linear;-ms-transition:border-color .15s linear,box-shadow .15s linear;-o-transition:border-color .15s linear,box-shadow .15s linear;transition:border-color .15s linear,box-shadow .15s linear}.card-js select{-moz-appearance:none;text-indent:.01px;text-overflow:''}.card-js input[disabled],.card-js select[disabled]{background-color:#eee;color:#555}.card-js select option[hidden]{color:#aba9a9}.card-js input:focus,.card-js select:focus{background-color:#fff;outline:0;border-color:#66afe9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.card-js input[readonly=readonly]:not([disabled]),.card-js input[readonly]:not([disabled]){background-color:#fff;cursor:pointer}.card-js .has-error input,.card-js .has-error input:focus{border-color:#f64b2f;box-shadow:none}.card-js input.card-number,.card-js input.cvc,.card-js input.name{padding-left:38px;width:100%}.card-js.stripe .icon .svg{fill:#559A28}
|
||||||
|
50
public/flutter_service_worker.js
vendored
50
public/flutter_service_worker.js
vendored
@ -3,38 +3,38 @@ const MANIFEST = 'flutter-app-manifest';
|
|||||||
const TEMP = 'flutter-temp-cache';
|
const TEMP = 'flutter-temp-cache';
|
||||||
const CACHE_NAME = 'flutter-app-cache';
|
const CACHE_NAME = 'flutter-app-cache';
|
||||||
const RESOURCES = {
|
const RESOURCES = {
|
||||||
"version.json": "27abc97e9c76cf112b697fa080c304b5",
|
"icons/Icon-512.png": "0f9aff01367f0a0c69773d25ca16ef35",
|
||||||
"favicon.ico": "51636d3a390451561744c42188ccd628",
|
"icons/Icon-192.png": "bb1cf5f6982006952211c7c8404ffbed",
|
||||||
"favicon.png": "dca91c54388f52eded692718d5a98b8b",
|
"favicon.png": "dca91c54388f52eded692718d5a98b8b",
|
||||||
|
"/": "542e2d73b9cfe7a3d5174afa95366cc3",
|
||||||
|
"manifest.json": "ef43d90e57aa7682d7e2cfba2f484a40",
|
||||||
|
"favicon.ico": "51636d3a390451561744c42188ccd628",
|
||||||
|
"version.json": "6d65f0d3d61870372cdbb5f485e4da00",
|
||||||
"assets/fonts/MaterialIcons-Regular.otf": "4e6447691c9509f7acdbf8a931a85ca1",
|
"assets/fonts/MaterialIcons-Regular.otf": "4e6447691c9509f7acdbf8a931a85ca1",
|
||||||
"assets/NOTICES": "9eb7e2eb2888ea5bae5f536720db37cd",
|
"assets/NOTICES": "9eb7e2eb2888ea5bae5f536720db37cd",
|
||||||
|
"assets/packages/material_design_icons_flutter/lib/fonts/materialdesignicons-webfont.ttf": "174c02fc4609e8fc4389f5d21f16a296",
|
||||||
|
"assets/FontManifest.json": "cf3c681641169319e61b61bd0277378f",
|
||||||
|
"assets/assets/images/payment_types/paypal.png": "8e06c094c1871376dfea1da8088c29d1",
|
||||||
|
"assets/assets/images/payment_types/mastercard.png": "6f6cdc29ee2e22e06b1ac029cb52ef71",
|
||||||
|
"assets/assets/images/payment_types/carteblanche.png": "d936e11fa3884b8c9f1bd5c914be8629",
|
||||||
|
"assets/assets/images/payment_types/solo.png": "2030c3ccaccf5d5e87916a62f5b084d6",
|
||||||
|
"assets/assets/images/payment_types/other.png": "d936e11fa3884b8c9f1bd5c914be8629",
|
||||||
|
"assets/assets/images/payment_types/discover.png": "6c0a386a00307f87db7bea366cca35f5",
|
||||||
|
"assets/assets/images/payment_types/amex.png": "c49a4247984b3732a4af50a3390aa978",
|
||||||
|
"assets/assets/images/payment_types/ach.png": "7433f0aff779dc98a649b7a2daf777cf",
|
||||||
|
"assets/assets/images/payment_types/jcb.png": "07e0942d16c5592118b72e74f2f7198c",
|
||||||
|
"assets/assets/images/payment_types/laser.png": "b4e6e93dd35517ac429301119ff05868",
|
||||||
|
"assets/assets/images/payment_types/visa.png": "3ddc4a4d25c946e8ad7e6998f30fd4e3",
|
||||||
|
"assets/assets/images/payment_types/dinerscard.png": "06d85186ba858c18ab7c9caa42c92024",
|
||||||
|
"assets/assets/images/payment_types/switch.png": "4fa11c45327f5fdc20205821b2cfd9cc",
|
||||||
|
"assets/assets/images/payment_types/maestro.png": "e533b92bfb50339fdbfa79e3dfe81f08",
|
||||||
|
"assets/assets/images/payment_types/unionpay.png": "7002f52004e0ab8cc0b7450b0208ccb2",
|
||||||
|
"assets/assets/images/logo_dark.png": "a233ed1d4d0f7414bf97a9a10f11fb0a",
|
||||||
"assets/assets/images/icon.png": "090f69e23311a4b6d851b3880ae52541",
|
"assets/assets/images/icon.png": "090f69e23311a4b6d851b3880ae52541",
|
||||||
"assets/assets/images/google_logo.png": "0f118259ce403274f407f5e982e681c3",
|
"assets/assets/images/google_logo.png": "0f118259ce403274f407f5e982e681c3",
|
||||||
"assets/assets/images/logo_light.png": "e5f46d5a78e226e7a9553d4ca6f69219",
|
"assets/assets/images/logo_light.png": "e5f46d5a78e226e7a9553d4ca6f69219",
|
||||||
"assets/assets/images/payment_types/laser.png": "b4e6e93dd35517ac429301119ff05868",
|
|
||||||
"assets/assets/images/payment_types/discover.png": "6c0a386a00307f87db7bea366cca35f5",
|
|
||||||
"assets/assets/images/payment_types/mastercard.png": "6f6cdc29ee2e22e06b1ac029cb52ef71",
|
|
||||||
"assets/assets/images/payment_types/amex.png": "c49a4247984b3732a4af50a3390aa978",
|
|
||||||
"assets/assets/images/payment_types/ach.png": "7433f0aff779dc98a649b7a2daf777cf",
|
|
||||||
"assets/assets/images/payment_types/carteblanche.png": "d936e11fa3884b8c9f1bd5c914be8629",
|
|
||||||
"assets/assets/images/payment_types/other.png": "d936e11fa3884b8c9f1bd5c914be8629",
|
|
||||||
"assets/assets/images/payment_types/visa.png": "3ddc4a4d25c946e8ad7e6998f30fd4e3",
|
|
||||||
"assets/assets/images/payment_types/maestro.png": "e533b92bfb50339fdbfa79e3dfe81f08",
|
|
||||||
"assets/assets/images/payment_types/jcb.png": "07e0942d16c5592118b72e74f2f7198c",
|
|
||||||
"assets/assets/images/payment_types/solo.png": "2030c3ccaccf5d5e87916a62f5b084d6",
|
|
||||||
"assets/assets/images/payment_types/switch.png": "4fa11c45327f5fdc20205821b2cfd9cc",
|
|
||||||
"assets/assets/images/payment_types/paypal.png": "8e06c094c1871376dfea1da8088c29d1",
|
|
||||||
"assets/assets/images/payment_types/unionpay.png": "7002f52004e0ab8cc0b7450b0208ccb2",
|
|
||||||
"assets/assets/images/payment_types/dinerscard.png": "06d85186ba858c18ab7c9caa42c92024",
|
|
||||||
"assets/assets/images/logo_dark.png": "a233ed1d4d0f7414bf97a9a10f11fb0a",
|
|
||||||
"assets/FontManifest.json": "cf3c681641169319e61b61bd0277378f",
|
|
||||||
"assets/AssetManifest.json": "38d9aea341601f3a5c6fa7b5a1216ea5",
|
"assets/AssetManifest.json": "38d9aea341601f3a5c6fa7b5a1216ea5",
|
||||||
"assets/packages/material_design_icons_flutter/lib/fonts/materialdesignicons-webfont.ttf": "174c02fc4609e8fc4389f5d21f16a296",
|
"main.dart.js": "9ce1905069f75f930622606502e06e31"
|
||||||
"icons/Icon-192.png": "bb1cf5f6982006952211c7c8404ffbed",
|
|
||||||
"icons/Icon-512.png": "0f9aff01367f0a0c69773d25ca16ef35",
|
|
||||||
"main.dart.js": "4b982138f175597df211146084e39b66",
|
|
||||||
"manifest.json": "ef43d90e57aa7682d7e2cfba2f484a40",
|
|
||||||
"/": "3debb9cbb687369f006a776cc7ab525b"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// The application shell files that are downloaded before a service worker can
|
// The application shell files that are downloaded before a service worker can
|
||||||
|
2
public/js/app.js
vendored
2
public/js/app.js
vendored
File diff suppressed because one or more lines are too long
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see action-selectors.js.LICENSE.txt */
|
/*! For license information please see action-selectors.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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=4)}({4:function(e,t,n){e.exports=n("Boob")},Boob:function(e,t){function n(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,c=function(){};return{s:c,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,i=!0,l=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,u=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw u}}}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.parentElement=document.querySelector(".form-check-parent"),this.parentForm=document.getElementById("bulkActions")}var t,r,c;return t=e,(r=[{key:"watchCheckboxes",value:function(e){var t=this;document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})),document.querySelectorAll(".form-check-child").forEach((function(n){e.checked?(n.checked=e.checked,t.processChildItem(n,document.getElementById("bulkActions"))):(n.checked=!1,document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})))}))}},{key:"processChildItem",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(r.hasOwnProperty("single")&&document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})),!1!==e.checked){var o=document.createElement("INPUT");o.setAttribute("name","invoices[]"),o.setAttribute("value",e.dataset.value),o.setAttribute("class","child-hidden-input"),o.hidden=!0,t.append(o)}else{var c,u=document.querySelectorAll("input.child-hidden-input"),i=n(u);try{for(i.s();!(c=i.n()).done;){var l=c.value;l.value==e.dataset.value&&l.remove()}}catch(e){i.e(e)}finally{i.f()}}}},{key:"handle",value:function(){var e=this;this.parentElement.addEventListener("click",(function(){e.watchCheckboxes(e.parentElement)}));var t,r=n(document.querySelectorAll(".form-check-child"));try{var o=function(){var n=t.value;n.addEventListener("click",(function(){e.processChildItem(n,e.parentForm)}))};for(r.s();!(t=r.n()).done;)o()}catch(e){r.e(e)}finally{r.f()}}}])&&o(t.prototype,r),c&&o(t,c),e}())).handle()}});
|
(()=>{function e(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var o=0,c=function(){};return{s:c,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.parentElement=document.querySelector(".form-check-parent"),this.parentForm=document.getElementById("bulkActions")}var r,o,c;return r=t,o=[{key:"watchCheckboxes",value:function(e){var t=this;document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})),document.querySelectorAll(".form-check-child").forEach((function(n){e.checked?(n.checked=e.checked,t.processChildItem(n,document.getElementById("bulkActions"))):(n.checked=!1,document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})))}))}},{key:"processChildItem",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(r.hasOwnProperty("single")&&document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})),!1!==t.checked){var o=document.createElement("INPUT");o.setAttribute("name","invoices[]"),o.setAttribute("value",t.dataset.value),o.setAttribute("class","child-hidden-input"),o.hidden=!0,n.append(o)}else{var c,i=document.querySelectorAll("input.child-hidden-input"),a=e(i);try{for(a.s();!(c=a.n()).done;){var l=c.value;l.value==t.dataset.value&&l.remove()}}catch(e){a.e(e)}finally{a.f()}}}},{key:"handle",value:function(){var t=this;this.parentElement.addEventListener("click",(function(){t.watchCheckboxes(t.parentElement)}));var n,r=e(document.querySelectorAll(".form-check-child"));try{var o=function(){var e=n.value;e.addEventListener("click",(function(){t.processChildItem(e,t.parentForm)}))};for(r.s();!(n=r.n()).done;)o()}catch(e){r.e(e)}finally{r.f()}}}],o&&n(r.prototype,o),c&&n(r,c),t}())).handle()})();
|
2
public/js/clients/invoices/payment.js
vendored
2
public/js/clients/invoices/payment.js
vendored
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see payment.js.LICENSE.txt */
|
/*! For license information please see payment.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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=5)}({5:function(e,t,n){e.exports=n("FuOr")},FuOr:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.shouldDisplayTerms=t,this.shouldDisplaySignature=n,this.termsAccepted=!1}var t,r,i;return t=e,(r=[{key:"handleMethodSelect",value:function(e){var t=this;document.getElementById("company_gateway_id").value=e.dataset.companyGatewayId,document.getElementById("payment_method_id").value=e.dataset.gatewayTypeId,this.shouldDisplaySignature&&!this.shouldDisplayTerms&&(this.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){t.termsAccepted=!0,t.submitForm()}))),!this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.submitForm()}))),this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){t.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.termsAccepted=!0,t.submitForm()}))}))),this.shouldDisplaySignature||this.shouldDisplayTerms||this.submitForm()}},{key:"submitForm",value:function(){document.getElementById("payment-form").submit()}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});this.signaturePad=e}},{key:"handle",value:function(){var e=this;document.querySelectorAll(".dropdown-gateway-button").forEach((function(t){t.addEventListener("click",(function(){return e.handleMethodSelect(t)}))}))}}])&&n(t.prototype,r),i&&n(t,i),e}(),i=document.querySelector('meta[name="require-invoice-signature"]').content,u=document.querySelector('meta[name="show-invoice-terms"]').content;new r(Boolean(+i),Boolean(+u)).handle()}});
|
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var t=function(){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.shouldDisplayTerms=e,this.shouldDisplaySignature=n,this.termsAccepted=!1}var n,a,i;return n=t,(a=[{key:"handleMethodSelect",value:function(e){var t=this;document.getElementById("company_gateway_id").value=e.dataset.companyGatewayId,document.getElementById("payment_method_id").value=e.dataset.gatewayTypeId,this.shouldDisplaySignature&&!this.shouldDisplayTerms&&(this.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){t.termsAccepted=!0,t.submitForm()}))),!this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.submitForm()}))),this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){t.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.termsAccepted=!0,t.submitForm()}))}))),this.shouldDisplaySignature||this.shouldDisplayTerms||this.submitForm()}},{key:"submitForm",value:function(){document.getElementById("payment-form").submit()}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});this.signaturePad=e}},{key:"handle",value:function(){var e=this;document.querySelectorAll(".dropdown-gateway-button").forEach((function(t){t.addEventListener("click",(function(){return e.handleMethodSelect(t)}))}))}}])&&e(n.prototype,a),i&&e(n,i),t}(),n=document.querySelector('meta[name="require-invoice-signature"]').content,a=document.querySelector('meta[name="show-invoice-terms"]').content;new t(Boolean(+n),Boolean(+a)).handle()})();
|
3
public/js/clients/linkify-urls.js
vendored
3
public/js/clients/linkify-urls.js
vendored
@ -1,2 +1 @@
|
|||||||
/*! For license information please see linkify-urls.js.LICENSE.txt */
|
(()=>{var e,t={8945:(e,t,r)=>{"use strict";const a=r(920),n=r(3523),s=r(2263),o=new Set(n);e.exports=e=>{if((e=Object.assign({name:"div",attributes:{},html:""},e)).html&&e.text)throw new Error("The `html` and `text` options are mutually exclusive");const t=e.text?s.escape(e.text):e.html;let r=`<${e.name}${a(e.attributes)}>`;return o.has(e.name)||(r+=`${t}</${e.name}>`),r}},3523:(e,t,r)=>{"use strict";e.exports=r(8346)},2263:(e,t)=>{"use strict";t.escape=e=>e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">"),t.unescape=e=>e.replace(/>/g,">").replace(/</g,"<").replace(/'/g,"'").replace(/"/g,'"').replace(/&/g,"&"),t.escapeTag=function(e){let r=e[0];for(let a=1;a<arguments.length;a++)r=r+t.escape(arguments[a])+e[a];return r},t.unescapeTag=function(e){let r=e[0];for(let a=1;a<arguments.length;a++)r=r+t.unescape(arguments[a])+e[a];return r}},1881:(e,t,r)=>{"use strict";const a=r(8945),n=(e,t)=>a({name:"a",attributes:{href:"",...t.attributes,href:e},text:void 0===t.value?e:void 0,html:void 0===t.value?void 0:"function"==typeof t.value?t.value(e):t.value});e.exports=(e,t)=>{if("string"===(t={attributes:{},type:"string",...t}).type)return((e,t)=>e.replace(/((?<!\+)(?:https?(?::\/\/))(?:www\.)?(?:[a-zA-Z\d-_.]+(?:(?:\.|@)[a-zA-Z\d]{2,})|localhost)(?:(?:[-a-zA-Z\d:%_+.~#*$!?&//=@]*)(?:[,](?![\s]))*)*)/g,(e=>n(e,t))))(e,t);if("dom"===t.type)return((e,t)=>{const r=document.createDocumentFragment();for(const[s,o]of Object.entries(e.split(/((?<!\+)(?:https?(?::\/\/))(?:www\.)?(?:[a-zA-Z\d-_.]+(?:(?:\.|@)[a-zA-Z\d]{2,})|localhost)(?:(?:[-a-zA-Z\d:%_+.~#*$!?&//=@]*)(?:[,](?![\s]))*)*)/g)))s%2?r.append((a=n(o,t),document.createRange().createContextualFragment(a))):o.length>0&&r.append(o);var a;return r})(e,t);throw new Error("The type option must be either `dom` or `string`")}},920:(e,t,r)=>{"use strict";const a=r(2263);e.exports=e=>{const t=[];for(const r of Object.keys(e)){let n=e[r];if(!1===n)continue;Array.isArray(n)&&(n=n.join(" "));let s=a.escape(r);!0!==n&&(s+=`="${a.escape(String(n))}"`),t.push(s)}return t.length>0?" "+t.join(" "):""}},8346:e=>{"use strict";e.exports=JSON.parse('["area","base","br","col","embed","hr","img","input","link","menuitem","meta","param","source","track","wbr"]')}},r={};function a(e){var n=r[e];if(void 0!==n)return n.exports;var s=r[e]={exports:{}};return t[e](s,s.exports,a),s.exports}e=a(1881),document.querySelectorAll("[data-ref=entity-terms]").forEach((function(t){t.innerHTML=e(t.innerText,{attributes:{target:"_blank",class:"text-primary"}})}))})();
|
||||||
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=16)}({16:function(e,t,r){e.exports=r("cN42")},Ievl:function(e,t,r){"use strict";t.escape=e=>e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">"),t.unescape=e=>e.replace(/>/g,">").replace(/</g,"<").replace(/'/g,"'").replace(/"/g,'"').replace(/&/g,"&"),t.escapeTag=function(e){let r=e[0];for(let n=1;n<arguments.length;n++)r=r+t.escape(arguments[n])+e[n];return r},t.unescapeTag=function(e){let r=e[0];for(let n=1;n<arguments.length;n++)r=r+t.unescape(arguments[n])+e[n];return r}},PoD1:function(e,t,r){"use strict";e.exports=r("sW1H")},YIIW:function(e,t,r){"use strict";const n=r("dBjz"),o=r("PoD1"),a=r("Ievl"),u=new Set(o);e.exports=e=>{if((e=Object.assign({name:"div",attributes:{},html:""},e)).html&&e.text)throw new Error("The `html` and `text` options are mutually exclusive");const t=e.text?a.escape(e.text):e.html;let r=`<${e.name}${n(e.attributes)}>`;return u.has(e.name)||(r+=`${t}</${e.name}>`),r}},cN42:function(e,t,r){var n=r("jG5F");document.querySelectorAll("[data-ref=entity-terms]").forEach((function(e){e.innerHTML=n(e.innerText,{attributes:{target:"_blank",class:"text-primary"}})}))},dBjz:function(e,t,r){"use strict";const n=r("Ievl");e.exports=e=>{const t=[];for(const r of Object.keys(e)){let o=e[r];if(!1===o)continue;Array.isArray(o)&&(o=o.join(" "));let a=n.escape(r);!0!==o&&(a+=`="${n.escape(String(o))}"`),t.push(a)}return t.length>0?" "+t.join(" "):""}},jG5F:function(e,t,r){"use strict";const n=r("YIIW"),o=(e,t)=>n({name:"a",attributes:{href:"",...t.attributes,href:e},text:void 0===t.value?e:void 0,html:void 0===t.value?void 0:"function"==typeof t.value?t.value(e):t.value});e.exports=(e,t)=>{if("string"===(t={attributes:{},type:"string",...t}).type)return((e,t)=>e.replace(/((?<!\+)(?:https?(?::\/\/))(?:www\.)?(?:[a-zA-Z\d-_.]+(?:(?:\.|@)[a-zA-Z\d]{2,})|localhost)(?:(?:[-a-zA-Z\d:%_+.~#*$!?&//=@]*)(?:[,](?![\s]))*)*)/g,e=>o(e,t)))(e,t);if("dom"===t.type)return((e,t)=>{const r=document.createDocumentFragment();for(const[a,u]of Object.entries(e.split(/((?<!\+)(?:https?(?::\/\/))(?:www\.)?(?:[a-zA-Z\d-_.]+(?:(?:\.|@)[a-zA-Z\d]{2,})|localhost)(?:(?:[-a-zA-Z\d:%_+.~#*$!?&//=@]*)(?:[,](?![\s]))*)*)/g)))a%2?r.append((n=o(u,t),document.createRange().createContextualFragment(n))):u.length>0&&r.append(u);var n;return r})(e,t);throw new Error("The type option must be either `dom` or `string`")}},sW1H:function(e){e.exports=JSON.parse('["area","base","br","col","embed","hr","img","input","link","menuitem","meta","param","source","track","wbr"]')}});
|
|
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see authorize-authorize-card.js.LICENSE.txt */
|
/*! For license information please see authorize-authorize-card.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},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=1)}({1:function(e,t,n){e.exports=n("6vDv")},"6vDv":function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}new(function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.publicKey=t,this.loginId=n,this.cardHolderName=document.getElementById("cardholder_name"),this.cardButton=document.getElementById("card_button")}var t,r,a;return t=e,(r=[{key:"handleAuthorization",value:function(){var e=$("#my-card"),t={};t.clientKey=this.publicKey,t.apiLoginID=this.loginId;var n={};n.cardNumber=e.CardJs("cardNumber").replace(/[^\d]/g,""),n.month=e.CardJs("expiryMonth").replace(/[^\d]/g,""),n.year=e.CardJs("expiryYear").replace(/[^\d]/g,""),n.cardCode=document.getElementById("cvv").value.replace(/[^\d]/g,"");var r={};return r.authData=t,r.cardData=n,document.getElementById("card_button").disabled=!0,document.querySelector("#card_button > svg").classList.remove("hidden"),document.querySelector("#card_button > span").classList.add("hidden"),Accept.dispatchData(r,this.responseHandler),!1}},{key:"responseHandler",value:function(e){return"Error"===e.messages.resultCode?($("#errors").show().html("<p>"+e.messages.message[0].code+": "+e.messages.message[0].text+"</p>"),document.getElementById("card_button").disabled=!1,document.querySelector("#card_button > svg").classList.add("hidden"),document.querySelector("#card_button > span").classList.remove("hidden")):"Ok"===e.messages.resultCode&&(document.getElementById("dataDescriptor").value=e.opaqueData.dataDescriptor,document.getElementById("dataValue").value=e.opaqueData.dataValue,document.getElementById("server_response").submit()),!1}},{key:"handle",value:function(){var e=this;return this.cardButton.addEventListener("click",(function(){e.cardButton.disabled=!e.cardButton.disabled,e.handleAuthorization()})),this}}])&&n(t.prototype,r),a&&n(t,a),e}())(document.querySelector('meta[name="authorize-public-key"]').content,document.querySelector('meta[name="authorize-login-id"]').content).handle()}});
|
(()=>{function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var t=function(){function t(e,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.publicKey=e,this.loginId=a,this.cardHolderName=document.getElementById("cardholder_name"),this.cardButton=document.getElementById("card_button")}var a,n,r;return a=t,(n=[{key:"handleAuthorization",value:function(){var e=$("#my-card"),t={};t.clientKey=this.publicKey,t.apiLoginID=this.loginId;var a={};a.cardNumber=e.CardJs("cardNumber").replace(/[^\d]/g,""),a.month=e.CardJs("expiryMonth").replace(/[^\d]/g,""),a.year=e.CardJs("expiryYear").replace(/[^\d]/g,""),a.cardCode=document.getElementById("cvv").value.replace(/[^\d]/g,"");var n={};return n.authData=t,n.cardData=a,document.getElementById("card_button").disabled=!0,document.querySelector("#card_button > svg").classList.remove("hidden"),document.querySelector("#card_button > span").classList.add("hidden"),Accept.dispatchData(n,this.responseHandler),!1}},{key:"responseHandler",value:function(e){return"Error"===e.messages.resultCode?($("#errors").show().html("<p>"+e.messages.message[0].code+": "+e.messages.message[0].text+"</p>"),document.getElementById("card_button").disabled=!1,document.querySelector("#card_button > svg").classList.add("hidden"),document.querySelector("#card_button > span").classList.remove("hidden")):"Ok"===e.messages.resultCode&&(document.getElementById("dataDescriptor").value=e.opaqueData.dataDescriptor,document.getElementById("dataValue").value=e.opaqueData.dataValue,document.getElementById("server_response").submit()),!1}},{key:"handle",value:function(){var e=this;return this.cardButton.addEventListener("click",(function(){e.cardButton.disabled=!e.cardButton.disabled,e.handleAuthorization()})),this}}])&&e(a.prototype,n),r&&e(a,r),t}();new t(document.querySelector('meta[name="authorize-public-key"]').content,document.querySelector('meta[name="authorize-login-id"]').content).handle()})();
|
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see authorize-checkout-card.js.LICENSE.txt */
|
/*! For license information please see authorize-checkout-card.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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=29)}({29:function(e,t,n){e.exports=n("kduS")},kduS:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.button=document.querySelector("#pay-button")}var t,r,o;return t=e,(r=[{key:"init",value:function(){this.frames=Frames.init(document.querySelector("meta[name=public-key]").content)}},{key:"handle",value:function(){var e=this;this.init(),Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED,(function(t){e.button.disabled=!Frames.isCardValid()})),Frames.addEventHandler(Frames.Events.CARD_TOKENIZED,(function(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e),document.getElementById("server_response").submit()})),document.querySelector("#authorization-form").addEventListener("submit",(function(t){e.button.disabled=!0,t.preventDefault(),Frames.submitCard()}))}}])&&n(t.prototype,r),o&&n(t,o),e}())).handle()}});
|
(()=>{function e(e,n){for(var t=0;t<n.length;t++){var a=n[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(new(function(){function n(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),this.button=document.querySelector("#pay-button")}var t,a,r;return t=n,(a=[{key:"init",value:function(){this.frames=Frames.init(document.querySelector("meta[name=public-key]").content)}},{key:"handle",value:function(){var e=this;this.init(),Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED,(function(n){e.button.disabled=!Frames.isCardValid()})),Frames.addEventHandler(Frames.Events.CARD_TOKENIZED,(function(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e),document.getElementById("server_response").submit()})),document.querySelector("#authorization-form").addEventListener("submit",(function(n){e.button.disabled=!0,n.preventDefault(),Frames.submitCard()}))}}])&&e(t.prototype,a),r&&e(t,r),n}())).handle()})();
|
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see braintree-ach.js.LICENSE.txt */
|
/*! For license information please see braintree-ach.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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=24)}({24:function(e,t,n){e.exports=n("cGea")},cGea:function(e,t){var n;window.braintree.client.create({authorization:null===(n=document.querySelector('meta[name="client-token"]'))||void 0===n?void 0:n.content}).then((function(e){return braintree.usBankAccount.create({client:e})})).then((function(e){var t;null===(t=document.getElementById("authorize-bank-account"))||void 0===t||t.addEventListener("click",(function(t){t.target.parentElement.disabled=!0,document.getElementById("errors").hidden=!0,document.getElementById("errors").textContent="";var n={accountNumber:document.getElementById("account-number").value,routingNumber:document.getElementById("routing-number").value,accountType:document.querySelector('input[name="account-type"]:checked').value,ownershipType:document.querySelector('input[name="ownership-type"]:checked').value,billingAddress:{streetAddress:document.getElementById("billing-street-address").value,extendedAddress:document.getElementById("billing-extended-address").value,locality:document.getElementById("billing-locality").value,region:document.getElementById("billing-region").value,postalCode:document.getElementById("billing-postal-code").value}};if("personal"===n.ownershipType){var r=document.getElementById("account-holder-name").value.split(" ",2);n.firstName=r[0],n.lastName=r[1]}else n.businessName=document.getElementById("account-holder-name").value;e.tokenize({bankDetails:n,mandateText:'By clicking ["Checkout"], I authorize Braintree, a service of PayPal, on behalf of [your business name here] (i) to verify my bank account information using bank information and consumer reports and (ii) to debit my bank account.'}).then((function(e){document.querySelector("input[name=nonce]").value=e.nonce,document.getElementById("server_response").submit()})).catch((function(e){t.target.parentElement.disabled=!1,document.getElementById("errors").textContent="".concat(e.details.originalError.message," ").concat(e.details.originalError.details.originalError[0].message),document.getElementById("errors").hidden=!1}))}))})).catch((function(e){document.getElementById("errors").textContent="".concat(error.details.originalError.message," ").concat(error.details.originalError.details.originalError[0].message),document.getElementById("errors").hidden=!1}))}});
|
(()=>{var e;window.braintree.client.create({authorization:null===(e=document.querySelector('meta[name="client-token"]'))||void 0===e?void 0:e.content}).then((function(e){return braintree.usBankAccount.create({client:e})})).then((function(e){var t;null===(t=document.getElementById("authorize-bank-account"))||void 0===t||t.addEventListener("click",(function(t){t.target.parentElement.disabled=!0,document.getElementById("errors").hidden=!0,document.getElementById("errors").textContent="";var n={accountNumber:document.getElementById("account-number").value,routingNumber:document.getElementById("routing-number").value,accountType:document.querySelector('input[name="account-type"]:checked').value,ownershipType:document.querySelector('input[name="ownership-type"]:checked').value,billingAddress:{streetAddress:document.getElementById("billing-street-address").value,extendedAddress:document.getElementById("billing-extended-address").value,locality:document.getElementById("billing-locality").value,region:document.getElementById("billing-region").value,postalCode:document.getElementById("billing-postal-code").value}};if("personal"===n.ownershipType){var r=document.getElementById("account-holder-name").value.split(" ",2);n.firstName=r[0],n.lastName=r[1]}else n.businessName=document.getElementById("account-holder-name").value;e.tokenize({bankDetails:n,mandateText:'By clicking ["Checkout"], I authorize Braintree, a service of PayPal, on behalf of [your business name here] (i) to verify my bank account information using bank information and consumer reports and (ii) to debit my bank account.'}).then((function(e){document.querySelector("input[name=nonce]").value=e.nonce,document.getElementById("server_response").submit()})).catch((function(e){t.target.parentElement.disabled=!1,document.getElementById("errors").textContent="".concat(e.details.originalError.message," ").concat(e.details.originalError.details.originalError[0].message),document.getElementById("errors").hidden=!1}))}))})).catch((function(e){document.getElementById("errors").textContent="".concat(error.details.originalError.message," ").concat(error.details.originalError.details.originalError[0].message),document.getElementById("errors").hidden=!1}))})();
|
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see wepay-bank-account.js.LICENSE.txt */
|
/*! For license information please see wepay-bank-account.js.LICENSE.txt */
|
||||||
!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="/",t(t.s=20)}({20:function(e,n,t){e.exports=t("bIGw")},bIGw:function(e,n){function t(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var r=function(){function e(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e)}var n,r,o;return n=e,(r=[{key:"initializeWePay",value:function(){var e,n=null===(e=document.querySelector('meta[name="wepay-environment"]'))||void 0===e?void 0:e.content;return WePay.set_endpoint("staging"===n?"stage":"production"),this}},{key:"showBankPopup",value:function(){var e,n;WePay.bank_account.create({client_id:null===(e=document.querySelector("meta[name=wepay-client-id]"))||void 0===e?void 0:e.content,email:null===(n=document.querySelector("meta[name=contact-email]"))||void 0===n?void 0:n.content},(function(e){e.error?(errors.textContent="",errors.textContent=e.error_description,errors.hidden=!1):(document.querySelector('input[name="bank_account_id"]').value=e.bank_account_id,document.getElementById("server_response").submit())}),(function(e){e.error&&(errors.textContent="",errors.textContent=e.error_description,errors.hidden=!1)}))}},{key:"handle",value:function(){this.initializeWePay().showBankPopup()}}])&&t(n.prototype,r),o&&t(n,o),e}();document.addEventListener("DOMContentLoaded",(function(){(new r).handle()}))}});
|
(()=>{function e(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var n=function(){function n(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n)}var t,o,r;return t=n,(o=[{key:"initializeWePay",value:function(){var e,n=null===(e=document.querySelector('meta[name="wepay-environment"]'))||void 0===e?void 0:e.content;return WePay.set_endpoint("staging"===n?"stage":"production"),this}},{key:"showBankPopup",value:function(){var e,n;WePay.bank_account.create({client_id:null===(e=document.querySelector("meta[name=wepay-client-id]"))||void 0===e?void 0:e.content,email:null===(n=document.querySelector("meta[name=contact-email]"))||void 0===n?void 0:n.content},(function(e){e.error?(errors.textContent="",errors.textContent=e.error_description,errors.hidden=!1):(document.querySelector('input[name="bank_account_id"]').value=e.bank_account_id,document.getElementById("server_response").submit())}),(function(e){e.error&&(errors.textContent="",errors.textContent=e.error_description,errors.hidden=!1)}))}},{key:"handle",value:function(){this.initializeWePay().showBankPopup()}}])&&e(t.prototype,o),r&&e(t,r),n}();document.addEventListener("DOMContentLoaded",(function(){(new n).handle()}))})();
|
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see authorize-credit-card-payment.js.LICENSE.txt */
|
/*! For license information please see authorize-credit-card-payment.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},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=2)}({2:function(e,t,n){e.exports=n("hK5p")},hK5p:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}new(function(){function e(t,n){var a=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r(this,"handleAuthorization",(function(){var e=$("#my-card"),t={};t.clientKey=a.publicKey,t.apiLoginID=a.loginId;var n={};n.cardNumber=e.CardJs("cardNumber").replace(/[^\d]/g,""),n.month=e.CardJs("expiryMonth").replace(/[^\d]/g,""),n.year=e.CardJs("expiryYear").replace(/[^\d]/g,""),n.cardCode=document.getElementById("cvv").value.replace(/[^\d]/g,"");var r={};return r.authData=t,r.cardData=n,document.getElementById("pay-now")&&(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden")),Accept.dispatchData(r,a.responseHandler),!1})),r(this,"responseHandler",(function(e){if("Error"===e.messages.resultCode){$("#errors").show().html("<p>"+e.messages.message[0].code+": "+e.messages.message[0].text+"</p>"),document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")}else if("Ok"===e.messages.resultCode){document.getElementById("dataDescriptor").value=e.opaqueData.dataDescriptor,document.getElementById("dataValue").value=e.opaqueData.dataValue;var t=document.querySelector("input[name=token-billing-checkbox]:checked");t&&(document.getElementById("store_card").value=t.value),document.getElementById("server_response").submit()}return!1})),r(this,"handle",(function(){Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("save-card--container").style.display="none",document.getElementById("authorize--credit-card-container").style.display="none",document.getElementById("token").value=e.target.dataset.token}))}));var e=document.getElementById("toggle-payment-with-credit-card");e&&e.addEventListener("click",(function(){document.getElementById("save-card--container").style.display="grid",document.getElementById("authorize--credit-card-container").style.display="flex",document.getElementById("token").value=null}));var t=document.getElementById("pay-now");return t&&t.addEventListener("click",(function(e){var t=document.getElementById("token");t.value?a.handlePayNowAction(t.value):a.handleAuthorization()})),a})),this.publicKey=t,this.loginId=n,this.cardHolderName=document.getElementById("cardholder_name")}var t,a,o;return t=e,(a=[{key:"handlePayNowAction",value:function(e){document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),document.getElementById("token").value=e,document.getElementById("server_response").submit()}}])&&n(t.prototype,a),o&&n(t,o),e}())(document.querySelector('meta[name="authorize-public-key"]').content,document.querySelector('meta[name="authorize-login-id"]').content).handle()}});
|
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var n=function(){function n(e,a){var d=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t(this,"handleAuthorization",(function(){var e=$("#my-card"),t={};t.clientKey=d.publicKey,t.apiLoginID=d.loginId;var n={};n.cardNumber=e.CardJs("cardNumber").replace(/[^\d]/g,""),n.month=e.CardJs("expiryMonth").replace(/[^\d]/g,""),n.year=e.CardJs("expiryYear").replace(/[^\d]/g,""),n.cardCode=document.getElementById("cvv").value.replace(/[^\d]/g,"");var a={};return a.authData=t,a.cardData=n,document.getElementById("pay-now")&&(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden")),Accept.dispatchData(a,d.responseHandler),!1})),t(this,"responseHandler",(function(e){if("Error"===e.messages.resultCode){$("#errors").show().html("<p>"+e.messages.message[0].code+": "+e.messages.message[0].text+"</p>"),document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")}else if("Ok"===e.messages.resultCode){document.getElementById("dataDescriptor").value=e.opaqueData.dataDescriptor,document.getElementById("dataValue").value=e.opaqueData.dataValue;var t=document.querySelector("input[name=token-billing-checkbox]:checked");t&&(document.getElementById("store_card").value=t.value),document.getElementById("server_response").submit()}return!1})),t(this,"handle",(function(){Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("save-card--container").style.display="none",document.getElementById("authorize--credit-card-container").style.display="none",document.getElementById("token").value=e.target.dataset.token}))}));var e=document.getElementById("toggle-payment-with-credit-card");e&&e.addEventListener("click",(function(){document.getElementById("save-card--container").style.display="grid",document.getElementById("authorize--credit-card-container").style.display="flex",document.getElementById("token").value=null}));var t=document.getElementById("pay-now");return t&&t.addEventListener("click",(function(e){var t=document.getElementById("token");t.value?d.handlePayNowAction(t.value):d.handleAuthorization()})),d})),this.publicKey=e,this.loginId=a,this.cardHolderName=document.getElementById("cardholder_name")}var a,d,o;return a=n,(d=[{key:"handlePayNowAction",value:function(e){document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),document.getElementById("token").value=e,document.getElementById("server_response").submit()}}])&&e(a.prototype,d),o&&e(a,o),n}();new n(document.querySelector('meta[name="authorize-public-key"]').content,document.querySelector('meta[name="authorize-login-id"]').content).handle()})();
|
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see braintree-credit-card.js.LICENSE.txt */
|
/*! For license information please see braintree-credit-card.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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=17)}({17:function(e,t,n){e.exports=n("jPAV")},jPAV:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,o;return t=e,(r=[{key:"initBraintreeDataCollector",value:function(){window.braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content},(function(e,t){window.braintree.dataCollector.create({client:t,paypal:!0},(function(e,t){e||(document.querySelector("input[name=client-data]").value=t.deviceData)}))}))}},{key:"mountBraintreePaymentWidget",value:function(){window.braintree.dropin.create({authorization:document.querySelector("meta[name=client-token]").content,container:"#dropin-container"},this.handleCallback)}},{key:"handleCallback",value:function(e,t){if(e)console.error(e);else{var n=document.getElementById("pay-now");n.addEventListener("click",(function(){t.requestPaymentMethod((function(e,t){if(e)return console.error(e);n.disabled=!0,n.querySelector("svg").classList.remove("hidden"),n.querySelector("span").classList.add("hidden"),document.querySelector("input[name=gateway_response]").value=JSON.stringify(t);var r=document.querySelector('input[name="token-billing-checkbox"]:checked');r&&(document.querySelector('input[name="store_card"]').value=r.value),document.getElementById("server-response").submit()}))}))}}},{key:"handle",value:function(){this.initBraintreeDataCollector(),this.mountBraintreePaymentWidget(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("dropin-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token,document.getElementById("pay-now-with-token").classList.remove("hidden"),document.getElementById("pay-now").classList.add("hidden")}))})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",(function(e){document.getElementById("dropin-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",document.getElementById("pay-now-with-token").classList.add("hidden"),document.getElementById("pay-now").classList.remove("hidden")}));var e=document.getElementById("pay-now-with-token");e.addEventListener("click",(function(t){e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}))}}])&&n(t.prototype,r),o&&n(t,o),e}())).handle()}});
|
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(new(function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t)}var n,a,o;return n=t,(a=[{key:"initBraintreeDataCollector",value:function(){window.braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content},(function(e,t){window.braintree.dataCollector.create({client:t,paypal:!0},(function(e,t){e||(document.querySelector("input[name=client-data]").value=t.deviceData)}))}))}},{key:"mountBraintreePaymentWidget",value:function(){window.braintree.dropin.create({authorization:document.querySelector("meta[name=client-token]").content,container:"#dropin-container"},this.handleCallback)}},{key:"handleCallback",value:function(e,t){if(e)console.error(e);else{var n=document.getElementById("pay-now");n.addEventListener("click",(function(){t.requestPaymentMethod((function(e,t){if(e)return console.error(e);n.disabled=!0,n.querySelector("svg").classList.remove("hidden"),n.querySelector("span").classList.add("hidden"),document.querySelector("input[name=gateway_response]").value=JSON.stringify(t);var a=document.querySelector('input[name="token-billing-checkbox"]:checked');a&&(document.querySelector('input[name="store_card"]').value=a.value),document.getElementById("server-response").submit()}))}))}}},{key:"handle",value:function(){this.initBraintreeDataCollector(),this.mountBraintreePaymentWidget(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("dropin-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token,document.getElementById("pay-now-with-token").classList.remove("hidden"),document.getElementById("pay-now").classList.add("hidden")}))})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",(function(e){document.getElementById("dropin-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",document.getElementById("pay-now-with-token").classList.add("hidden"),document.getElementById("pay-now").classList.remove("hidden")}));var e=document.getElementById("pay-now-with-token");e.addEventListener("click",(function(t){e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}))}}])&&e(n.prototype,a),o&&e(n,o),t}())).handle()})();
|
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see braintree-paypal.js.LICENSE.txt */
|
/*! For license information please see braintree-paypal.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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=18)}({18:function(e,t,n){e.exports=n("cZZG")},cZZG:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,o;return t=e,o=[{key:"getPaymentDetails",value:function(){return{flow:"vault"}}},{key:"handleErrorMessage",value:function(e){var t=document.getElementById("errors");t.innerText=e,t.hidden=!1}}],(r=[{key:"initBraintreeDataCollector",value:function(){window.braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content},(function(e,t){window.braintree.dataCollector.create({client:t,paypal:!0},(function(e,t){e||(document.querySelector("input[name=client-data]").value=t.deviceData)}))}))}},{key:"handlePaymentWithToken",value:function(){Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("paypal-button").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token,document.getElementById("pay-now-with-token").classList.remove("hidden"),document.getElementById("pay-now").classList.add("hidden")}))}));var e=document.getElementById("pay-now-with-token");e.addEventListener("click",(function(t){e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}))}},{key:"handle",value:function(){this.initBraintreeDataCollector(),this.handlePaymentWithToken(),braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content}).then((function(e){return braintree.paypalCheckout.create({client:e})})).then((function(t){return t.loadPayPalSDK({vault:!0}).then((function(t){return paypal.Buttons({fundingSource:paypal.FUNDING.PAYPAL,createBillingAgreement:function(){return t.createPayment(e.getPaymentDetails())},onApprove:function(e,n){return t.tokenizePayment(e).then((function(e){var t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.querySelector("input[name=gateway_response]").value=JSON.stringify(e),document.getElementById("server-response").submit()}))},onCancel:function(e){},onError:function(t){console.log(t.message),e.handleErrorMessage(t.message)}}).render("#paypal-button")}))})).catch((function(t){console.log(t.message),e.handleErrorMessage(t.message)}))}}])&&n(t.prototype,r),o&&n(t,o),e}())).handle()}});
|
(()=>{function e(e,n){for(var t=0;t<n.length;t++){var a=n[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(new(function(){function n(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n)}var t,a,o;return t=n,o=[{key:"getPaymentDetails",value:function(){return{flow:"vault"}}},{key:"handleErrorMessage",value:function(e){var n=document.getElementById("errors");n.innerText=e,n.hidden=!1}}],(a=[{key:"initBraintreeDataCollector",value:function(){window.braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content},(function(e,n){window.braintree.dataCollector.create({client:n,paypal:!0},(function(e,n){e||(document.querySelector("input[name=client-data]").value=n.deviceData)}))}))}},{key:"handlePaymentWithToken",value:function(){Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("paypal-button").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token,document.getElementById("pay-now-with-token").classList.remove("hidden"),document.getElementById("pay-now").classList.add("hidden")}))}));var e=document.getElementById("pay-now-with-token");e.addEventListener("click",(function(n){e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}))}},{key:"handle",value:function(){this.initBraintreeDataCollector(),this.handlePaymentWithToken(),braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content}).then((function(e){return braintree.paypalCheckout.create({client:e})})).then((function(e){return e.loadPayPalSDK({vault:!0}).then((function(e){return paypal.Buttons({fundingSource:paypal.FUNDING.PAYPAL,createBillingAgreement:function(){return e.createPayment(n.getPaymentDetails())},onApprove:function(n,t){return e.tokenizePayment(n).then((function(e){var n=document.querySelector('input[name="token-billing-checkbox"]:checked');n&&(document.querySelector('input[name="store_card"]').value=n.value),document.querySelector("input[name=gateway_response]").value=JSON.stringify(e),document.getElementById("server-response").submit()}))},onCancel:function(e){},onError:function(e){console.log(e.message),n.handleErrorMessage(e.message)}}).render("#paypal-button")}))})).catch((function(e){console.log(e.message),n.handleErrorMessage(e.message)}))}}])&&e(t.prototype,a),o&&e(t,o),n}())).handle()})();
|
2
public/js/clients/payments/card-js.min.js
vendored
2
public/js/clients/payments/card-js.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see checkout-credit-card.js.LICENSE.txt */
|
/*! For license information please see checkout-credit-card.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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("fQHp")},fQHp:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.tokens=[]}var t,r,o;return t=e,(r=[{key:"mountFrames",value:function(){console.log("Mount checkout frames..")}},{key:"handlePaymentUsingToken",value:function(e){document.getElementById("checkout--container").classList.add("hidden"),document.getElementById("pay-now-with-token--container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token}},{key:"handlePaymentUsingCreditCard",value:function(e){var t;document.getElementById("checkout--container").classList.remove("hidden"),document.getElementById("pay-now-with-token--container").classList.add("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="";var n=document.getElementById("pay-button"),r=null!==(t=document.querySelector('meta[name="public-key"]').content)&&void 0!==t?t:"",o=document.getElementById("payment-form");Frames.init(r),Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED,(function(e){n.disabled=!Frames.isCardValid()})),Frames.addEventHandler(Frames.Events.CARD_TOKENIZATION_FAILED,(function(e){pay.button.disabled=!1})),Frames.addEventHandler(Frames.Events.CARD_TOKENIZED,(function(e){n.disabled=!0,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()})),o.addEventListener("submit",(function(e){e.preventDefault(),Frames.submitCard()}))}},{key:"completePaymentUsingToken",value:function(e){var t=document.getElementById("pay-now-with-token");t.disabled=!0,t.querySelector("svg").classList.remove("hidden"),t.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}},{key:"handle",value:function(){var e=this;this.handlePaymentUsingCreditCard(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(t){return t.addEventListener("click",e.handlePaymentUsingToken)})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",this.handlePaymentUsingCreditCard),document.getElementById("pay-now-with-token").addEventListener("click",this.completePaymentUsingToken)}}])&&n(t.prototype,r),o&&n(t,o),e}())).handle()}});
|
(()=>{function e(e,n){for(var t=0;t<n.length;t++){var a=n[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(new(function(){function n(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),this.tokens=[]}var t,a,d;return t=n,(a=[{key:"mountFrames",value:function(){console.log("Mount checkout frames..")}},{key:"handlePaymentUsingToken",value:function(e){document.getElementById("checkout--container").classList.add("hidden"),document.getElementById("pay-now-with-token--container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token}},{key:"handlePaymentUsingCreditCard",value:function(e){var n;document.getElementById("checkout--container").classList.remove("hidden"),document.getElementById("pay-now-with-token--container").classList.add("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="";var t=document.getElementById("pay-button"),a=null!==(n=document.querySelector('meta[name="public-key"]').content)&&void 0!==n?n:"",d=document.getElementById("payment-form");Frames.init(a),Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED,(function(e){t.disabled=!Frames.isCardValid()})),Frames.addEventHandler(Frames.Events.CARD_TOKENIZATION_FAILED,(function(e){pay.button.disabled=!1})),Frames.addEventHandler(Frames.Events.CARD_TOKENIZED,(function(e){t.disabled=!0,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()})),d.addEventListener("submit",(function(e){e.preventDefault(),Frames.submitCard()}))}},{key:"completePaymentUsingToken",value:function(e){var n=document.getElementById("pay-now-with-token");n.disabled=!0,n.querySelector("svg").classList.remove("hidden"),n.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}},{key:"handle",value:function(){var e=this;this.handlePaymentUsingCreditCard(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(n){return n.addEventListener("click",e.handlePaymentUsingToken)})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",this.handlePaymentUsingCreditCard),document.getElementById("pay-now-with-token").addEventListener("click",this.completePaymentUsingToken)}}])&&e(t.prototype,a),d&&e(t,d),n}())).handle()})();
|
File diff suppressed because one or more lines are too long
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see mollie-credit-card.js.LICENSE.txt */
|
/*! For license information please see mollie-credit-card.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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=22)}({22:function(e,t,n){e.exports=n("i12I")},i12I:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function e(){var t,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mollie=Mollie(null===(t=document.querySelector("meta[name=mollie-profileId]"))||void 0===t?void 0:t.content,{testmode:null===(n=document.querySelector("meta[name=mollie-testmode]"))||void 0===n?void 0:n.content,locale:"en_US"})}var t,r,o;return t=e,(r=[{key:"createCardHolderInput",value:function(){var e=this.mollie.createComponent("cardHolder");e.mount("#card-holder");var t=document.getElementById("card-holder-error");return e.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"createCardNumberInput",value:function(){var e=this.mollie.createComponent("cardNumber");e.mount("#card-number");var t=document.getElementById("card-number-error");return e.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"createExpiryDateInput",value:function(){var e=this.mollie.createComponent("expiryDate");e.mount("#expiry-date");var t=document.getElementById("expiry-date-error");return e.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"createCvvInput",value:function(){var e=this.mollie.createComponent("verificationCode");e.mount("#cvv");var t=document.getElementById("cvv-error");return e.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"handlePayNowButton",value:function(){if(document.getElementById("pay-now").disabled=!0,""!==document.querySelector("input[name=token]").value)return document.querySelector("input[name=gateway_response]").value="",document.getElementById("server-response").submit();this.mollie.createToken().then((function(e){var t=e.token,n=e.error;if(n){document.getElementById("pay-now").disabled=!1;var r=document.getElementById("errors");return r.innerText=n.message,void(r.hidden=!1)}var o=document.querySelector('input[name="token-billing-checkbox"]:checked');o&&(document.querySelector('input[name="store_card"]').value=o.value),document.querySelector("input[name=gateway_response]").value=t,document.querySelector("input[name=token]").value="",document.getElementById("server-response").submit()}))}},{key:"handle",value:function(){var e=this;this.createCardHolderInput().createCardNumberInput().createExpiryDateInput().createCvvInput(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("mollie--payment-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token}))})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",(function(e){document.getElementById("mollie--payment-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""})),document.getElementById("pay-now").addEventListener("click",(function(){return e.handlePayNowButton()}))}}])&&n(t.prototype,r),o&&n(t,o),e}())).handle()}});
|
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.mollie=Mollie(null===(e=document.querySelector("meta[name=mollie-profileId]"))||void 0===e?void 0:e.content,{testmode:null===(n=document.querySelector("meta[name=mollie-testmode]"))||void 0===n?void 0:n.content,locale:"en_US"})}var n,r,o;return n=t,(r=[{key:"createCardHolderInput",value:function(){var e=this.mollie.createComponent("cardHolder");e.mount("#card-holder");var t=document.getElementById("card-holder-error");return e.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"createCardNumberInput",value:function(){var e=this.mollie.createComponent("cardNumber");e.mount("#card-number");var t=document.getElementById("card-number-error");return e.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"createExpiryDateInput",value:function(){var e=this.mollie.createComponent("expiryDate");e.mount("#expiry-date");var t=document.getElementById("expiry-date-error");return e.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"createCvvInput",value:function(){var e=this.mollie.createComponent("verificationCode");e.mount("#cvv");var t=document.getElementById("cvv-error");return e.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"handlePayNowButton",value:function(){if(document.getElementById("pay-now").disabled=!0,""!==document.querySelector("input[name=token]").value)return document.querySelector("input[name=gateway_response]").value="",document.getElementById("server-response").submit();this.mollie.createToken().then((function(e){var t=e.token,n=e.error;if(n){document.getElementById("pay-now").disabled=!1;var r=document.getElementById("errors");return r.innerText=n.message,void(r.hidden=!1)}var o=document.querySelector('input[name="token-billing-checkbox"]:checked');o&&(document.querySelector('input[name="store_card"]').value=o.value),document.querySelector("input[name=gateway_response]").value=t,document.querySelector("input[name=token]").value="",document.getElementById("server-response").submit()}))}},{key:"handle",value:function(){var e=this;this.createCardHolderInput().createCardNumberInput().createExpiryDateInput().createCvvInput(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("mollie--payment-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token}))})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",(function(e){document.getElementById("mollie--payment-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""})),document.getElementById("pay-now").addEventListener("click",(function(){return e.handlePayNowButton()}))}}])&&e(n.prototype,r),o&&e(n,o),t}())).handle()})();
|
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see paytrace-credit-card.js.LICENSE.txt */
|
/*! For license information please see paytrace-credit-card.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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=21)}({"0Swb":function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function e(){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.clientKey=null===(t=document.querySelector("meta[name=paytrace-client-key]"))||void 0===t?void 0:t.content}var t,r,o;return t=e,(r=[{key:"creditCardStyles",get:function(){return{font_color:"#111827",border_color:"rgba(210,214,220,1)",label_color:"#111827",label_size:"12pt",background_color:"white",border_style:"solid",font_size:"15pt",height:"30px",width:"100%"}}},{key:"codeStyles",get:function(){return{font_color:"#111827",border_color:"rgba(210,214,220,1)",label_color:"#111827",label_size:"12pt",background_color:"white",border_style:"solid",font_size:"15pt",height:"30px",width:"300px"}}},{key:"expStyles",get:function(){return{font_color:"#111827",border_color:"rgba(210,214,220,1)",label_color:"#111827",label_size:"12pt",background_color:"white",border_style:"solid",font_size:"15pt",height:"30px",width:"85px",type:"dropdown"}}},{key:"updatePayTraceLabels",value:function(){window.PTPayment.getControl("securityCode").label.text(document.querySelector("meta[name=ctrans-cvv]").content),window.PTPayment.getControl("creditCard").label.text(document.querySelector("meta[name=ctrans-card_number]").content),window.PTPayment.getControl("expiration").label.text(document.querySelector("meta[name=ctrans-expires]").content)}},{key:"setupPayTrace",value:function(){return window.PTPayment.setup({styles:{code:this.codeStyles,cc:this.creditCardStyles,exp:this.expStyles},authorization:{clientKey:this.clientKey}})}},{key:"handlePaymentWithCreditCard",value:function(e){var t=this;e.target.parentElement.disabled=!0,document.getElementById("errors").hidden=!0,window.PTPayment.validate((function(n){if(n.length>=1){var r=document.getElementById("errors");return r.textContent=n[0].description,r.hidden=!1,e.target.parentElement.disabled=!1}t.ptInstance.process().then((function(e){document.getElementById("HPF_Token").value=e.message.hpf_token,document.getElementById("enc_key").value=e.message.enc_key;var t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.getElementById("server_response").submit()})).catch((function(e){document.getElementById("errors").textContent=JSON.stringify(e),document.getElementById("errors").hidden=!1,console.log(e)}))}))}},{key:"handlePaymentWithToken",value:function(e){e.target.parentElement.disabled=!0,document.getElementById("server_response").submit()}},{key:"handle",value:function(){var e,t=this;Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("paytrace--credit-card-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token}))})),null===(e=document.getElementById("toggle-payment-with-credit-card"))||void 0===e||e.addEventListener("click",(function(e){document.getElementById("paytrace--credit-card-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",t.setupPayTrace().then((function(e){t.ptInstance=e,t.updatePayTraceLabels()}))})),document.getElementById("pay-now").addEventListener("click",(function(e){return""===document.querySelector("input[name=token]").value?t.handlePaymentWithCreditCard(e):t.handlePaymentWithToken(e)}))}}])&&n(t.prototype,r),o&&n(t,o),e}())).handle()},21:function(e,t,n){e.exports=n("0Swb")}});
|
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(new(function(){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.clientKey=null===(e=document.querySelector("meta[name=paytrace-client-key]"))||void 0===e?void 0:e.content}var n,o,r;return n=t,(o=[{key:"creditCardStyles",get:function(){return{font_color:"#111827",border_color:"rgba(210,214,220,1)",label_color:"#111827",label_size:"12pt",background_color:"white",border_style:"solid",font_size:"15pt",height:"30px",width:"100%"}}},{key:"codeStyles",get:function(){return{font_color:"#111827",border_color:"rgba(210,214,220,1)",label_color:"#111827",label_size:"12pt",background_color:"white",border_style:"solid",font_size:"15pt",height:"30px",width:"300px"}}},{key:"expStyles",get:function(){return{font_color:"#111827",border_color:"rgba(210,214,220,1)",label_color:"#111827",label_size:"12pt",background_color:"white",border_style:"solid",font_size:"15pt",height:"30px",width:"85px",type:"dropdown"}}},{key:"updatePayTraceLabels",value:function(){window.PTPayment.getControl("securityCode").label.text(document.querySelector("meta[name=ctrans-cvv]").content),window.PTPayment.getControl("creditCard").label.text(document.querySelector("meta[name=ctrans-card_number]").content),window.PTPayment.getControl("expiration").label.text(document.querySelector("meta[name=ctrans-expires]").content)}},{key:"setupPayTrace",value:function(){return window.PTPayment.setup({styles:{code:this.codeStyles,cc:this.creditCardStyles,exp:this.expStyles},authorization:{clientKey:this.clientKey}})}},{key:"handlePaymentWithCreditCard",value:function(e){var t=this;e.target.parentElement.disabled=!0,document.getElementById("errors").hidden=!0,window.PTPayment.validate((function(n){if(n.length>=1){var o=document.getElementById("errors");return o.textContent=n[0].description,o.hidden=!1,e.target.parentElement.disabled=!1}t.ptInstance.process().then((function(e){document.getElementById("HPF_Token").value=e.message.hpf_token,document.getElementById("enc_key").value=e.message.enc_key;var t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.getElementById("server_response").submit()})).catch((function(e){document.getElementById("errors").textContent=JSON.stringify(e),document.getElementById("errors").hidden=!1,console.log(e)}))}))}},{key:"handlePaymentWithToken",value:function(e){e.target.parentElement.disabled=!0,document.getElementById("server_response").submit()}},{key:"handle",value:function(){var e,t=this;Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("paytrace--credit-card-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token}))})),null===(e=document.getElementById("toggle-payment-with-credit-card"))||void 0===e||e.addEventListener("click",(function(e){document.getElementById("paytrace--credit-card-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",t.setupPayTrace().then((function(e){t.ptInstance=e,t.updatePayTraceLabels()}))})),document.getElementById("pay-now").addEventListener("click",(function(e){return""===document.querySelector("input[name=token]").value?t.handlePaymentWithCreditCard(e):t.handlePaymentWithToken(e)}))}}])&&e(n.prototype,o),r&&e(n,r),t}())).handle()})();
|
2
public/js/clients/payments/razorpay-aio.js
vendored
2
public/js/clients/payments/razorpay-aio.js
vendored
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see razorpay-aio.js.LICENSE.txt */
|
/*! For license information please see razorpay-aio.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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=27)}({27:function(e,t,n){e.exports=n("tIvh")},tIvh:function(e,t){var n,r=JSON.parse(null===(n=document.querySelector("meta[name=razorpay-options]"))||void 0===n?void 0:n.content);r.handler=function(e){document.getElementById("razorpay_payment_id").value=e.razorpay_payment_id,document.getElementById("razorpay_signature").value=e.razorpay_signature,document.getElementById("server-response").submit()};var o=new Razorpay(r);document.getElementById("pay-now").onclick=function(e){e.target.parentElement.disabled=!0,o.open()}}});
|
(()=>{var e,n=JSON.parse(null===(e=document.querySelector("meta[name=razorpay-options]"))||void 0===e?void 0:e.content);n.handler=function(e){document.getElementById("razorpay_payment_id").value=e.razorpay_payment_id,document.getElementById("razorpay_signature").value=e.razorpay_signature,document.getElementById("server-response").submit()};var t=new Razorpay(n);document.getElementById("pay-now").onclick=function(e){e.target.parentElement.disabled=!0,t.open()}})();
|
File diff suppressed because one or more lines are too long
2
public/js/clients/payments/stripe-ach.js
vendored
2
public/js/clients/payments/stripe-ach.js
vendored
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see stripe-ach.js.LICENSE.txt */
|
/*! For license information please see stripe-ach.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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=3)}({3:function(e,t,n){e.exports=n("M5il")},M5il:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}(new(function(){function e(){var t,n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r(this,"setupStripe",(function(){return n.stripe=Stripe(n.key),n.stripe_connect&&(n.stripe.stripeAccount=n.stripe_connect),n})),r(this,"getFormData",(function(){return{country:document.getElementById("country").value,currency:document.getElementById("currency").value,routing_number:document.getElementById("routing-number").value,account_number:document.getElementById("account-number").value,account_holder_name:document.getElementById("account-holder-name").value,account_holder_type:document.querySelector('input[name="account-holder-type"]:checked').value}})),r(this,"handleError",(function(e){document.getElementById("save-button").disabled=!1,document.querySelector("#save-button > svg").classList.add("hidden"),document.querySelector("#save-button > span").classList.remove("hidden"),n.errors.textContent="",n.errors.textContent=e,n.errors.hidden=!1})),r(this,"handleSuccess",(function(e){document.getElementById("gateway_response").value=JSON.stringify(e),document.getElementById("server_response").submit()})),r(this,"handleSubmit",(function(e){document.getElementById("save-button").disabled=!0,document.querySelector("#save-button > svg").classList.remove("hidden"),document.querySelector("#save-button > span").classList.add("hidden"),e.preventDefault(),n.errors.textContent="",n.errors.hidden=!0,n.stripe.createToken("bank_account",n.getFormData()).then((function(e){return e.hasOwnProperty("error")?n.handleError(e.error.message):n.handleSuccess(e)}))})),this.errors=document.getElementById("errors"),this.key=document.querySelector('meta[name="stripe-publishable-key"]').content,this.stripe_connect=null===(t=document.querySelector('meta[name="stripe-account-id"]'))||void 0===t?void 0:t.content}var t,o,u;return t=e,(o=[{key:"handle",value:function(){var e=this;document.getElementById("save-button").addEventListener("click",(function(t){return e.handleSubmit(t)}))}}])&&n(t.prototype,o),u&&n(t,u),e}())).setupStripe().handle()}});
|
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}(new(function(){function n(){var e,r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t(this,"setupStripe",(function(){return r.stripe=Stripe(r.key),r.stripe_connect&&(r.stripe.stripeAccount=r.stripe_connect),r})),t(this,"getFormData",(function(){return{country:document.getElementById("country").value,currency:document.getElementById("currency").value,routing_number:document.getElementById("routing-number").value,account_number:document.getElementById("account-number").value,account_holder_name:document.getElementById("account-holder-name").value,account_holder_type:document.querySelector('input[name="account-holder-type"]:checked').value}})),t(this,"handleError",(function(e){document.getElementById("save-button").disabled=!1,document.querySelector("#save-button > svg").classList.add("hidden"),document.querySelector("#save-button > span").classList.remove("hidden"),r.errors.textContent="",r.errors.textContent=e,r.errors.hidden=!1})),t(this,"handleSuccess",(function(e){document.getElementById("gateway_response").value=JSON.stringify(e),document.getElementById("server_response").submit()})),t(this,"handleSubmit",(function(e){document.getElementById("save-button").disabled=!0,document.querySelector("#save-button > svg").classList.remove("hidden"),document.querySelector("#save-button > span").classList.add("hidden"),e.preventDefault(),r.errors.textContent="",r.errors.hidden=!0,r.stripe.createToken("bank_account",r.getFormData()).then((function(e){return e.hasOwnProperty("error")?r.handleError(e.error.message):r.handleSuccess(e)}))})),this.errors=document.getElementById("errors"),this.key=document.querySelector('meta[name="stripe-publishable-key"]').content,this.stripe_connect=null===(e=document.querySelector('meta[name="stripe-account-id"]'))||void 0===e?void 0:e.content}var r,o,u;return r=n,(o=[{key:"handle",value:function(){var e=this;document.getElementById("save-button").addEventListener("click",(function(t){return e.handleSubmit(t)}))}}])&&e(r.prototype,o),u&&e(r,u),n}())).setupStripe().handle()})();
|
2
public/js/clients/payments/stripe-acss.js
vendored
2
public/js/clients/payments/stripe-acss.js
vendored
@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see stripe-acss.js.LICENSE.txt */
|
/*! For license information please see stripe-acss.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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=31)}({31:function(e,t,n){e.exports=n("RyUd")},RyUd:function(e,t){var n,r,o,a;function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=function(){function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"setupStripe",(function(){return r.stripe=Stripe(r.key),r.stripeConnect&&(r.stripe.stripeAccount=l),r})),i(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors");return""===document.getElementById("acss-name").value?(document.getElementById("acss-name").focus(),t.textContent=document.querySelector("meta[name=translation-name-required]").content,void(t.hidden=!1)):""===document.getElementById("acss-email-address").value?(document.getElementById("acss-email-address").focus(),t.textContent=document.querySelector("meta[name=translation-email-required]").content,void(t.hidden=!1)):(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),void r.stripe.confirmAcssDebitPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:document.getElementById("acss-name").value,email:document.getElementById("acss-email-address").value}}}).then((function(e){return e.error?r.handleFailure(e.error.message):r.handleSuccess(e)})))}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}var t,n,r;return t=e,(n=[{key:"handleSuccess",value:function(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent),document.getElementById("server-response").submit()}},{key:"handleFailure",value:function(e){var t=document.getElementById("errors");t.textContent="",t.textContent=e,t.hidden=!1,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")}}])&&u(t.prototype,n),r&&u(t,r),e}(),d=null!==(n=null===(r=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"",l=null!==(o=null===(a=document.querySelector('meta[name="stripe-account-id"]'))||void 0===a?void 0:a.content)&&void 0!==o?o:"";new c(d,l).setupStripe().handle()}});
|
(()=>{var e,t,n,r;function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var d=function(){function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"setupStripe",(function(){return r.stripe=Stripe(r.key),r.stripeConnect&&(r.stripe.stripeAccount=c),r})),a(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors");return""===document.getElementById("acss-name").value?(document.getElementById("acss-name").focus(),t.textContent=document.querySelector("meta[name=translation-name-required]").content,void(t.hidden=!1)):""===document.getElementById("acss-email-address").value?(document.getElementById("acss-email-address").focus(),t.textContent=document.querySelector("meta[name=translation-email-required]").content,void(t.hidden=!1)):(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),void r.stripe.confirmAcssDebitPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:document.getElementById("acss-name").value,email:document.getElementById("acss-email-address").value}}}).then((function(e){return e.error?r.handleFailure(e.error.message):r.handleSuccess(e)})))}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}var t,n,r;return t=e,(n=[{key:"handleSuccess",value:function(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent),document.getElementById("server-response").submit()}},{key:"handleFailure",value:function(e){var t=document.getElementById("errors");t.textContent="",t.textContent=e,t.hidden=!1,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")}}])&&o(t.prototype,n),r&&o(t,r),e}(),i=null!==(e=null===(t=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"",c=null!==(n=null===(r=document.querySelector('meta[name="stripe-account-id"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"";new d(i,c).setupStripe().handle()})();
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user