Use existing PaymentType instead of CardType
@ -305,7 +305,7 @@ class PublicClientController extends BaseController
|
|||||||
|
|
||||||
public function paymentIndex()
|
public function paymentIndex()
|
||||||
{
|
{
|
||||||
if (!$invitation = $this->getInGvitation()) {
|
if (!$invitation = $this->getInvitation()) {
|
||||||
return $this->returnError();
|
return $this->returnError();
|
||||||
}
|
}
|
||||||
$account = $invitation->account;
|
$account = $invitation->account;
|
||||||
@ -340,12 +340,13 @@ class PublicClientController extends BaseController
|
|||||||
return Datatable::query($payments)
|
return Datatable::query($payments)
|
||||||
->addColumn('invoice_number', function ($model) { return $model->invitation_key ? link_to('/view/'.$model->invitation_key, $model->invoice_number)->toHtml() : $model->invoice_number; })
|
->addColumn('invoice_number', function ($model) { return $model->invitation_key ? link_to('/view/'.$model->invitation_key, $model->invoice_number)->toHtml() : $model->invoice_number; })
|
||||||
->addColumn('transaction_reference', function ($model) { return $model->transaction_reference ? $model->transaction_reference : '<i>Manual entry</i>'; })
|
->addColumn('transaction_reference', function ($model) { return $model->transaction_reference ? $model->transaction_reference : '<i>Manual entry</i>'; })
|
||||||
->addColumn('payment_type', function ($model) { return $model->payment_type ? $model->payment_type : ($model->account_gateway_id ? '<i>Online payment</i>' : ''); })
|
->addColumn('payment_type', function ($model) { return ($model->payment_type && !$model->last4) ? $model->payment_type : ($model->account_gateway_id ? '<i>Online payment</i>' : ''); })
|
||||||
->addColumn('payment_source', function ($model) {
|
->addColumn('payment_source', function ($model) {
|
||||||
if (!$model->card_type_code) return '';
|
if (!$model->last4) return '';
|
||||||
$card_type = trans("texts.card_" . $model->card_type_code);
|
$code = str_replace(' ', '', strtolower($model->payment_type));
|
||||||
|
$card_type = trans("texts.card_" . $code);
|
||||||
$expiration = trans('texts.card_expiration', array('expires'=>Utils::fromSqlDate($model->expiration, false)->format('m/y')));
|
$expiration = trans('texts.card_expiration', array('expires'=>Utils::fromSqlDate($model->expiration, false)->format('m/y')));
|
||||||
return '<img height="22" src="'.URL::to('/images/credit_cards/'.$model->card_type_code.'.png').'" alt="'.htmlentities($card_type).'"> •••'.$model->last4.' '.$expiration;
|
return '<img height="22" src="'.URL::to('/images/credit_cards/'.$code.'.png').'" alt="'.htmlentities($card_type).'"> •••'.$model->last4.' '.$expiration;
|
||||||
})
|
})
|
||||||
->addColumn('amount', function ($model) { return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id); })
|
->addColumn('amount', function ($model) { return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id); })
|
||||||
->addColumn('payment_date', function ($model) { return Utils::dateToString($model->payment_date); })
|
->addColumn('payment_date', function ($model) { return Utils::dateToString($model->payment_date); })
|
||||||
|
@ -482,21 +482,6 @@ if (!defined('CONTACT_EMAIL')) {
|
|||||||
define('PAYMENT_STATUS_PARTIALLY_REFUNDED', 4);
|
define('PAYMENT_STATUS_PARTIALLY_REFUNDED', 4);
|
||||||
define('PAYMENT_STATUS_REFUNDED', 5);
|
define('PAYMENT_STATUS_REFUNDED', 5);
|
||||||
|
|
||||||
define('CARD_UNKNOWN', 0);
|
|
||||||
define('CARD_AMERICAN_EXPRESS', 1);
|
|
||||||
define('CARD_CARTE_BLANCHE', 2);
|
|
||||||
define('CARD_UNIONPAY', 3);
|
|
||||||
define('CARD_DINERS_CLUB', 4);
|
|
||||||
define('CARD_DISCOVER', 5);
|
|
||||||
define('CARD_JCB', 6);
|
|
||||||
define('CARD_LASER', 7);
|
|
||||||
define('CARD_MAESTRO', 8);
|
|
||||||
define('CARD_MASTERCARD', 9);
|
|
||||||
define('CARD_SOLO', 10);
|
|
||||||
define('CARD_SWITCH', 11);
|
|
||||||
define('CARD_VISA', 12);
|
|
||||||
|
|
||||||
define('PAYMENT_TYPE_CREDIT', 1);
|
|
||||||
define('CUSTOM_DESIGN', 11);
|
define('CUSTOM_DESIGN', 11);
|
||||||
|
|
||||||
define('FREQUENCY_WEEKLY', 1);
|
define('FREQUENCY_WEEKLY', 1);
|
||||||
@ -629,6 +614,23 @@ if (!defined('CONTACT_EMAIL')) {
|
|||||||
define('TOKEN_BILLING_OPT_OUT', 3);
|
define('TOKEN_BILLING_OPT_OUT', 3);
|
||||||
define('TOKEN_BILLING_ALWAYS', 4);
|
define('TOKEN_BILLING_ALWAYS', 4);
|
||||||
|
|
||||||
|
define('PAYMENT_TYPE_CREDIT', 1);
|
||||||
|
define('PAYMENT_TYPE_VISA', 6);
|
||||||
|
define('PAYMENT_TYPE_MASTERCARD', 7);
|
||||||
|
define('PAYMENT_TYPE_AMERICAN_EXPRESS', 8);
|
||||||
|
define('PAYMENT_TYPE_DISCOVER', 9);
|
||||||
|
define('PAYMENT_TYPE_DINERS', 10);
|
||||||
|
define('PAYMENT_TYPE_EUROCARD', 11);
|
||||||
|
define('PAYMENT_TYPE_NOVA', 12);
|
||||||
|
define('PAYMENT_TYPE_CREDIT_CARD_OTHER', 13);
|
||||||
|
define('PAYMENT_TYPE_CARTE_BLANCHE', 17);
|
||||||
|
define('PAYMENT_TYPE_UNIONPAY', 18);
|
||||||
|
define('PAYMENT_TYPE_JCB', 19);
|
||||||
|
define('PAYMENT_TYPE_LASER', 20);
|
||||||
|
define('PAYMENT_TYPE_MAESTRO', 21);
|
||||||
|
define('PAYMENT_TYPE_SOLO', 22);
|
||||||
|
define('PAYMENT_TYPE_SWITCH', 23);
|
||||||
|
|
||||||
define('PAYMENT_TYPE_PAYPAL', 'PAYMENT_TYPE_PAYPAL');
|
define('PAYMENT_TYPE_PAYPAL', 'PAYMENT_TYPE_PAYPAL');
|
||||||
define('PAYMENT_TYPE_CREDIT_CARD', 'PAYMENT_TYPE_CREDIT_CARD');
|
define('PAYMENT_TYPE_CREDIT_CARD', 'PAYMENT_TYPE_CREDIT_CARD');
|
||||||
define('PAYMENT_TYPE_DIRECT_DEBIT', 'PAYMENT_TYPE_DIRECT_DEBIT');
|
define('PAYMENT_TYPE_DIRECT_DEBIT', 'PAYMENT_TYPE_DIRECT_DEBIT');
|
||||||
|
@ -1201,7 +1201,7 @@ class Account extends Eloquent
|
|||||||
|
|
||||||
public function showTokenCheckbox(&$storage_gateway = null)
|
public function showTokenCheckbox(&$storage_gateway = null)
|
||||||
{
|
{
|
||||||
if (!$this->getTokenGatewayId()) {
|
if (!($storage_gateway = $this->getTokenGatewayId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
<?php namespace App\Models;
|
|
||||||
|
|
||||||
use Eloquent;
|
|
||||||
|
|
||||||
class CardType extends Eloquent
|
|
||||||
{
|
|
||||||
public $timestamps = false;
|
|
||||||
}
|
|
@ -59,11 +59,6 @@ class Payment extends EntityModel
|
|||||||
return $this->belongsTo('App\Models\PaymentStatus');
|
return $this->belongsTo('App\Models\PaymentStatus');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function card_type()
|
|
||||||
{
|
|
||||||
return $this->belongsTo('App\Models\CardTypes');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRoute()
|
public function getRoute()
|
||||||
{
|
{
|
||||||
return "/payments/{$this->public_id}/edit";
|
return "/payments/{$this->public_id}/edit";
|
||||||
|
@ -23,7 +23,6 @@ class PaymentRepository extends BaseRepository
|
|||||||
->join('invoices', 'invoices.id', '=', 'payments.invoice_id')
|
->join('invoices', 'invoices.id', '=', 'payments.invoice_id')
|
||||||
->join('contacts', 'contacts.client_id', '=', 'clients.id')
|
->join('contacts', 'contacts.client_id', '=', 'clients.id')
|
||||||
->join('payment_statuses', 'payment_statuses.id', '=', 'payments.payment_status_id')
|
->join('payment_statuses', 'payment_statuses.id', '=', 'payments.payment_status_id')
|
||||||
->leftJoin('card_types', 'card_types.id', '=', 'payments.card_type_id')
|
|
||||||
->leftJoin('payment_types', 'payment_types.id', '=', 'payments.payment_type_id')
|
->leftJoin('payment_types', 'payment_types.id', '=', 'payments.payment_type_id')
|
||||||
->leftJoin('account_gateways', 'account_gateways.id', '=', 'payments.account_gateway_id')
|
->leftJoin('account_gateways', 'account_gateways.id', '=', 'payments.account_gateway_id')
|
||||||
->leftJoin('gateways', 'gateways.id', '=', 'account_gateways.gateway_id')
|
->leftJoin('gateways', 'gateways.id', '=', 'account_gateways.gateway_id')
|
||||||
@ -60,8 +59,7 @@ class PaymentRepository extends BaseRepository
|
|||||||
'invoices.is_deleted as invoice_is_deleted',
|
'invoices.is_deleted as invoice_is_deleted',
|
||||||
'gateways.name as gateway_name',
|
'gateways.name as gateway_name',
|
||||||
'gateways.id as gateway_id',
|
'gateways.id as gateway_id',
|
||||||
'payment_statuses.name as payment_status_name',
|
'payment_statuses.name as payment_status_name'
|
||||||
'card_types.code as card_type_code'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!\Session::get('show_trash:payment')) {
|
if (!\Session::get('show_trash:payment')) {
|
||||||
@ -89,7 +87,6 @@ class PaymentRepository extends BaseRepository
|
|||||||
->join('invoices', 'invoices.id', '=', 'payments.invoice_id')
|
->join('invoices', 'invoices.id', '=', 'payments.invoice_id')
|
||||||
->join('contacts', 'contacts.client_id', '=', 'clients.id')
|
->join('contacts', 'contacts.client_id', '=', 'clients.id')
|
||||||
->join('payment_statuses', 'payment_statuses.id', '=', 'payments.payment_status_id')
|
->join('payment_statuses', 'payment_statuses.id', '=', 'payments.payment_status_id')
|
||||||
->leftJoin('card_types', 'card_types.id', '=', 'payments.card_type_id')
|
|
||||||
->leftJoin('invitations', function ($join) {
|
->leftJoin('invitations', function ($join) {
|
||||||
$join->on('invitations.invoice_id', '=', 'invoices.id')
|
$join->on('invitations.invoice_id', '=', 'invoices.id')
|
||||||
->on('invitations.contact_id', '=', 'contacts.id');
|
->on('invitations.contact_id', '=', 'contacts.id');
|
||||||
@ -121,8 +118,7 @@ class PaymentRepository extends BaseRepository
|
|||||||
'payments.expiration',
|
'payments.expiration',
|
||||||
'payments.last4',
|
'payments.last4',
|
||||||
'payments.payment_status_id',
|
'payments.payment_status_id',
|
||||||
'payment_statuses.name as payment_status_name',
|
'payment_statuses.name as payment_status_name'
|
||||||
'card_types.code as card_type_code'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($filter) {
|
if ($filter) {
|
||||||
|
@ -260,7 +260,7 @@ class PaymentService extends BaseService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$payment->expiration = $year . '-' . $card->expiryMonth . '-00';
|
$payment->expiration = $year . '-' . $card->expiryMonth . '-00';
|
||||||
$payment->card_type_id = $this->detectCardType($card->number);
|
$payment->payment_type_id = $this->detectCardType($card->number);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($accountGateway->gateway_id == GATEWAY_STRIPE) {
|
if ($accountGateway->gateway_id == GATEWAY_STRIPE) {
|
||||||
@ -273,18 +273,18 @@ class PaymentService extends BaseService
|
|||||||
$payment->last4 = $card['last4'];
|
$payment->last4 = $card['last4'];
|
||||||
$payment->expiration = $card['exp_year'] . '-' . $card['exp_month'] . '-00';
|
$payment->expiration = $card['exp_year'] . '-' . $card['exp_month'] . '-00';
|
||||||
$stripe_card_types = array(
|
$stripe_card_types = array(
|
||||||
'Visa' => CARD_VISA,
|
'Visa' => PAYMENT_TYPE_VISA,
|
||||||
'American Express' => CARD_AMERICAN_EXPRESS,
|
'American Express' => PAYMENT_TYPE_AMERICAN_EXPRESS,
|
||||||
'MasterCard' => CARD_MASTERCARD,
|
'MasterCard' => PAYMENT_TYPE_MASTERCARD,
|
||||||
'Discover' => CARD_DISCOVER,
|
'Discover' => PAYMENT_TYPE_DISCOVER,
|
||||||
'JCB' => CARD_JCB,
|
'JCB' => PAYMENT_TYPE_JCB,
|
||||||
'Diners Club' => CARD_DINERS_CLUB,
|
'Diners Club' => PAYMENT_TYPE_DINERS,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($stripe_card_types[$card['brand']])) {
|
if (!empty($stripe_card_types[$card['brand']])) {
|
||||||
$payment->card_type_id = $stripe_card_types[$card['brand']];
|
$payment->payment_type_id = $stripe_card_types[$card['brand']];
|
||||||
} else {
|
} else {
|
||||||
$payment->card_type_id = CARD_UNKNOWN;
|
$payment->payment_type_id = PAYMENT_TYPE_CREDIT_CARD_OTHER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($accountGateway->gateway_id == GATEWAY_BRAINTREE) {
|
} elseif ($accountGateway->gateway_id == GATEWAY_BRAINTREE) {
|
||||||
@ -293,24 +293,24 @@ class PaymentService extends BaseService
|
|||||||
$payment->expiration = $card->expirationYear . '-' . $card->expirationMonth . '-00';
|
$payment->expiration = $card->expirationYear . '-' . $card->expirationMonth . '-00';
|
||||||
|
|
||||||
$braintree_card_types = array(
|
$braintree_card_types = array(
|
||||||
'Visa' => CARD_VISA,
|
'Visa' => PAYMENT_TYPE_VISA,
|
||||||
'American Express' => CARD_AMERICAN_EXPRESS,
|
'American Express' => PAYMENT_TYPE_AMERICAN_EXPRESS,
|
||||||
'MasterCard' => CARD_MASTERCARD,
|
'MasterCard' => PAYMENT_TYPE_MASTERCARD,
|
||||||
'Discover' => CARD_DISCOVER,
|
'Discover' => PAYMENT_TYPE_DISCOVER,
|
||||||
'JCB' => CARD_JCB,
|
'JCB' => PAYMENT_TYPE_JCB,
|
||||||
'Diners Club' => CARD_DINERS_CLUB,
|
'Diners Club' => PAYMENT_TYPE_DINERS,
|
||||||
'Carte Blanche' => CARD_CARTE_BLANCHE,
|
'Carte Blanche' => PAYMENT_TYPE_CARTE_BLANCHE,
|
||||||
'China UnionPay' => CARD_UNIONPAY,
|
'China UnionPay' => PAYMENT_TYPE_UNIONPAY,
|
||||||
'Laser' => CARD_LASER,
|
'Laser' => PAYMENT_TYPE_LASER,
|
||||||
'Maestro' => CARD_MAESTRO,
|
'Maestro' => PAYMENT_TYPE_MAESTRO,
|
||||||
'Solo' => CARD_SOLO,
|
'Solo' => PAYMENT_TYPE_SOLO,
|
||||||
'Switch' => CARD_SWITCH,
|
'Switch' => PAYMENT_TYPE_SWITCH,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($braintree_card_types[$card->cardType])) {
|
if (!empty($braintree_card_types[$card->cardType])) {
|
||||||
$payment->card_type_id = $braintree_card_types[$card->cardType];
|
$payment->payment_type_id = $braintree_card_types[$card->cardType];
|
||||||
} else {
|
} else {
|
||||||
$payment->card_type_id = CARD_UNKNOWN;
|
$payment->payment_type_id = PAYMENT_TYPE_CREDIT_CARD_OTHER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,19 +379,19 @@ class PaymentService extends BaseService
|
|||||||
private function detectCardType($number)
|
private function detectCardType($number)
|
||||||
{
|
{
|
||||||
if (preg_match('/^3[47][0-9]{13}$/',$number)) {
|
if (preg_match('/^3[47][0-9]{13}$/',$number)) {
|
||||||
return CARD_AMERICAN_EXPRESS;
|
return PAYMENT_TYPE_AMERICAN_EXPRESS;
|
||||||
} elseif (preg_match('/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/',$number)) {
|
} elseif (preg_match('/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/',$number)) {
|
||||||
return CARD_DINERS_CLUB;
|
return PAYMENT_TYPE_DINERS;
|
||||||
} elseif (preg_match('/^6(?:011|5[0-9][0-9])[0-9]{12}$/',$number)) {
|
} elseif (preg_match('/^6(?:011|5[0-9][0-9])[0-9]{12}$/',$number)) {
|
||||||
return CARD_DISCOVER;
|
return PAYMENT_TYPE_DISCOVER;
|
||||||
} elseif (preg_match('/^(?:2131|1800|35\d{3})\d{11}$/',$number)) {
|
} elseif (preg_match('/^(?:2131|1800|35\d{3})\d{11}$/',$number)) {
|
||||||
return CARD_JCB;
|
return PAYMENT_TYPE_JCB;
|
||||||
} elseif (preg_match('/^5[1-5][0-9]{14}$/',$number)) {
|
} elseif (preg_match('/^5[1-5][0-9]{14}$/',$number)) {
|
||||||
return CARD_MASTERCARD;
|
return PAYMENT_TYPE_MASTERCARD;
|
||||||
} elseif (preg_match('/^4[0-9]{12}(?:[0-9]{3})?$/',$number)) {
|
} elseif (preg_match('/^4[0-9]{12}(?:[0-9]{3})?$/',$number)) {
|
||||||
return CARD_VISA;
|
return PAYMENT_TYPE_VISA;
|
||||||
}
|
}
|
||||||
return CARD_UNKNOWN;
|
return PAYMENT_TYPE_CREDIT_CARD_OTHER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function completePurchase($gateway, $accountGateway, $details, $token)
|
public function completePurchase($gateway, $accountGateway, $details, $token)
|
||||||
@ -488,16 +488,17 @@ class PaymentService extends BaseService
|
|||||||
[
|
[
|
||||||
'payment_type',
|
'payment_type',
|
||||||
function ($model) {
|
function ($model) {
|
||||||
return $model->payment_type ? $model->payment_type : ($model->account_gateway_id ? $model->gateway_name : '');
|
return ($model->payment_type && !$model->last4) ? $model->payment_type : ($model->account_gateway_id ? $model->gateway_name : '');
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'source',
|
'source',
|
||||||
function ($model) {
|
function ($model) {
|
||||||
if (!$model->card_type_code) return '';
|
if (!$model->last4) return '';
|
||||||
$card_type = trans("texts.card_" . $model->card_type_code);
|
$code = str_replace(' ', '', strtolower($model->payment_type));
|
||||||
|
$card_type = trans("texts.card_" . $code);
|
||||||
$expiration = trans('texts.card_expiration', array('expires'=>Utils::fromSqlDate($model->expiration, false)->format('m/y')));
|
$expiration = trans('texts.card_expiration', array('expires'=>Utils::fromSqlDate($model->expiration, false)->format('m/y')));
|
||||||
return '<img height="22" src="'.URL::to('/images/credit_cards/'.$model->card_type_code.'.png').'" alt="'.htmlentities($card_type).'"> •••'.$model->last4.' '.$expiration;
|
return '<img height="22" src="'.URL::to('/images/credit_cards/'.$code.'.png').'" alt="'.htmlentities($card_type).'"> •••'.$model->last4.' '.$expiration;
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -13,7 +13,6 @@ class PaymentsChanges extends Migration
|
|||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('payment_statuses');
|
Schema::dropIfExists('payment_statuses');
|
||||||
Schema::dropIfExists('card_types');
|
|
||||||
|
|
||||||
Schema::create('payment_statuses', function($table)
|
Schema::create('payment_statuses', function($table)
|
||||||
{
|
{
|
||||||
@ -21,15 +20,7 @@ class PaymentsChanges extends Migration
|
|||||||
$table->string('name');
|
$table->string('name');
|
||||||
});
|
});
|
||||||
|
|
||||||
Schema::create('card_types', function($table)
|
|
||||||
{
|
|
||||||
$table->increments('id');
|
|
||||||
$table->string('name');
|
|
||||||
$table->string('code');
|
|
||||||
});
|
|
||||||
|
|
||||||
(new \PaymentStatusSeeder())->run();
|
(new \PaymentStatusSeeder())->run();
|
||||||
(new \CardTypesSeeder())->run();
|
|
||||||
|
|
||||||
Schema::table('payments', function($table)
|
Schema::table('payments', function($table)
|
||||||
{
|
{
|
||||||
@ -40,8 +31,6 @@ class PaymentsChanges extends Migration
|
|||||||
$table->unsignedInteger('routing_number')->nullable();
|
$table->unsignedInteger('routing_number')->nullable();
|
||||||
$table->smallInteger('last4')->unsigned()->nullable();
|
$table->smallInteger('last4')->unsigned()->nullable();
|
||||||
$table->date('expiration')->nullable();
|
$table->date('expiration')->nullable();
|
||||||
$table->unsignedInteger('card_type_id')->nullable();
|
|
||||||
$table->foreign('card_type_id')->references('id')->on('card_types');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,11 +50,8 @@ class PaymentsChanges extends Migration
|
|||||||
$table->dropColumn('routing_number');
|
$table->dropColumn('routing_number');
|
||||||
$table->dropColumn('last4');
|
$table->dropColumn('last4');
|
||||||
$table->dropColumn('expiration');
|
$table->dropColumn('expiration');
|
||||||
$table->dropForeign('card_type_id_foreign');
|
|
||||||
$table->dropColumn('card_type_id');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Schema::dropIfExists('payment_statuses');
|
Schema::dropIfExists('payment_statuses');
|
||||||
Schema::dropIfExists('card_types');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use App\Models\CardType;
|
|
||||||
|
|
||||||
class CardTypesSeeder extends Seeder
|
|
||||||
{
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
Eloquent::unguard();
|
|
||||||
|
|
||||||
$this->createPaymentSourceTypes();
|
|
||||||
|
|
||||||
Eloquent::reguard();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function createPaymentSourceTypes()
|
|
||||||
{
|
|
||||||
$statuses = [
|
|
||||||
['id' => '0', 'name' => 'Unknown', 'code'=>'unknown']
|
|
||||||
['id' => '1', 'name' => 'American Express', 'code'=>'amex'],
|
|
||||||
['id' => '2', 'name' => 'Carte Blanche', 'code'=>'carteblanche'],
|
|
||||||
['id' => '3', 'name' => 'China UnionPay', 'code'=>'unionpay'],
|
|
||||||
['id' => '4', 'name' => 'Diners Club', 'code'=>'diners'],
|
|
||||||
['id' => '5', 'name' => 'Discover', 'code'=>'discover'],
|
|
||||||
['id' => '6', 'name' => 'JCB', 'code'=>'jcb'],
|
|
||||||
['id' => '7', 'name' => 'Laser', 'code'=>'laser'],
|
|
||||||
['id' => '8', 'name' => 'Maestro', 'code'=>'maestro'],
|
|
||||||
['id' => '9', 'name' => 'MasterCard', 'code'=>'mastercard'],
|
|
||||||
['id' => '10', 'name' => 'Solo', 'code'=>'solo'],
|
|
||||||
['id' => '11', 'name' => 'Switch', 'code'=>'switch'],
|
|
||||||
['id' => '12', 'name' => 'Visa', 'code'=>'visa'],
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($statuses as $status) {
|
|
||||||
$record = CardType::find($status['id']);
|
|
||||||
if ($record) {
|
|
||||||
$record->name = $status['name'];
|
|
||||||
$record->save();
|
|
||||||
} else {
|
|
||||||
CardType::create($status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -20,23 +20,6 @@ class ConstantsSeeder extends Seeder
|
|||||||
|
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
PaymentType::create(array('name' => 'Apply Credit'));
|
|
||||||
PaymentType::create(array('name' => 'Bank Transfer'));
|
|
||||||
PaymentType::create(array('name' => 'Cash'));
|
|
||||||
PaymentType::create(array('name' => 'Debit'));
|
|
||||||
PaymentType::create(array('name' => 'ACH'));
|
|
||||||
PaymentType::create(array('name' => 'Visa Card'));
|
|
||||||
PaymentType::create(array('name' => 'MasterCard'));
|
|
||||||
PaymentType::create(array('name' => 'American Express'));
|
|
||||||
PaymentType::create(array('name' => 'Discover Card'));
|
|
||||||
PaymentType::create(array('name' => 'Diners Card'));
|
|
||||||
PaymentType::create(array('name' => 'EuroCard'));
|
|
||||||
PaymentType::create(array('name' => 'Nova'));
|
|
||||||
PaymentType::create(array('name' => 'Credit Card Other'));
|
|
||||||
PaymentType::create(array('name' => 'PayPal'));
|
|
||||||
PaymentType::create(array('name' => 'Google Wallet'));
|
|
||||||
PaymentType::create(array('name' => 'Check'));
|
|
||||||
|
|
||||||
Theme::create(array('name' => 'amelia'));
|
Theme::create(array('name' => 'amelia'));
|
||||||
Theme::create(array('name' => 'cerulean'));
|
Theme::create(array('name' => 'cerulean'));
|
||||||
Theme::create(array('name' => 'cosmo'));
|
Theme::create(array('name' => 'cosmo'));
|
||||||
|
@ -20,10 +20,10 @@ class DatabaseSeeder extends Seeder
|
|||||||
$this->call('BanksSeeder');
|
$this->call('BanksSeeder');
|
||||||
$this->call('InvoiceStatusSeeder');
|
$this->call('InvoiceStatusSeeder');
|
||||||
$this->call('PaymentStatusSeeder');
|
$this->call('PaymentStatusSeeder');
|
||||||
$this->call('CardTypesSeeder');
|
|
||||||
$this->call('CurrenciesSeeder');
|
$this->call('CurrenciesSeeder');
|
||||||
$this->call('DateFormatsSeeder');
|
$this->call('DateFormatsSeeder');
|
||||||
$this->call('InvoiceDesignsSeeder');
|
$this->call('InvoiceDesignsSeeder');
|
||||||
$this->call('PaymentTermsSeeder');
|
$this->call('PaymentTermsSeeder');
|
||||||
|
$this->call('PaymentTypesSeeder');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
44
database/seeds/PaymentTypesSeeder.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\PaymentType;
|
||||||
|
|
||||||
|
class PaymentTypesSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
Eloquent::unguard();
|
||||||
|
|
||||||
|
$paymentTypes = [
|
||||||
|
array('name' => 'Apply Credit'),
|
||||||
|
array('name' => 'Bank Transfer'),
|
||||||
|
array('name' => 'Cash'),
|
||||||
|
array('name' => 'Debit'),
|
||||||
|
array('name' => 'ACH'),
|
||||||
|
array('name' => 'Visa Card'),
|
||||||
|
array('name' => 'MasterCard'),
|
||||||
|
array('name' => 'American Express'),
|
||||||
|
array('name' => 'Discover Card'),
|
||||||
|
array('name' => 'Diners Card'),
|
||||||
|
array('name' => 'EuroCard'),
|
||||||
|
array('name' => 'Nova'),
|
||||||
|
array('name' => 'Credit Card Other'),
|
||||||
|
array('name' => 'PayPal'),
|
||||||
|
array('name' => 'Google Wallet'),
|
||||||
|
array('name' => 'Check'),
|
||||||
|
array('name' => 'Carte Blanche'),
|
||||||
|
array('name' => 'UnionPay'),
|
||||||
|
array('name' => 'JCB'),
|
||||||
|
array('name' => 'Laser'),
|
||||||
|
array('name' => 'Maestro'),
|
||||||
|
array('name' => 'Solo'),
|
||||||
|
array('name' => 'Switch'),
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($paymentTypes as $paymentType) {
|
||||||
|
if (!DB::table('payment_types')->where('name', '=', $paymentType['name'])->get()) {
|
||||||
|
PaymentType::create($paymentType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -16,10 +16,10 @@ class UpdateSeeder extends Seeder
|
|||||||
$this->call('BanksSeeder');
|
$this->call('BanksSeeder');
|
||||||
$this->call('InvoiceStatusSeeder');
|
$this->call('InvoiceStatusSeeder');
|
||||||
$this->call('PaymentStatusSeeder');
|
$this->call('PaymentStatusSeeder');
|
||||||
$this->call('CardTypesSeeder');
|
|
||||||
$this->call('CurrenciesSeeder');
|
$this->call('CurrenciesSeeder');
|
||||||
$this->call('DateFormatsSeeder');
|
$this->call('DateFormatsSeeder');
|
||||||
$this->call('InvoiceDesignsSeeder');
|
$this->call('InvoiceDesignsSeeder');
|
||||||
$this->call('PaymentTermsSeeder');
|
$this->call('PaymentTermsSeeder');
|
||||||
|
$this->call('PaymentTypesSeeder');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
@ -1192,8 +1192,8 @@ $LANG = array(
|
|||||||
'activity_39' => ':user refunded :adjustment of a :payment_amount payment (:payment)',
|
'activity_39' => ':user refunded :adjustment of a :payment_amount payment (:payment)',
|
||||||
'card_expiration' => 'Exp: :expires',
|
'card_expiration' => 'Exp: :expires',
|
||||||
|
|
||||||
'card_unknown' => 'Unknown',
|
'card_creditcardother' => 'Unknown',
|
||||||
'card_amex' => 'American Express',
|
'card_americanexpress' => 'American Express',
|
||||||
'card_carteblanche' => 'Carte Blanche',
|
'card_carteblanche' => 'Carte Blanche',
|
||||||
'card_unionpay' => 'UnionPay',
|
'card_unionpay' => 'UnionPay',
|
||||||
'card_diners' => 'Diners Club',
|
'card_diners' => 'Diners Club',
|
||||||
@ -1204,7 +1204,7 @@ $LANG = array(
|
|||||||
'card_mastercard' => 'MasterCard',
|
'card_mastercard' => 'MasterCard',
|
||||||
'card_solo' => 'Solo',
|
'card_solo' => 'Solo',
|
||||||
'card_switch' => 'Switch',
|
'card_switch' => 'Switch',
|
||||||
'card_visa' => 'Visa',
|
'card_visacard' => 'Visa',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $LANG;
|
return $LANG;
|
||||||
|
@ -367,7 +367,7 @@
|
|||||||
|
|
||||||
<div class="row" style="padding-top:18px">
|
<div class="row" style="padding-top:18px">
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
@if ($client && $account->showTokenCheckbox($storageGateway))
|
@if ($client && $account->showTokenCheckbox($storageGateway/* will contain gateway id */))
|
||||||
<input id="token_billing" type="checkbox" name="token_billing" {{ $account->selectTokenCheckbox() ? 'CHECKED' : '' }} value="1" style="margin-left:0px; vertical-align:top">
|
<input id="token_billing" type="checkbox" name="token_billing" {{ $account->selectTokenCheckbox() ? 'CHECKED' : '' }} value="1" style="margin-left:0px; vertical-align:top">
|
||||||
<label for="token_billing" class="checkbox" style="display: inline;">{{ trans('texts.token_billing') }}</label>
|
<label for="token_billing" class="checkbox" style="display: inline;">{{ trans('texts.token_billing') }}</label>
|
||||||
<span class="help-block" style="font-size:15px">
|
<span class="help-block" style="font-size:15px">
|
||||||
|