mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Working on payment submissions
This commit is contained in:
parent
f3316277c3
commit
c8f7e9e250
@ -29,7 +29,6 @@ class Methods extends Component
|
|||||||
{
|
{
|
||||||
if (auth()->guard('contact')->guest()) {
|
if (auth()->guard('contact')->guest()) {
|
||||||
$this->dispatch('purchase.forward', component: Authentication::class);
|
$this->dispatch('purchase.forward', component: Authentication::class);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,12 +50,11 @@ class Methods extends Component
|
|||||||
|
|
||||||
$this->context['client_id'] = $contact->client->hashed_id;
|
$this->context['client_id'] = $contact->client->hashed_id;
|
||||||
|
|
||||||
nlog($this->context);
|
|
||||||
|
|
||||||
$invoice = $this->subscription
|
$invoice = $this->subscription
|
||||||
->calc()
|
->calc()
|
||||||
->buildPurchaseInvoice($this->context)
|
->buildPurchaseInvoice($this->context)
|
||||||
->service()
|
->service()
|
||||||
|
->markSent()
|
||||||
->fillDefaults()
|
->fillDefaults()
|
||||||
->adjustInventory()
|
->adjustInventory()
|
||||||
->save();
|
->save();
|
||||||
@ -75,6 +73,8 @@ class Methods extends Component
|
|||||||
? \App\Utils\Number::formatValue($invoice->partial, $invoice->client->currency())
|
? \App\Utils\Number::formatValue($invoice->partial, $invoice->client->currency())
|
||||||
: \App\Utils\Number::formatValue($invoice->balance, $invoice->client->currency());
|
: \App\Utils\Number::formatValue($invoice->balance, $invoice->client->currency());
|
||||||
|
|
||||||
|
nlog($invoice->toArray());
|
||||||
|
|
||||||
$this->dispatch('purchase.context', property: 'form.company_gateway_id', value: $company_gateway_id);
|
$this->dispatch('purchase.context', property: 'form.company_gateway_id', value: $company_gateway_id);
|
||||||
$this->dispatch('purchase.context', property: 'form.payment_method_id', value: $gateway_type_id);
|
$this->dispatch('purchase.context', property: 'form.payment_method_id', value: $gateway_type_id);
|
||||||
$this->dispatch('purchase.context', property: 'form.invoice_hashed_id', value: $invoice->hashed_id);
|
$this->dispatch('purchase.context', property: 'form.invoice_hashed_id', value: $invoice->hashed_id);
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
namespace App\Livewire\BillingPortal;
|
namespace App\Livewire\BillingPortal;
|
||||||
|
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
use App\Services\ClientPortal\InstantPayment;
|
||||||
|
|
||||||
class Submit extends Component
|
class Submit extends Component
|
||||||
{
|
{
|
||||||
@ -21,6 +22,28 @@ class Submit extends Component
|
|||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
// This is right place to check if everything is set up correctly.
|
// This is right place to check if everything is set up correctly.
|
||||||
|
// <input type="hidden" name="action" value="payment">
|
||||||
|
// <input type="hidden" name="invoices[]" value="{{ $context['form']['invoice_hashed_id'] ?? '' }}">
|
||||||
|
// <input type="hidden" name="payable_invoices[0][amount]" value="{{ $context['form']['payable_amount'] ?? '' }}">
|
||||||
|
// <input type="hidden" name="payable_invoices[0][invoice_id]" value="{{ $context['form']['invoice_hashed_id'] ?? '' }}">
|
||||||
|
// <input type="hidden" name="company_gateway_id" value="{{ $context['form']['company_gateway_id'] ?? '' }}"/>
|
||||||
|
// <input type="hidden" name="payment_method_id" value="{{ $context['form']['payment_method_id'] ?? '' }}"/>
|
||||||
|
//hash
|
||||||
|
//sidebar = h
|
||||||
|
|
||||||
|
// $request = new \Illuminate\Http\Request([
|
||||||
|
// 'sidebar' => 'hidden',
|
||||||
|
// 'hash' => $this->context['hash'],
|
||||||
|
// 'action' => 'payment',
|
||||||
|
// 'invoices[]' => $this->context['form']['invoice_hashed_id'],
|
||||||
|
// 'payable_invoices[0][amount]' => $this->context['form']['payable_amount'],
|
||||||
|
// 'payable_invoices[0][invoice_id]' => $this->context['form']['invoice_hashed_id'],
|
||||||
|
// 'company_gateway_id' => $this->context['form']['company_gateway_id'],
|
||||||
|
// 'payment_method_id' => $this->context['form']['payment_method_id'],
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// return (new InstantPayment($request))->run();
|
||||||
|
|
||||||
|
|
||||||
$this->dispatch('purchase.submit');
|
$this->dispatch('purchase.submit');
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ class InstantPayment
|
|||||||
{
|
{
|
||||||
nlog($this->request->all());
|
nlog($this->request->all());
|
||||||
|
|
||||||
|
/** @var \App\Models\ClientContact $cc */
|
||||||
$cc = auth()->guard('contact')->user();
|
$cc = auth()->guard('contact')->user();
|
||||||
|
|
||||||
$cc->first_name = $this->request->contact_first_name;
|
$cc->first_name = $this->request->contact_first_name;
|
||||||
|
@ -13,14 +13,12 @@ namespace App\Services\Subscription;
|
|||||||
|
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Subscription;
|
use App\Models\Subscription;
|
||||||
use App\Models\ClientContact;
|
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use App\DataMapper\InvoiceItem;
|
use App\DataMapper\InvoiceItem;
|
||||||
use App\Factory\InvoiceFactory;
|
use App\Factory\InvoiceFactory;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use App\Helpers\Invoice\ProRata;
|
use App\Helpers\Invoice\ProRata;
|
||||||
use App\Repositories\InvoiceRepository;
|
use App\Repositories\InvoiceRepository;
|
||||||
use App\Repositories\SubscriptionRepository;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SubscriptionCalculator.
|
* SubscriptionCalculator.
|
||||||
@ -31,6 +29,12 @@ class SubscriptionCalculator
|
|||||||
|
|
||||||
public function __construct(public Subscription $subscription){}
|
public function __construct(public Subscription $subscription){}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BuildPurchaseInvoice
|
||||||
|
*
|
||||||
|
* @param array $context
|
||||||
|
* @return Invoice
|
||||||
|
*/
|
||||||
public function buildPurchaseInvoice(array $context): Invoice
|
public function buildPurchaseInvoice(array $context): Invoice
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -54,7 +58,9 @@ class SubscriptionCalculator
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Build Line Items
|
* Build Line Items
|
||||||
|
*
|
||||||
* @param array $context
|
* @param array $context
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function buildItems(array $context): array
|
private function buildItems(array $context): array
|
||||||
@ -69,9 +75,6 @@ class SubscriptionCalculator
|
|||||||
return $product['quantity'] >= 1;
|
return $product['quantity'] >= 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
nlog("items");
|
|
||||||
nlog($items);
|
|
||||||
|
|
||||||
return collect($items)->map(function ($item){
|
return collect($items)->map(function ($item){
|
||||||
$line_item = new InvoiceItem();
|
$line_item = new InvoiceItem();
|
||||||
$line_item->product_key = $item['product']['product_key'];
|
$line_item->product_key = $item['product']['product_key'];
|
||||||
|
Loading…
Reference in New Issue
Block a user