mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixed autobill message in emails
This commit is contained in:
parent
74e5b80f8c
commit
7c0875841a
@ -272,6 +272,15 @@ class Client extends EntityModel
|
||||
return AccountGatewayToken::clientAndGateway($this->id, $accountGateway->id)->first();
|
||||
}
|
||||
|
||||
public function defaultPaymentMethod()
|
||||
{
|
||||
if ($token = $this->getGatewayToken()) {
|
||||
return $token->default_payment_method;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function autoBillLater()
|
||||
{
|
||||
if ($token = $this->getGatewayToken()) {
|
||||
|
@ -138,12 +138,10 @@ class ContactMailer extends Mailer
|
||||
'amount' => $invoice->getRequestedAmount()
|
||||
];
|
||||
|
||||
/*
|
||||
if ($client->autoBillLater()) {
|
||||
// Let the client know they'll be billed later
|
||||
$variables['autobill'] = $this->createAutoBillNotifyString($invoice->autoBillPaymentMethod);
|
||||
if ($client->autoBillLater()) {
|
||||
$variables['autobill'] = $invoice->present()->autoBillEmailMessage();
|
||||
}
|
||||
*/
|
||||
|
||||
if (empty($invitation->contact->password) && $account->hasFeature(FEATURE_CLIENT_PORTAL_PASSWORD) && $account->enable_portal_password && $account->send_portal_password) {
|
||||
// The contact needs a password
|
||||
@ -282,19 +280,4 @@ class ContactMailer extends Mailer
|
||||
$this->sendTo($email, CONTACT_EMAIL, CONTACT_NAME, $subject, $view, $data);
|
||||
}
|
||||
|
||||
/*
|
||||
private function createAutoBillNotifyString($paymentMethod) {
|
||||
if ($paymentMethod->payment_type_id == PAYMENT_TYPE_DIRECT_DEBIT) {
|
||||
$paymentMethodString = trans('texts.auto_bill_payment_method_bank', ['bank'=>$paymentMethod->getBankName(), 'last4'=>$paymentMethod->last4]);
|
||||
} elseif ($paymentMethod->payment_type_id == PAYMENT_TYPE_PAYPAL) {
|
||||
$paymentMethodString = trans('texts.auto_bill_payment_method_paypal', ['email'=>$paymentMethod->email]);
|
||||
} else {
|
||||
$code = str_replace(' ', '', strtolower($paymentMethod->payment_type->name));
|
||||
$cardType = trans("texts.card_" . $code);
|
||||
$paymentMethodString = trans('texts.auto_bill_payment_method_credit_card', ['type'=>$cardType,'last4'=>$paymentMethod->last4]);
|
||||
}
|
||||
|
||||
return trans('texts.auto_bill_notification', ['payment_method'=>$paymentMethodString]);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ use Exception;
|
||||
|
||||
class WePayPaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
protected $sourceReferenceParam = 'accessToken';
|
||||
|
||||
public function gatewayTypes()
|
||||
{
|
||||
$types = [
|
||||
|
@ -73,4 +73,29 @@ class InvoicePresenter extends EntityPresenter {
|
||||
$client = $this->entity->client;
|
||||
return count($client->contacts) ? $client->contacts[0]->email : '';
|
||||
}
|
||||
|
||||
public function autoBillEmailMessage()
|
||||
{
|
||||
$client = $this->entity->client;
|
||||
$paymentMethod = $client->defaultPaymentMethod();
|
||||
|
||||
if ( ! $paymentMethod) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($paymentMethod->payment_type_id == PAYMENT_TYPE_ACH) {
|
||||
$paymentMethodString = trans('texts.auto_bill_payment_method_bank_transfer');
|
||||
} elseif ($paymentMethod->payment_type_id == PAYMENT_TYPE_PAYPAL) {
|
||||
$paymentMethodString = trans('texts.auto_bill_payment_method_paypal');
|
||||
} else {
|
||||
$paymentMethodString = trans('texts.auto_bill_payment_method_credit_card');
|
||||
}
|
||||
|
||||
$data = [
|
||||
'payment_method' => $paymentMethodString,
|
||||
'due_date' => $this->due_date(),
|
||||
];
|
||||
|
||||
return trans('texts.auto_bill_notification', $data);
|
||||
}
|
||||
}
|
||||
|
@ -1328,11 +1328,11 @@ $LANG = array(
|
||||
'client_session_expired' => 'Session Expired',
|
||||
'client_session_expired_message' => 'Your session has expired. Please click the link in your email again.',
|
||||
|
||||
'auto_bill_notification' => 'This invoice will automatically be billed to :payment_method on the due date.',
|
||||
'auto_bill_payment_method_bank' => 'your :bank account ending in :last4',
|
||||
'auto_bill_payment_method_credit_card' => 'your :type card ending in :last4',
|
||||
'auto_bill_payment_method_paypal' => 'your PayPal account (:email)',
|
||||
'auto_bill_notification_placeholder' => 'This invoice will automatically be billed to your Visa card ending in 4242 on the due date.',
|
||||
'auto_bill_notification' => 'This invoice will automatically be billed to your :payment_method on file on :due_date.',
|
||||
'auto_bill_payment_method_bank_transfer' => 'bank account',
|
||||
'auto_bill_payment_method_credit_card' => 'credit card',
|
||||
'auto_bill_payment_method_paypal' => 'PayPal account',
|
||||
'auto_bill_notification_placeholder' => 'This invoice will automatically be billed to your credit card on file on the due date.',
|
||||
'payment_settings' => 'Payment Settings',
|
||||
|
||||
'on_send_date' => 'On send date',
|
||||
|
Loading…
x
Reference in New Issue
Block a user