mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 03:57:32 -05:00 
			
		
		
		
	payment links
This commit is contained in:
		
							parent
							
								
									ef11a2258d
								
							
						
					
					
						commit
						eb7de25e64
					
				@ -206,7 +206,6 @@ class InvitationController extends Controller
 | 
				
			|||||||
        else 
 | 
					        else 
 | 
				
			||||||
            $amount = round($invoice->balance, (int)$invoice->client->currency()->precision);
 | 
					            $amount = round($invoice->balance, (int)$invoice->client->currency()->precision);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $gateways = $invitation->contact->client->service()->getPaymentMethods($amount);
 | 
					        $gateways = $invitation->contact->client->service()->getPaymentMethods($amount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(is_array($gateways))
 | 
					        if(is_array($gateways))
 | 
				
			||||||
@ -226,6 +225,6 @@ class InvitationController extends Controller
 | 
				
			|||||||
            return (new InstantPayment($request))->run();
 | 
					            return (new InstantPayment($request))->run();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        abort(404, "Invoice not found");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -129,6 +129,9 @@ class HtmlEngine
 | 
				
			|||||||
        $data['$invoice.datetime'] = &$data['$entity.datetime'];
 | 
					        $data['$invoice.datetime'] = &$data['$entity.datetime'];
 | 
				
			||||||
        $data['$quote.datetime'] = &$data['$entity.datetime'];
 | 
					        $data['$quote.datetime'] = &$data['$entity.datetime'];
 | 
				
			||||||
        $data['$credit.datetime'] = &$data['$entity.datetime'];
 | 
					        $data['$credit.datetime'] = &$data['$entity.datetime'];
 | 
				
			||||||
 | 
					        $data['$payment_button'] = ['value' => '<a class="button" href="'.$this->invitation->getPaymentLink().'">'.ctrans('texts.pay_now').'</a>', 'label' => ctrans('texts.pay_now')];
 | 
				
			||||||
 | 
					        $data['$payment_link'] = ['value' => $this->invitation->getPaymentLink(), 'label' => ctrans('texts.pay_now')];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($this->entity_string == 'invoice' || $this->entity_string == 'recurring_invoice') {
 | 
					        if ($this->entity_string == 'invoice' || $this->entity_string == 'recurring_invoice') {
 | 
				
			||||||
            $data['$entity'] = ['value' => '', 'label' => ctrans('texts.invoice')];
 | 
					            $data['$entity'] = ['value' => '', 'label' => ctrans('texts.invoice')];
 | 
				
			||||||
@ -140,7 +143,7 @@ class HtmlEngine
 | 
				
			|||||||
            $data['$viewLink'] = &$data['$view_link'];
 | 
					            $data['$viewLink'] = &$data['$view_link'];
 | 
				
			||||||
            $data['$viewButton'] = &$data['$view_link'];
 | 
					            $data['$viewButton'] = &$data['$view_link'];
 | 
				
			||||||
            $data['$view_button'] = &$data['$view_link'];
 | 
					            $data['$view_button'] = &$data['$view_link'];
 | 
				
			||||||
            $data['$paymentButton'] = &$data['$view_link'];
 | 
					            $data['$paymentButton'] = &$data['$payment_button'];
 | 
				
			||||||
            $data['$view_url'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_invoice')];
 | 
					            $data['$view_url'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_invoice')];
 | 
				
			||||||
            $data['$date'] = ['value' => $this->translateDate($this->entity->date, $this->entity->client->date_format(), $this->entity->client->locale()) ?: ' ', 'label' => ctrans('texts.invoice_date')];
 | 
					            $data['$date'] = ['value' => $this->translateDate($this->entity->date, $this->entity->client->date_format(), $this->entity->client->locale()) ?: ' ', 'label' => ctrans('texts.invoice_date')];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -457,7 +460,7 @@ class HtmlEngine
 | 
				
			|||||||
        $data['$auto_bill'] = &$data['$autoBill'];
 | 
					        $data['$auto_bill'] = &$data['$autoBill'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*Payment Aliases*/
 | 
					        /*Payment Aliases*/
 | 
				
			||||||
        $data['$paymentLink'] = ['value' => '<a class="button" href="'.$this->invitation->getLink().'">'.ctrans('texts.view_payment').'</a>', 'label' => ctrans('texts.view_payment')];
 | 
					        $data['$paymentLink'] = &$data['$payment_link'];
 | 
				
			||||||
        $data['$portalButton'] = &$data['$paymentLink'];
 | 
					        $data['$portalButton'] = &$data['$paymentLink'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $data['$dir'] = ['value' => optional($this->client->language())->locale === 'ar' ? 'rtl' : 'ltr', 'label' => ''];
 | 
					        $data['$dir'] = ['value' => optional($this->client->language())->locale === 'ar' ? 'rtl' : 'ltr', 'label' => ''];
 | 
				
			||||||
 | 
				
			|||||||
@ -43,6 +43,17 @@ trait Inviteable
 | 
				
			|||||||
        return $status;
 | 
					        return $status;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function getPaymentLink()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if(Ninja::isHosted()){
 | 
				
			||||||
 | 
					            $domain = $this->company->domain();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else
 | 
				
			||||||
 | 
					            $domain = config('ninja.app_url');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return $domain.'/client/pay/'.$this->key;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function getLink() :string
 | 
					    public function getLink() :string
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $entity_type = Str::snake(class_basename($this->entityType()));
 | 
					        $entity_type = Str::snake(class_basename($this->entityType()));
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user