mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
aecec21630
@ -733,7 +733,7 @@ class InvoiceController extends BaseController
|
||||
}
|
||||
break;
|
||||
case 'mark_sent':
|
||||
$invoice->service()->markSent()->save();
|
||||
$invoice->service()->markSent(true)->save();
|
||||
|
||||
if (! $bulk) {
|
||||
return $this->itemResponse($invoice);
|
||||
|
@ -54,6 +54,8 @@ class UpdateCompanyRequest extends Request
|
||||
$rules['size_id'] = 'integer|nullable';
|
||||
$rules['country_id'] = 'integer|nullable';
|
||||
$rules['work_email'] = 'email|nullable';
|
||||
$rules['matomo_id'] = 'nullable|integer';
|
||||
|
||||
// $rules['client_registration_fields'] = 'array';
|
||||
|
||||
if (isset($input['portal_mode']) && ($input['portal_mode'] == 'domain' || $input['portal_mode'] == 'iframe')) {
|
||||
|
@ -35,17 +35,13 @@ class UpdateVendorRequest extends Request
|
||||
{
|
||||
/* Ensure we have a client name, and that all emails are unique*/
|
||||
|
||||
$rules['country_id'] = 'integer|nullable';
|
||||
$rules['country_id'] = 'integer';
|
||||
|
||||
if ($this->number) {
|
||||
$rules['number'] = Rule::unique('vendors')->where('company_id', auth()->user()->company()->id)->ignore($this->vendor->id);
|
||||
}
|
||||
|
||||
// if($this->id_number)
|
||||
// $rules['id_number'] = Rule::unique('vendors')->where('company_id', auth()->user()->company()->id)->ignore($this->vendor->id);
|
||||
|
||||
$rules['contacts.*.email'] = 'nullable|distinct';
|
||||
// $rules['id_number'] = 'unique:vendors,id_number,'.$this->id.',id,company_id,'.auth()->user()->company()->id;
|
||||
|
||||
return $rules;
|
||||
}
|
||||
@ -67,6 +63,9 @@ class UpdateVendorRequest extends Request
|
||||
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
|
||||
}
|
||||
|
||||
if(array_key_exists('country_id', $input) && is_null($input['country_id']))
|
||||
unset($input['country_id']);
|
||||
|
||||
$input = $this->decodePrimaryKeys($input);
|
||||
|
||||
$this->replace($input);
|
||||
|
@ -167,7 +167,7 @@ class Import implements ShouldQueue
|
||||
|
||||
public $tries = 1;
|
||||
|
||||
public $timeout = 0;
|
||||
public $timeout = 10000000;
|
||||
|
||||
// public $backoff = 86430;
|
||||
|
||||
@ -188,10 +188,10 @@ class Import implements ShouldQueue
|
||||
$this->resources = $resources;
|
||||
}
|
||||
|
||||
public function middleware()
|
||||
{
|
||||
return [new WithoutOverlapping("only_one_migration_at_a_time_ever")];
|
||||
}
|
||||
// public function middleware()
|
||||
// {
|
||||
// return [new WithoutOverlapping("only_one_migration_at_a_time_ever")];
|
||||
// }
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
|
@ -115,6 +115,7 @@ class Gateway extends StaticModel
|
||||
GatewayType::BECS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']],
|
||||
GatewayType::IDEAL => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']],
|
||||
GatewayType::ACSS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']],
|
||||
GatewayType::KLARNA => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded']],
|
||||
GatewayType::FPX => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']], ];
|
||||
case 39:
|
||||
return [GatewayType::CREDIT_CARD => ['refund' => true, 'token_billing' => true, 'webhooks' => [' ']]]; //Checkout
|
||||
|
@ -70,6 +70,7 @@ class CreditCard
|
||||
'sequenceType' => 'recurring',
|
||||
'description' => \sprintf('Hash: %s', $this->mollie->payment_hash->hash),
|
||||
'webhookUrl' => $this->mollie->company_gateway->webhookUrl(),
|
||||
'idempotencyKey' => uniqid("st",true),
|
||||
'metadata' => [
|
||||
'client_id' => $this->mollie->client->hashed_id,
|
||||
'hash' => $this->mollie->payment_hash->hash,
|
||||
|
@ -19,6 +19,8 @@ use App\Models\Payment;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\SystemLog;
|
||||
use App\PaymentDrivers\StripePaymentDriver;
|
||||
use App\Utils\Number;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class Klarna
|
||||
{
|
||||
@ -50,10 +52,10 @@ class Klarna
|
||||
|
||||
$invoice_numbers = collect($data['invoices'])->pluck('invoice_number');
|
||||
|
||||
if ($invoice_numbers > 0) {
|
||||
$description = ctrans('texts.payment_provider_paymenttext', ['invoicenumber' => $invoice_numbers->implode(', '), 'amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
|
||||
if ($invoice_numbers->count() > 0) {
|
||||
$description = ctrans('texts.stripe_paymenttext', ['invoicenumber' => $invoice_numbers->implode(', '), 'amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
|
||||
} else {
|
||||
$description = ctrans('texts.payment_prvoder_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
|
||||
$description = ctrans('texts.stripe_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
|
||||
}
|
||||
|
||||
$intent = \Stripe\PaymentIntent::create([
|
||||
@ -149,6 +151,6 @@ class Klarna
|
||||
$this->stripe->client->company,
|
||||
);
|
||||
|
||||
throw new PaymentFailed(ctrans('texts.payment_provider_failed_process_payment'), 500);
|
||||
throw new PaymentFailed(ctrans('texts.gateway_error'), 500);
|
||||
}
|
||||
}
|
||||
|
@ -59,8 +59,10 @@ class UserRepository extends BaseRepository
|
||||
// if(array_key_exists('oauth_provider_id', $details))
|
||||
// unset($details['oauth_provider_id']);
|
||||
|
||||
if (request()->has('validated_phone'))
|
||||
if (request()->has('validated_phone')){
|
||||
$details['phone'] = request()->input('validated_phone');
|
||||
$user->verified_phone_number = false;
|
||||
}
|
||||
|
||||
$user->fill($details);
|
||||
|
||||
|
@ -175,9 +175,9 @@ class InvoiceService
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function markSent()
|
||||
public function markSent($fire_event = false)
|
||||
{
|
||||
$this->invoice = (new MarkSent($this->invoice->client, $this->invoice))->run();
|
||||
$this->invoice = (new MarkSent($this->invoice->client, $this->invoice))->run($fire_event);
|
||||
|
||||
$this->setExchangeRate();
|
||||
|
||||
|
@ -30,7 +30,7 @@ class MarkSent extends AbstractService
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
|
||||
public function run()
|
||||
public function run($fire_webhook = false)
|
||||
{
|
||||
|
||||
/* Return immediately if status is not draft or invoice has been deleted */
|
||||
@ -68,6 +68,10 @@ class MarkSent extends AbstractService
|
||||
|
||||
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
if($fire_webhook)
|
||||
event('eloquent.updated: App\Models\Invoice', $this->invoice);
|
||||
|
||||
|
||||
return $this->invoice->fresh();
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class TriggeredActions extends AbstractService
|
||||
|
||||
if ($this->request->has('mark_sent') && $this->request->input('mark_sent') == 'true' && $this->invoice->status_id == Invoice::STATUS_DRAFT) {
|
||||
$this->invoice = $this->invoice->service()->markSent()->save(); //update notification NOT sent
|
||||
$this->updated = true;
|
||||
$this->updated = false;
|
||||
}
|
||||
|
||||
if ($this->request->has('amount_paid') && is_numeric($this->request->input('amount_paid'))) {
|
||||
|
@ -150,7 +150,7 @@ class CompanyTransformer extends EntityTransformer
|
||||
'google_analytics_url' => (string) $company->google_analytics_key, //@deprecate 1-2-2021
|
||||
'google_analytics_key' => (string) $company->google_analytics_key,
|
||||
'matomo_url' => (string) $company->matomo_url,
|
||||
'matomo_id' => (int) $company->matomo_id,
|
||||
'matomo_id' => (string) $company->matomo_id ?: '',
|
||||
'enabled_item_tax_rates' => (int) $company->enabled_item_tax_rates,
|
||||
'client_can_register' => (bool) $company->client_can_register,
|
||||
'is_large' => (bool) $company->is_large,
|
||||
|
@ -4851,6 +4851,47 @@ $LANG = array(
|
||||
'cash_vs_accrual_help' => 'Turn on for accrual reporting, turn off for cash basis reporting.',
|
||||
'expense_paid_report' => 'Expensed reporting',
|
||||
'expense_paid_report_help' => 'Turn on for reporting all expenses, turn off for reporting only paid expenses',
|
||||
'payment_type_Klarna' => 'Klarna',
|
||||
'online_payment_email_help' => 'Send an email when an online payment is made',
|
||||
'manual_payment_email_help' => 'Send an email when manually entering a payment',
|
||||
'mark_paid_payment_email_help' => 'Send an email when marking an invoice as pad',
|
||||
'linked_transaction' => 'Successfully linked transaction',
|
||||
'link_payment' => 'Link Payment',
|
||||
'link_expense' => 'Link Expense',
|
||||
'lock_invoiced_tasks' => 'Lock Invoiced Tasks',
|
||||
'lock_invoiced_tasks_help' => 'Prevent tasks from being edited once invoiced',
|
||||
'registration_required_help' => 'Require clients to register',
|
||||
'use_inventory_management' => 'Use Inventory Management',
|
||||
'use_inventory_management_help' => 'Require products to be in stock',
|
||||
'optional_products' => 'Optional Products',
|
||||
'optional_recurring_products' => 'Optional Recurring Products',
|
||||
'convert_matched' => 'Convert',
|
||||
'auto_billed_invoice' => 'Successfully queued invoice to be auto-billed',
|
||||
'auto_billed_invoices' => 'Successfully queued invoices to be auto-billed',
|
||||
'operator' => 'Operator',
|
||||
'value' => 'Value',
|
||||
'is' => 'Is',
|
||||
'contains' => 'Contains',
|
||||
'starts_with' => 'Starts with',
|
||||
'is_empty' => 'Is empty',
|
||||
'add_rule' => 'Add Rule',
|
||||
'match_all_rules' => 'Match All Rules',
|
||||
'match_all_rules_help' => 'All criteria needs to match for the rule to be applied',
|
||||
'auto_convert_help' => 'Automatically convert matched transactions to expenses',
|
||||
'rules' => 'Rules',
|
||||
'transaction_rule' => 'Transaction Rule',
|
||||
'transaction_rules' => 'Transaction Rules',
|
||||
'new_transaction_rule' => 'New Transaction Rule',
|
||||
'edit_transaction_rule' => 'Edit Transaction Rule',
|
||||
'created_transaction_rule' => 'Successfully created rule',
|
||||
'updated_transaction_rule' => 'Successfully updated transaction rule',
|
||||
'archived_transaction_rule' => 'Successfully archived transaction rule',
|
||||
'deleted_transaction_rule' => 'Successfully deleted transaction rule',
|
||||
'removed_transaction_rule' => 'Successfully removed transaction rule',
|
||||
'restored_transaction_rule' => 'Successfully restored transaction rule',
|
||||
'search_transaction_rule' => 'Search Transaction Rule',
|
||||
'search_transaction_rules' => 'Search Transaction Rules',
|
||||
|
||||
);
|
||||
|
||||
return $LANG;
|
||||
|
@ -5,6 +5,7 @@
|
||||
"/js/clients/payments/forte-credit-card-payment.js": "/js/clients/payments/forte-credit-card-payment.js?id=f42dd0caddb3603e71db061924c4b172",
|
||||
"/js/clients/payments/forte-ach-payment.js": "/js/clients/payments/forte-ach-payment.js?id=b8173c7c0dee76bf9ae6312a963ae0e4",
|
||||
"/js/clients/payments/stripe-ach.js": "/js/clients/payments/stripe-ach.js?id=207f218c44553470287f35f33a7eb154",
|
||||
"/js/clients/payments/stripe-klarna.js": "/js/clients/payments/stripe-klarna.js?id=1c248bc1f4f45310cd585a95a5055375",
|
||||
"/js/clients/invoices/action-selectors.js": "/js/clients/invoices/action-selectors.js?id=404b7ee18e420de0e73f5402b7e39122",
|
||||
"/js/clients/purchase_orders/action-selectors.js": "/js/clients/purchase_orders/action-selectors.js?id=2f0c4e3bab30a98e33ac768255113174",
|
||||
"/js/clients/purchase_orders/accept.js": "/js/clients/purchase_orders/accept.js?id=9bb483a89a887f753e49c0b635d6276a",
|
||||
|
28
resources/js/clients/payments/stripe-klarna.js
vendored
28
resources/js/clients/payments/stripe-klarna.js
vendored
@ -33,6 +33,16 @@ class ProcessKlarna {
|
||||
return this;
|
||||
};
|
||||
|
||||
handleError = (message) => {
|
||||
document.getElementById('pay-now').disabled = false;
|
||||
document.querySelector('#pay-now > svg').classList.add('hidden');
|
||||
document.querySelector('#pay-now > span').classList.remove('hidden');
|
||||
|
||||
this.errors.textContent = '';
|
||||
this.errors.textContent = message;
|
||||
this.errors.hidden = false;
|
||||
};
|
||||
|
||||
handle = () => {
|
||||
document.getElementById('pay-now').addEventListener('click', (e) => {
|
||||
let errors = document.getElementById('errors');
|
||||
@ -46,14 +56,28 @@ class ProcessKlarna {
|
||||
{
|
||||
payment_method: {
|
||||
billing_details: {
|
||||
name: document.getElementById("giropay-name").value,
|
||||
name: document.getElementById("klarna-name").value,
|
||||
email: document.querySelector('meta[name=email').content,
|
||||
address: {
|
||||
line1: document.querySelector('input[name=address1]').value,
|
||||
line2: document.querySelector('input[name=address2]').value,
|
||||
city: document.querySelector('input[name=city]').value,
|
||||
postal_code: document.querySelector('input[name=postal_code]').value,
|
||||
state: document.querySelector('input[name=state]').value,
|
||||
country: document.querySelector('meta[name=country').content,
|
||||
}
|
||||
},
|
||||
},
|
||||
return_url: document.querySelector(
|
||||
'meta[name="return-url"]'
|
||||
).content,
|
||||
}
|
||||
);
|
||||
).then((result) => {
|
||||
if (result.hasOwnProperty('error')) {
|
||||
return this.handleError(result.error.message);
|
||||
}
|
||||
|
||||
});;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,69 @@
|
||||
<div id="stripe--payment-container">
|
||||
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.name')])
|
||||
<div class="form-group mb-[10px]">
|
||||
<input class="input w-full" id="klarna-name" type="text" placeholder="{{ ctrans('texts.bank_account_holder') }}" value="{{ $gateway->client->present()->name()}}" required>
|
||||
</div>
|
||||
<div class="form-group mb-[10px]">
|
||||
<input
|
||||
type="text"
|
||||
class="input w-full m-0"
|
||||
id="address2"
|
||||
placeholder="{{ ctrans('texts.address2') }}"
|
||||
name="address2"
|
||||
value="{{$gateway->client->address2}}"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group mb-[10px]">
|
||||
<input
|
||||
type="text"
|
||||
class="input w-full m-0"
|
||||
id="address1"
|
||||
placeholder="{{ ctrans('texts.address1') }}"
|
||||
name="address1"
|
||||
value="{{$gateway->client->address1}}"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="flex form-group flex justify-center gap-[13px] mb-[10px]"
|
||||
>
|
||||
<div class="w-full gap-x-2 md:w-1/3">
|
||||
<div class="form-group">
|
||||
<input
|
||||
type="text"
|
||||
class="input w-full m-0"
|
||||
id="city"
|
||||
placeholder="{{ ctrans('texts.city') }}"
|
||||
name="city"
|
||||
value="{{$gateway->client->city}}"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full gap-x-2 md:w-1/3">
|
||||
<div class="form-group">
|
||||
<input
|
||||
type="text"
|
||||
class="input w-full m-0"
|
||||
id="state"
|
||||
placeholder="{{ ctrans('texts.state') }}"
|
||||
name="state"
|
||||
value="{{$gateway->client->state}}"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full gap-x-2 md:w-1/3">
|
||||
<div class="form-group">
|
||||
<input
|
||||
type="text"
|
||||
class="input w-full m-0"
|
||||
id="postal_code"
|
||||
placeholder="{{ ctrans('texts.postal_code') }}"
|
||||
name="postal_code"
|
||||
value="{{$gateway->client->postal_code}}"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endcomponent
|
||||
</div>
|
@ -11,6 +11,7 @@
|
||||
<meta name="amount" content="{{ $stripe_amount }}">
|
||||
<meta name="country" content="{{ $country }}">
|
||||
<meta name="customer" content="{{ $customer }}">
|
||||
<meta name="email" content="{{ $gateway->client->present()->email() }}">
|
||||
<meta name="pi-client-secret" content="{{ $pi_client_secret }}">
|
||||
@endsection
|
||||
|
||||
@ -22,6 +23,7 @@
|
||||
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.payment_type')])
|
||||
{{ ctrans('texts.klarna') }} ({{ ctrans('texts.bank_transfer') }})
|
||||
@endcomponent
|
||||
@include('portal.ninja2020.gateways.stripe.klarna.klarna')
|
||||
@include('portal.ninja2020.gateways.includes.pay_now')
|
||||
@endsection
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
<head>
|
||||
<!-- Error: {{ session('error') }} -->
|
||||
@if ($company && $company->matomo_url && $company->matomo_id)
|
||||
@if (isset($company) && $company->matomo_url && $company->matomo_id)
|
||||
<script>
|
||||
var _paq = window._paq = window._paq || [];
|
||||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
<head>
|
||||
<!-- Error: {{ session('error') }} -->
|
||||
@if ($company && $company->matomo_url && $company->matomo_id)
|
||||
@if (isset($company) && $company->matomo_url && $company->matomo_id)
|
||||
<script>
|
||||
var _paq = window._paq = window._paq || [];
|
||||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||
@ -19,7 +19,7 @@
|
||||
})();
|
||||
</script>
|
||||
<noscript><p><img src="{{ $company->matomo_url }}/matomo.php?idsite={{ $company->matomo_id }}&rec=1" style="border:0;" alt="" /></p></noscript>
|
||||
@elif (config('services.analytics.tracking_id'))
|
||||
@elseif (config('services.analytics.tracking_id'))
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-122229484-1"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user