mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 08:21:34 +02:00
commit
0fcfe24b54
@ -236,7 +236,7 @@ class CreateSingleAccount extends Command
|
|||||||
$client->id_number = $this->getNextClientNumber($client);
|
$client->id_number = $this->getNextClientNumber($client);
|
||||||
|
|
||||||
$settings = $client->settings;
|
$settings = $client->settings;
|
||||||
$settings->currency_id = (string) rand(1, 79);
|
$settings->currency_id = "1";
|
||||||
$client->settings = $settings;
|
$client->settings = $settings;
|
||||||
|
|
||||||
$country = Country::all()->random();
|
$country = Country::all()->random();
|
||||||
|
@ -287,4 +287,6 @@ class InvoiceSum
|
|||||||
{
|
{
|
||||||
return $this->getTotalTaxes();
|
return $this->getTotalTaxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -301,4 +301,5 @@ class InvoiceSumInclusive
|
|||||||
{
|
{
|
||||||
return $this->getTotalTaxes();
|
return $this->getTotalTaxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,18 +34,7 @@ use Turbo124\Beacon\Facades\LightLogs;
|
|||||||
|
|
||||||
class LoginController extends BaseController
|
class LoginController extends BaseController
|
||||||
{
|
{
|
||||||
/*
|
/**
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Login Controller
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This controller handles authenticating users for the application and
|
|
||||||
| redirecting them to your home screen. The controller uses a trait
|
|
||||||
| to conveniently provide its functionality to your applications.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @OA\Tag(
|
* @OA\Tag(
|
||||||
* name="login",
|
* name="login",
|
||||||
* description="Authentication",
|
* description="Authentication",
|
||||||
|
@ -95,6 +95,7 @@ class InvoiceController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$invoices->map(function ($invoice) {
|
$invoices->map(function ($invoice) {
|
||||||
|
$invoice->service()->removeUnpaidGatewayFees()->save();
|
||||||
$invoice->balance = Number::formatValue($invoice->balance, $invoice->client->currency());
|
$invoice->balance = Number::formatValue($invoice->balance, $invoice->client->currency());
|
||||||
$invoice->partial = Number::formatValue($invoice->partial, $invoice->client->currency());
|
$invoice->partial = Number::formatValue($invoice->partial, $invoice->client->currency());
|
||||||
|
|
||||||
|
@ -163,19 +163,29 @@ class PaymentController extends Controller
|
|||||||
|
|
||||||
$first_invoice = $invoices->first();
|
$first_invoice = $invoices->first();
|
||||||
|
|
||||||
$fee_totals = round($gateway->calcGatewayFee($invoice_totals, true), $first_invoice->client->currency()->precision);
|
$starting_invoice_amount = $first_invoice->amount;
|
||||||
|
|
||||||
if (!$first_invoice->uses_inclusive_taxes) {
|
// $fee_totals = round($gateway->calcGatewayFee($invoice_totals, true), $first_invoice->client->currency()->precision);
|
||||||
$fee_tax = 0;
|
|
||||||
$fee_tax += round(($first_invoice->tax_rate1 / 100) * $fee_totals, $first_invoice->client->currency()->precision);
|
|
||||||
$fee_tax += round(($first_invoice->tax_rate2 / 100) * $fee_totals, $first_invoice->client->currency()->precision);
|
|
||||||
$fee_tax += round(($first_invoice->tax_rate3 / 100) * $fee_totals, $first_invoice->client->currency()->precision);
|
|
||||||
|
|
||||||
$fee_totals += $fee_tax;
|
// if (!$first_invoice->uses_inclusive_taxes) {
|
||||||
}
|
// $fee_tax = 0;
|
||||||
|
// $fee_tax += round(($first_invoice->tax_rate1 / 100) * $fee_totals, $first_invoice->client->currency()->precision);
|
||||||
|
// $fee_tax += round(($first_invoice->tax_rate2 / 100) * $fee_totals, $first_invoice->client->currency()->precision);
|
||||||
|
// $fee_tax += round(($first_invoice->tax_rate3 / 100) * $fee_totals, $first_invoice->client->currency()->precision);
|
||||||
|
|
||||||
|
// $fee_totals += $fee_tax;
|
||||||
|
// }
|
||||||
|
|
||||||
$first_invoice->service()->addGatewayFee($gateway, $invoice_totals)->save();
|
$first_invoice->service()->addGatewayFee($gateway, $invoice_totals)->save();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* The best way to determine the exact gateway fee is to not calculate it in isolation (due to rounding)
|
||||||
|
* but to simply add it as a line item, and then subtract the starting and finishing amounts of
|
||||||
|
* the invoice.
|
||||||
|
*/
|
||||||
|
$fee_totals = $first_invoice->amount - $starting_invoice_amount;
|
||||||
|
|
||||||
$payment_hash = new PaymentHash;
|
$payment_hash = new PaymentHash;
|
||||||
$payment_hash->hash = Str::random(128);
|
$payment_hash->hash = Str::random(128);
|
||||||
$payment_hash->data = $payable_invoices;
|
$payment_hash->data = $payable_invoices;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Account",
|
* schema="Account",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Activity",
|
* schema="Activity",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="BulkAction",
|
* schema="BulkAction",
|
||||||
* type="array",
|
* type="array",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="ClientContact",
|
* schema="ClientContact",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="ClientGatewayToken",
|
* schema="ClientGatewayToken",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Client",
|
* schema="Client",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="CompanyGateway",
|
* schema="CompanyGateway",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="CompanyLedger",
|
* schema="CompanyLedger",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Company",
|
* schema="Company",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="CompanySettings",
|
* schema="CompanySettings",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="CompanyToken",
|
* schema="CompanyToken",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="CompanyUser",
|
* schema="CompanyUser",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="CreditPaymentable",
|
* schema="CreditPaymentable",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Credit",
|
* schema="Credit",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Design",
|
* schema="Design",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Error",
|
* schema="Error",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Expense",
|
* schema="Expense",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="FeesAndLimits",
|
* schema="FeesAndLimits",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="GroupSetting",
|
* schema="GroupSetting",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Header(
|
* @OA\Header(
|
||||||
* header="X-MINIMUM-CLIENT-VERSION",
|
* header="X-MINIMUM-CLIENT-VERSION",
|
||||||
* description="The API version",
|
* description="The API version",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="InvoicePaymentable",
|
* schema="InvoicePaymentable",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Invoice",
|
* schema="Invoice",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="X-Api-Secret",
|
* name="X-Api-Secret",
|
||||||
* in="header",
|
* in="header",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Payment",
|
* schema="Payment",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="PaymentTerm",
|
* schema="PaymentTerm",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Paymentable",
|
* schema="Paymentable",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Product",
|
* schema="Product",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
9
app/Http/Controllers/OpenAPI/ProjectSchema.php
Normal file
9
app/Http/Controllers/OpenAPI/ProjectSchema.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @OA\Schema(
|
||||||
|
* schema="Project",
|
||||||
|
* type="object",
|
||||||
|
* @OA\Property(property="id", type="string", example="Opnel5aKBz", description="______"),
|
||||||
|
* @OA\Property(property="name", type="string", example="New Project", description="______"),
|
||||||
|
* )
|
||||||
|
*/
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Quote",
|
* schema="Quote",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="RecurringInvoice",
|
* schema="RecurringInvoice",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="RecurringQuote",
|
* schema="RecurringQuote",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="SystemLog",
|
* schema="SystemLog",
|
||||||
* type="object",
|
* type="object",
|
||||||
@ -7,9 +7,9 @@
|
|||||||
* @OA\Property(property="company_id", type="string", example="AS3df3A", description="The company hashed id"),
|
* @OA\Property(property="company_id", type="string", example="AS3df3A", description="The company hashed id"),
|
||||||
* @OA\Property(property="user_id", type="string", example="AS3df3A", description="The user_id hashed id"),
|
* @OA\Property(property="user_id", type="string", example="AS3df3A", description="The user_id hashed id"),
|
||||||
* @OA\Property(property="client_id", type="string", example="AS3df3A", description="The client_id hashed id"),
|
* @OA\Property(property="client_id", type="string", example="AS3df3A", description="The client_id hashed id"),
|
||||||
* @OA\Property(property="event_id", type="int", example="1", description="The Log Type ID"),
|
* @OA\Property(property="event_id", type="integer", example=1, description="The Log Type ID"),
|
||||||
* @OA\Property(property="category_id", type="int", example="1", description="The Category Type ID"),
|
* @OA\Property(property="category_id", type="integer", example=1, description="The Category Type ID"),
|
||||||
* @OA\Property(property="type_id", type="int", example="1", description="The Type Type ID"),
|
* @OA\Property(property="type_id", type="integer", example=1, description="The Type Type ID"),
|
||||||
* @OA\Property(property="log", type="object", example="{'key':'value'}", description="The json object of the error"),
|
* @OA\Property(property="log", type="object", example="{'key':'value'}", description="The json object of the error"),
|
||||||
* @OA\Property(property="updated_at", type="string", example="2", description="______"),
|
* @OA\Property(property="updated_at", type="string", example="2", description="______"),
|
||||||
* @OA\Property(property="created_at", type="string", example="2", description="______"),
|
* @OA\Property(property="created_at", type="string", example="2", description="______"),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="TaxRate",
|
* schema="TaxRate",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Template",
|
* schema="Template",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="User",
|
* schema="User",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="ValidationError",
|
* schema="ValidationError",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="VendorContact",
|
* schema="VendorContact",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Vendor",
|
* schema="Vendor",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="Webhook",
|
* schema="Webhook",
|
||||||
* type="object",
|
* type="object",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/**
|
||||||
* @OA\OpenApi(
|
* @OA\OpenApi(
|
||||||
* @OA\Info(
|
* @OA\Info(
|
||||||
* version="1.0.30",
|
* version="1.0.30",
|
||||||
@ -15,8 +15,8 @@
|
|||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
* @OA\Server(
|
* @OA\Server(
|
||||||
* description="InvoiceNinja host",
|
* description="Example InvoiceNinja base url",
|
||||||
* url="https://virtserver.swaggerhub.com/InvoiceNinja/invoices/1.0.30"
|
* url="https://ninja.test"
|
||||||
* ),
|
* ),
|
||||||
* @OA\ExternalDocumentation(
|
* @OA\ExternalDocumentation(
|
||||||
* description="http://docs.invoiceninja.com",
|
* description="http://docs.invoiceninja.com",
|
||||||
|
@ -286,7 +286,7 @@ class CompanyGateway extends BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($fees_and_limits->fee_percent) {
|
if ($fees_and_limits->fee_percent) {
|
||||||
$fee += $amount * $fees_and_limits->fee_percent / 100;
|
$fee += round(($amount * $fees_and_limits->fee_percent / 100),2);
|
||||||
info("fee after adding fee percent = {$fee}");
|
info("fee after adding fee percent = {$fee}");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,17 +300,17 @@ class CompanyGateway extends BaseModel
|
|||||||
/**/
|
/**/
|
||||||
if ($include_taxes) {
|
if ($include_taxes) {
|
||||||
if ($fees_and_limits->fee_tax_rate1) {
|
if ($fees_and_limits->fee_tax_rate1) {
|
||||||
$fee += $pre_tax_fee * $fees_and_limits->fee_tax_rate1 / 100;
|
$fee += round(($pre_tax_fee * $fees_and_limits->fee_tax_rate1 / 100),2);
|
||||||
info("fee after adding fee tax 1 = {$fee}");
|
info("fee after adding fee tax 1 = {$fee}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fees_and_limits->fee_tax_rate2) {
|
if ($fees_and_limits->fee_tax_rate2) {
|
||||||
$fee += $pre_tax_fee * $fees_and_limits->fee_tax_rate2 / 100;
|
$fee += round(($pre_tax_fee * $fees_and_limits->fee_tax_rate2 / 100),2);
|
||||||
info("fee after adding fee tax 2 = {$fee}");
|
info("fee after adding fee tax 2 = {$fee}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fees_and_limits->fee_tax_rate3) {
|
if ($fees_and_limits->fee_tax_rate3) {
|
||||||
$fee += $pre_tax_fee * $fees_and_limits->fee_tax_rate3 / 100;
|
$fee += round(($pre_tax_fee * $fees_and_limits->fee_tax_rate3 / 100),2);
|
||||||
info("fee after adding fee tax 3 = {$fee}");
|
info("fee after adding fee tax 3 = {$fee}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,19 +104,22 @@ class Gateway extends StaticModel
|
|||||||
{
|
{
|
||||||
switch ($this->id) {
|
switch ($this->id) {
|
||||||
case 1:
|
case 1:
|
||||||
return ['methods' => [GatewayType::CREDIT_CARD], 'refund' => true, 'token_billing' => true ]; //Authorize.net
|
return [GatewayType::CREDIT_CARD => ['refund' => true, 'token_billing' => true]];//Authorize.net
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
return ['methods' => [GatewayType::PAYPAL], 'refund' => true, 'token_billing' => false ]; //Paypal
|
return [GatewayType::PAYPAL => ['refund' => true, 'token_billing' => false]]; //Paypal
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
return ['methods' => [GatewayType::CREDIT_CARD, GatewayType::BANK_TRANSFER, GatewayType::ALIPAY, GatewayType::APPLE_PAY], 'refund' => true, 'token_billing' => true ]; //Stripe
|
return [GatewayType::CREDIT_CARD => ['refund' => true, 'token_billing' => true],
|
||||||
|
GatewayType::BANK_TRANSFER => ['refund' => true, 'token_billing' => true],
|
||||||
|
GatewayType::ALIPAY => ['refund' => false, 'token_billing' => false],
|
||||||
|
GatewayType::APPLE_PAY => ['refund' => false, 'token_billing' => false]]; //Stripe
|
||||||
break;
|
break;
|
||||||
case 39:
|
case 39:
|
||||||
return ['methods' => [GatewayType::CREDIT_CARD], 'refund' => true, 'token_billing' => true ]; //Checkout
|
return [GatewayType::CREDIT_CARD => ['refund' => true, 'token_billing' => true]]; //Checkout
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return ['methods' => [], 'refund' => false, 'token_billing' => false];
|
return [];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,9 @@ class AddGatewayFee extends AbstractService
|
|||||||
{
|
{
|
||||||
$gateway_fee = round($this->company_gateway->calcGatewayFee($this->amount), $this->invoice->client->currency()->precision);
|
$gateway_fee = round($this->company_gateway->calcGatewayFee($this->amount), $this->invoice->client->currency()->precision);
|
||||||
|
|
||||||
|
if((int)$gateway_fee == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
$this->cleanPendingGatewayFees();
|
$this->cleanPendingGatewayFees();
|
||||||
|
|
||||||
if ($gateway_fee > 0) {
|
if ($gateway_fee > 0) {
|
||||||
|
@ -212,6 +212,8 @@ class InvoiceService
|
|||||||
|
|
||||||
public function updateStatus()
|
public function updateStatus()
|
||||||
{
|
{
|
||||||
|
info("invoice balance = {$this->invoice->balance}");
|
||||||
|
|
||||||
if((int)$this->invoice->balance == 0)
|
if((int)$this->invoice->balance == 0)
|
||||||
$this->setStatus(Invoice::STATUS_PAID);
|
$this->setStatus(Invoice::STATUS_PAID);
|
||||||
|
|
||||||
@ -232,7 +234,7 @@ class InvoiceService
|
|||||||
return $item;
|
return $item;
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
|
||||||
$this->invoice = $this->invoice->calc()->getInvoice();
|
//$this->invoice = $this->invoice->calc()->getInvoice();
|
||||||
|
|
||||||
$this->deletePdf();
|
$this->deletePdf();
|
||||||
|
|
||||||
|
@ -67,12 +67,16 @@ class PaymentService
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->payment->ledger()->updatePaymentBalance($this->payment->amount);
|
$this->payment
|
||||||
|
->ledger()
|
||||||
|
->updatePaymentBalance($this->payment->amount);
|
||||||
|
|
||||||
$client->service()
|
$client->service()
|
||||||
->updateBalance($this->payment->amount)
|
->updateBalance($this->payment->amount)
|
||||||
->updatePaidToDate($this->payment->amount * -1)
|
->updatePaidToDate($this->payment->amount * -1)
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function refundPayment(array $data) :?Payment
|
public function refundPayment(array $data) :?Payment
|
||||||
|
@ -31,7 +31,6 @@ class UpdateGatewayTableVisibleColumn extends Migration
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Schema::table('expenses', function ($t){
|
Schema::table('expenses', function ($t){
|
||||||
$t->renameColumn('invoice_category_id', 'category_id');
|
$t->renameColumn('invoice_category_id', 'category_id');
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user