mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 00:17:34 -05:00 
			
		
		
		
	Fixes for WePay
This commit is contained in:
		
							parent
							
								
									df0e9e0a73
								
							
						
					
					
						commit
						f072b921c7
					
				@ -40,7 +40,10 @@ class WePayController extends BaseController
 | 
			
		||||
        $company = Company::where('company_key', $hash['company_key'])->firstOrFail();
 | 
			
		||||
 | 
			
		||||
        $data['user_id'] = $user->id;
 | 
			
		||||
        $data['company'] = $company;
 | 
			
		||||
        $data['user_company'] = $company;
 | 
			
		||||
        
 | 
			
		||||
        // $data['company_key'] = $company->company_key;
 | 
			
		||||
        // $data['db'] = $company->db;
 | 
			
		||||
 | 
			
		||||
        $wepay_driver = new WePayPaymentDriver(new CompanyGateway, null, null);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@ class AdjustProductInventory implements ShouldQueue
 | 
			
		||||
 | 
			
		||||
    public array $old_invoice;
 | 
			
		||||
 | 
			
		||||
    public function __construct(Company $company, Invoice $invoice, ?array $old_invoice = [])
 | 
			
		||||
    public function __construct(Company $company, Invoice $invoice, $old_invoice = [])
 | 
			
		||||
    {
 | 
			
		||||
        $this->company = $company;
 | 
			
		||||
        $this->invoice = $invoice;
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,7 @@ class Setup
 | 
			
		||||
    {
 | 
			
		||||
        /*
 | 
			
		||||
        'user_id',
 | 
			
		||||
        'company',
 | 
			
		||||
        'user_company',
 | 
			
		||||
         */
 | 
			
		||||
 | 
			
		||||
        return render('gateways.wepay.signup.index', $data);
 | 
			
		||||
 | 
			
		||||
@ -33,17 +33,29 @@ class DeletePayment
 | 
			
		||||
 | 
			
		||||
    public function run()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        \DB::connection(config('database.default'))->transaction(function ()  {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            if ($this->payment->is_deleted) {
 | 
			
		||||
                return $this->payment;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        return $this->setStatus(Payment::STATUS_CANCELLED) //sets status of payment
 | 
			
		||||
            $this->payment = Payment::withTrashed()->where('id', $this->payment->id)->lockForUpdate()->first();
 | 
			
		||||
 | 
			
		||||
            $this->setStatus(Payment::STATUS_CANCELLED) //sets status of payment
 | 
			
		||||
                ->updateCreditables() //return the credits first
 | 
			
		||||
                ->adjustInvoices()
 | 
			
		||||
                ->updateClient()
 | 
			
		||||
                ->deletePaymentables()
 | 
			
		||||
                ->cleanupPayment()
 | 
			
		||||
                ->save();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        }, 2);
 | 
			
		||||
 | 
			
		||||
        return $this->payment;
 | 
			
		||||
    
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function cleanupPayment()
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@
 | 
			
		||||
        <img src="{{ asset('images/wepay.svg') }}" alt="We Pay">
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    @livewire('wepay-signup', ['user_id' => $user_id, 'company' => $company])
 | 
			
		||||
    @livewire('wepay-signup', ['user_id' => $user_id, 'company' => $user_company])
 | 
			
		||||
</div>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user