mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2026-01-04 14:00:52 -05:00
* Emails * change to user service * refactor emails * refactor emails * refactor emails * refactor emails * emails * emails * emails * emails * emails * emails * emails * emails * emails * emails * Update EmailPayment.php * Update SendEmail.php * Update SendEmail.php * Update SendEmail.php * Update and rename BuildEmail.php to EmailBuilder.php * Create InvoiceEmail * Create QuoteEmail.php * Rename InvoiceEmail to InvoiceEmail.php * Create PaymentEmail.php * Update SendEmail.php * Update SendEmail.php * Update SendEmail.php * Update SendEmail.php * Update InvoiceEmail.php * Update EmailInvoice.php * Update SendEmail.php * Update TemplateEmail.php * Update EmailBuilder.php * Update InvoiceEmail.php * Update QuoteEmail.php * Update PaymentEmail.php * Update InvoiceEmail.php * Update QuoteEmail.php * Update QuoteInvitation.php * Update EmailQuote.php * Update SendEmail.php * Update SendEmail.php * Update PaymentService.php * Update PaymentEmail.php * Update PaymentEmail.php * Update PaymentEmail.php * Update EmailBuilder.php * Update PaymentEmail.php * Update EmailPayment.php * Update SendEmail.php * Update InvoiceService.php * Update SendEmail.php * Update PaymentService.php * Update SendEmail.php * Update QuoteService.php * Update EmailPayment.php Co-authored-by: David Bomba <turbo124@gmail.com>
53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* payment Ninja (https://paymentninja.com)
|
|
*
|
|
* @link https://github.com/paymentninja/paymentninja source repository
|
|
*
|
|
* @copyright Copyright (c) 2020. payment Ninja LLC (https://paymentninja.com)
|
|
*
|
|
* @license https://opensource.org/licenses/AAL
|
|
*/
|
|
|
|
namespace App\Services\Payment;
|
|
|
|
use App\Factory\PaymentFactory;
|
|
use App\Models\Payment;
|
|
|
|
|
|
class PaymentService
|
|
{
|
|
private $payment;
|
|
|
|
public function __construct($payment)
|
|
{
|
|
$this->payment = $payment;
|
|
}
|
|
|
|
public function manualPayment($invoice) :?Payment
|
|
{
|
|
/* Create Payment */
|
|
$payment = PaymentFactory::create($invoice->company_id, $invoice->user_id);
|
|
|
|
$payment->amount = $invoice->balance;
|
|
$payment->status_id = Payment::STATUS_COMPLETED;
|
|
$payment->client_id = $invoice->client_id;
|
|
$payment->transaction_reference = ctrans('texts.manual_entry');
|
|
/* Create a payment relationship to the invoice entity */
|
|
$payment->save();
|
|
|
|
$payment->invoices()->attach($invoice->id, [
|
|
'amount' => $payment->amount
|
|
]);
|
|
|
|
return $payment;
|
|
}
|
|
|
|
public function sendEmail($contact = null)
|
|
{
|
|
$send_email = new SendEmail($this->payment);
|
|
|
|
return $send_email->run(null, $contact);
|
|
}
|
|
}
|