added functionallity to company/payments page
@ -133,6 +133,13 @@ class AccountController extends \BaseController {
|
|||||||
$recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
|
$recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$creditCardsArray = unserialize(CREDIT_CARDS);
|
||||||
|
$creditCards = [];
|
||||||
|
foreach($creditCardsArray as $card => $name)
|
||||||
|
{
|
||||||
|
$creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])];
|
||||||
|
}
|
||||||
|
|
||||||
$otherItem = array(
|
$otherItem = array(
|
||||||
'value' => 1000000,
|
'value' => 1000000,
|
||||||
'other' => 'true',
|
'other' => 'true',
|
||||||
@ -153,6 +160,7 @@ class AccountController extends \BaseController {
|
|||||||
->orderBy('name')
|
->orderBy('name')
|
||||||
->get(),
|
->get(),
|
||||||
'recommendedGateways' => $recommendedGatewayArray,
|
'recommendedGateways' => $recommendedGatewayArray,
|
||||||
|
'creditCardTypes' => $creditCards,
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($data['gateways'] as $gateway)
|
foreach ($data['gateways'] as $gateway)
|
||||||
|
@ -229,8 +229,6 @@ class PaymentController extends \BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** HÄR SKALL DET HÄMTAS UT BILDER!!!!! **/
|
|
||||||
public function show_payment($invitationKey)
|
public function show_payment($invitationKey)
|
||||||
{
|
{
|
||||||
// For PayPal Express we redirect straight to their site
|
// For PayPal Express we redirect straight to their site
|
||||||
@ -253,11 +251,10 @@ class PaymentController extends \BaseController
|
|||||||
$invitation = Invitation::with('invoice.invoice_items', 'invoice.client.currency', 'invoice.client.account.account_gateways.gateway')->where('invitation_key', '=', $invitationKey)->firstOrFail();
|
$invitation = Invitation::with('invoice.invoice_items', 'invoice.client.currency', 'invoice.client.account.account_gateways.gateway')->where('invitation_key', '=', $invitationKey)->firstOrFail();
|
||||||
$invoice = $invitation->invoice;
|
$invoice = $invitation->invoice;
|
||||||
$client = $invoice->client;
|
$client = $invoice->client;
|
||||||
|
$accountGateway = $invoice->client->account->account_gateways[0];
|
||||||
$gateway = $invoice->client->account->account_gateways[0]->gateway;
|
$gateway = $invoice->client->account->account_gateways[0]->gateway;
|
||||||
$paymentLibrary = $gateway->paymentlibrary;
|
$paymentLibrary = $gateway->paymentlibrary;
|
||||||
|
$acceptedCreditCardTypes = $accountGateway->getCreditcardTypes();
|
||||||
$mask = $invoice->client->account->account_gateways[0]->accepted_credit_cards;
|
|
||||||
$acceptedCreditCardTypes = Utils::getCreditcardTypes($mask);
|
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'showBreadcrumbs' => false,
|
'showBreadcrumbs' => false,
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
**/
|
**/
|
||||||
class SecurePaymentFormSeeder extends Seeder
|
class SecurePaymentFormSeeder extends Seeder
|
||||||
{
|
{
|
||||||
|
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
Eloquent::unguard();
|
Eloquent::unguard();
|
||||||
@ -28,83 +27,161 @@ class SecurePaymentFormSeeder extends Seeder
|
|||||||
|
|
||||||
DB::unprepared($statement);
|
DB::unprepared($statement);
|
||||||
|
|
||||||
$firstName = 'Oscar';
|
//$firstName = 'Oscar';
|
||||||
$lastName = 'Thompson';
|
// $lastName = 'Thompson';
|
||||||
|
// $firstName_2 = 'Philip';
|
||||||
$user = AccountGateway::create(array(
|
// $lastName_2 = 'Jonsson';
|
||||||
'account_id' => 1,
|
//
|
||||||
'user_id' => 1,
|
// $user = AccountGateway::create(array(
|
||||||
'gateway_id' => 4,
|
// 'account_id' => 1,
|
||||||
'config' => 'bla bla bla bla bla bla bla',
|
// 'user_id' => 1,
|
||||||
'public_id' => 1,
|
// 'gateway_id' => 4,
|
||||||
'accepted_credit_cards' => 18
|
// 'config' => '{"bla":"vla","bli":"cla"}',
|
||||||
));
|
// 'public_id' => 1,
|
||||||
|
// 'accepted_credit_cards' => 8
|
||||||
$client = Client::create(array(
|
// ));
|
||||||
'user_id' => 1,
|
//
|
||||||
'account_id' => 1,
|
// $user2 = AccountGateway::create(array(
|
||||||
'currency_id' => 1,
|
// 'account_id' => 2,
|
||||||
'name' => $firstName.' '.$lastName,
|
// 'user_id' => 2,
|
||||||
'address1' => '2119 Howe Course',
|
// 'gateway_id' => 5,
|
||||||
'address2' => '2118 Howe Course',
|
// 'config' => '{"bla":"vla","bli":"cla"}',
|
||||||
'city' => 'West Chazport',
|
// 'public_id' => 2,
|
||||||
'state' => 'Utah',
|
// 'accepted_credit_cards' => 7
|
||||||
'postal_code' => '31572',
|
// ));
|
||||||
'country_id' => 752,
|
//
|
||||||
'work_phone' => '012-345678',
|
// $client = Client::create(array(
|
||||||
'private_notes' => 'bla bla bla bla bla bla bla',
|
// 'user_id' => 1,
|
||||||
'balance' => 10.4,
|
// 'account_id' => 1,
|
||||||
'paid_to_date' => 10.2,
|
// 'currency_id' => 1,
|
||||||
'website' => 'awebsite.com',
|
// 'name' => $firstName.' '.$lastName,
|
||||||
'industry_id' => 8,
|
// 'address1' => '2119 Howe Course',
|
||||||
'is_deleted' => 0,
|
// 'address2' => '2118 Howe Course',
|
||||||
'payment_terms' => 2,
|
// 'city' => 'West Chazport',
|
||||||
'public_id' => 1,
|
// 'state' => 'Utah',
|
||||||
'custom_value1' => $firstName,
|
// 'postal_code' => '31572',
|
||||||
'custom_value2' => $firstName
|
// 'country_id' => 752,
|
||||||
));
|
// 'work_phone' => '012-345678',
|
||||||
|
// 'private_notes' => 'bla bla bla bla bla bla bla',
|
||||||
$contact = Contact::create(array(
|
// 'balance' => 10.4,
|
||||||
'account_id' => 1,
|
// 'paid_to_date' => 10.2,
|
||||||
'user_id' => 1,
|
// 'website' => 'awebsite.com',
|
||||||
'client_id' => 1,
|
// 'industry_id' => 8,
|
||||||
'is_primary' => 0,
|
// 'is_deleted' => 0,
|
||||||
'send_invoice' => 0,
|
// 'payment_terms' => 2,
|
||||||
'first_name' => $firstName,
|
// 'public_id' => 1,
|
||||||
'last_name' => $lastName,
|
// 'custom_value1' => $firstName,
|
||||||
'email' => 'an@email.com',
|
// 'custom_value2' => $firstName
|
||||||
'phone' => '012-345678',
|
// ));
|
||||||
'public_id' => 1
|
//
|
||||||
));
|
// $client2 = Client::create(array(
|
||||||
|
// 'user_id' => 2,
|
||||||
$invoice = Invoice::create(array(
|
// 'account_id' => 2,
|
||||||
'client_id' => 1,
|
// 'currency_id' => 1,
|
||||||
'user_id' => 1,
|
// 'name' => $firstName_2.' '.$lastName_2,
|
||||||
'account_id' => 1,
|
// 'address1' => '1118 Muma Road',
|
||||||
'invoice_number' => 1,
|
// 'address2' => '1118 Muma Road',
|
||||||
'discount' => 0.4,
|
// 'city' => 'New Orleans',
|
||||||
'po_number' => $firstName,
|
// 'state' => 'Arizona',
|
||||||
'terms' => 'bla bla bla bla bla bla bla',
|
// 'postal_code' => '31572',
|
||||||
'public_notes' => 'bla bla bla bla bla bla bla',
|
// 'country_id' => 752,
|
||||||
'is_deleted' => 0,
|
// 'work_phone' => '012-345678',
|
||||||
'is_recurring' => 0,
|
// 'private_notes' => 'bla bla bla bla bla bla bla',
|
||||||
'frequency_id' => 1,
|
// 'balance' => 10.4,
|
||||||
'tax_name' => 'moms',
|
// 'paid_to_date' => 10.2,
|
||||||
'tax_rate' => 33.0,
|
// 'website' => 'bodosite.com',
|
||||||
'amount' => 10.0,
|
// 'industry_id' => 8,
|
||||||
'balance' => 8.0,
|
// 'is_deleted' => 0,
|
||||||
'public_id' => 1,
|
// 'payment_terms' => 2,
|
||||||
'is_quote' => 0
|
// 'public_id' => 1,
|
||||||
));
|
// 'custom_value1' => $firstName_2,
|
||||||
|
// 'custom_value2' => $firstName_2
|
||||||
$invitation = Invitation::create(array(
|
// ));
|
||||||
'account_id' => 1,
|
//
|
||||||
'user_id' => 1,
|
// $contact = Contact::create(array(
|
||||||
'contact_id' => 1,
|
// 'account_id' => 1,
|
||||||
'invoice_id' => 1,
|
// 'user_id' => 1,
|
||||||
'invitation_key' => 'aaabbb',
|
// 'client_id' => 1,
|
||||||
'transaction_reference' => 'bla bla bla bla bla bla bla',
|
// 'is_primary' => 0,
|
||||||
'public_id' => 1
|
// 'send_invoice' => 0,
|
||||||
));
|
// 'first_name' => $firstName,
|
||||||
|
// 'last_name' => $lastName,
|
||||||
|
// 'email' => 'an@email.com',
|
||||||
|
// 'phone' => '012-345678',
|
||||||
|
// 'public_id' => 1
|
||||||
|
// ));
|
||||||
|
//
|
||||||
|
// $contact2 = Contact::create(array(
|
||||||
|
// 'account_id' => 2,
|
||||||
|
// 'user_id' => 2,
|
||||||
|
// 'client_id' => 2,
|
||||||
|
// 'is_primary' => 0,
|
||||||
|
// 'send_invoice' => 0,
|
||||||
|
// 'first_name' => $firstName_2,
|
||||||
|
// 'last_name' => $lastName_2,
|
||||||
|
// 'email' => 'the@email.com',
|
||||||
|
// 'phone' => '012-345678',
|
||||||
|
// 'public_id' => 2
|
||||||
|
// ));
|
||||||
|
//
|
||||||
|
// $invoice = Invoice::create(array(
|
||||||
|
// 'client_id' => 1,
|
||||||
|
// 'user_id' => 1,
|
||||||
|
// 'account_id' => 1,
|
||||||
|
// 'invoice_number' => 1,
|
||||||
|
// 'discount' => 0.4,
|
||||||
|
// 'po_number' => $firstName,
|
||||||
|
// 'terms' => 'bla bla bla bla bla bla bla',
|
||||||
|
// 'public_notes' => 'bla bla bla bla bla bla bla',
|
||||||
|
// 'is_deleted' => 0,
|
||||||
|
// 'is_recurring' => 0,
|
||||||
|
// 'frequency_id' => 1,
|
||||||
|
// 'tax_name' => 'moms',
|
||||||
|
// 'tax_rate' => 33.0,
|
||||||
|
// 'amount' => 10.0,
|
||||||
|
// 'balance' => 8.0,
|
||||||
|
// 'public_id' => 1,
|
||||||
|
// 'is_quote' => 0
|
||||||
|
// ));
|
||||||
|
//
|
||||||
|
// $invoice2 = Invoice::create(array(
|
||||||
|
// 'client_id' => 2,
|
||||||
|
// 'user_id' => 2,
|
||||||
|
// 'account_id' => 2,
|
||||||
|
// 'invoice_number' => 2,
|
||||||
|
// 'discount' => 0.4,
|
||||||
|
// 'po_number' => $firstName_2,
|
||||||
|
// 'terms' => 'bla bla bla bla bla bla bla',
|
||||||
|
// 'public_notes' => 'bla bla bla bla bla bla bla',
|
||||||
|
// 'is_deleted' => 0,
|
||||||
|
// 'is_recurring' => 0,
|
||||||
|
// 'frequency_id' => 1,
|
||||||
|
// 'tax_name' => 'moms',
|
||||||
|
// 'tax_rate' => 33.0,
|
||||||
|
// 'amount' => 10.0,
|
||||||
|
// 'balance' => 8.0,
|
||||||
|
// 'public_id' => 2,
|
||||||
|
// 'is_quote' => 0
|
||||||
|
// ));
|
||||||
|
//
|
||||||
|
// $invitation = Invitation::create(array(
|
||||||
|
// 'account_id' => 1,
|
||||||
|
// 'user_id' => 1,
|
||||||
|
// 'contact_id' => 1,
|
||||||
|
// 'invoice_id' => 1,
|
||||||
|
// 'invitation_key' => 'aaabbb',
|
||||||
|
// 'transaction_reference' => 'bla bla bla bla bla bla bla',
|
||||||
|
// 'public_id' => 1
|
||||||
|
// ));
|
||||||
|
//
|
||||||
|
// $invitation2 = Invitation::create(array(
|
||||||
|
// 'account_id' => 2,
|
||||||
|
// 'user_id' => 2,
|
||||||
|
// 'contact_id' => 2,
|
||||||
|
// 'invoice_id' => 2,
|
||||||
|
// 'invitation_key' => 'cccddd',
|
||||||
|
// 'transaction_reference' => 'bla bla bla bla bla bla bla',
|
||||||
|
// 'public_id' => 2
|
||||||
|
// ));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -441,40 +441,4 @@ class Utils
|
|||||||
|
|
||||||
return $message;
|
return $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCreditcardTypes($mask)
|
|
||||||
{
|
|
||||||
$arrayOfImages = [];
|
|
||||||
|
|
||||||
$flags = [
|
|
||||||
CREDIT_CARD_VISA => ['card' => 'Visa', 'text' => 'Visa'],
|
|
||||||
CREDIT_CARD_MASTER_CARD => ['card' => 'MasterCard', 'text' => 'Master Card'],
|
|
||||||
CREDIT_CARD_AMERICAN_EXPRESS => ['card' => 'AmericanExpress', 'text' => 'American Express'],
|
|
||||||
CREDIT_CARD_DINERS => ['card' => 'Diners', 'text' => 'Diners'],
|
|
||||||
CREDIT_CARD_DISCOVER => ['card' => 'Discover', 'text' => 'Discover']
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($flags as $card => $name)
|
|
||||||
{
|
|
||||||
if (($mask & $card) == $card)
|
|
||||||
$arrayOfImages[] = ['source' => asset('images/Test-'.$name['card'].'-Icon.png'), 'alt' => $name['text']];
|
|
||||||
}
|
|
||||||
|
|
||||||
//if($mask & CREDIT_CARD_VISA)
|
|
||||||
// array_push($arrayOfImages, ['source' => asset('images/Test-Visa-Icon.png'), 'alt' => 'Visa']);
|
|
||||||
//
|
|
||||||
// if($mask & CREDIT_CARD_MASTER_CARD)
|
|
||||||
// array_push($arrayOfImages, ['source' => asset('images/Test-MasterCard-Icon.png'), 'alt' => 'Master Card']);
|
|
||||||
//
|
|
||||||
// if($mask & CREDIT_CARD_AMERICAN_EXPRESS)
|
|
||||||
// array_push($arrayOfImages, ['source' => asset('images/Test-AmericanExpress-Icon.png'), 'alt' => 'American Express']);
|
|
||||||
//
|
|
||||||
// if($mask & CREDIT_CARD_DINERS)
|
|
||||||
// array_push($arrayOfImages, ['source' => asset('images/Test-Diners-Icon.png'), 'alt' => 'Diners']);
|
|
||||||
//
|
|
||||||
// if($mask & CREDIT_CARD_DISCOVER)
|
|
||||||
// array_push($arrayOfImages, ['source' => asset('images/Test-Discover-Icon.png'), 'alt' => 'Discover']);
|
|
||||||
|
|
||||||
return $arrayOfImages;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -6,4 +6,18 @@ class AccountGateway extends EntityModel
|
|||||||
{
|
{
|
||||||
return $this->belongsTo('Gateway');
|
return $this->belongsTo('Gateway');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCreditcardTypes()
|
||||||
|
{
|
||||||
|
$flags = unserialize(CREDIT_CARDS);
|
||||||
|
$arrayOfImages = [];
|
||||||
|
|
||||||
|
foreach ($flags as $card => $name)
|
||||||
|
{
|
||||||
|
if (($this->accepted_credit_cards & $card) == $card)
|
||||||
|
$arrayOfImages[] = ['source' => asset($name['card']), 'alt' => $name['text']];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arrayOfImages;
|
||||||
|
}
|
||||||
}
|
}
|
@ -229,12 +229,20 @@ define('GATEWAY_GOOGLE', 33);
|
|||||||
define('GATEWAY_QUICKBOOKS', 35);
|
define('GATEWAY_QUICKBOOKS', 35);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** TEST VALUES FOR THE CREDIT CARDS **/
|
/**
|
||||||
define('CREDIT_CARD_VISA', 1);
|
* TEST VALUES FOR THE CREDIT CARDS
|
||||||
define('CREDIT_CARD_MASTER_CARD', 2);
|
* NUMBER IS FOR THE BINARY COUNT FOR WHICH IMAGES TO DISPLAY
|
||||||
define('CREDIT_CARD_AMERICAN_EXPRESS', 4);
|
* card IS FOR CARD IMAGE AND text IS FOR CARD NAME (TO ADD TO alt FOR IMAGE)
|
||||||
define('CREDIT_CARD_DINERS', 8);
|
**/
|
||||||
define('CREDIT_CARD_DISCOVER', 16);
|
$creditCards = [
|
||||||
|
1 => ['card' => 'images/credit_cards/Test-Visa-Icon.png', 'text' => 'Visa'],
|
||||||
|
2 => ['card' => 'images/credit_cards/Test-MasterCard-Icon.png', 'text' => 'Master Card'],
|
||||||
|
4 => ['card' => 'images/credit_cards/Test-AmericanExpress-Icon.png', 'text' => 'American Express'],
|
||||||
|
8 => ['card' => 'images/credit_cards/Test-Diners-Icon.png', 'text' => 'Diners'],
|
||||||
|
16 => ['card' => 'images/credit_cards/Test-Discover-Icon.png', 'text' => 'Discover']
|
||||||
|
];
|
||||||
|
|
||||||
|
define('CREDIT_CARDS', serialize($creditCards));
|
||||||
|
|
||||||
|
|
||||||
HTML::macro('nav_link', function($url, $text, $url2 = '', $extra = '') {
|
HTML::macro('nav_link', function($url, $text, $url2 = '', $extra = '') {
|
||||||
|
@ -20,6 +20,16 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
<!-- TODO: creditcard-types IS SET IN JS FURTHER DOWN IN THE SCRIPT PART,
|
||||||
|
AND THEN IN INLINE STYLE. REMOVE THIS WHEN RAZI HAS FIXED THE IMAGES AND STYLE -->
|
||||||
|
<div class="two-column">
|
||||||
|
{{ Former::radios('creditCardTypes_id')
|
||||||
|
->label('Accepted Credit Cards')
|
||||||
|
->radios($creditCardTypes)
|
||||||
|
->class('creditcard-types')
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="two-column">
|
<div class="two-column">
|
||||||
{{ Former::radios('recommendedGateway_id')->label('Recommended Gateways')
|
{{ Former::radios('recommendedGateway_id')->label('Recommended Gateways')
|
||||||
->radios($recommendedGateways)->class('recommended-gateway')
|
->radios($recommendedGateways)->class('recommended-gateway')
|
||||||
@ -105,6 +115,13 @@
|
|||||||
$(this).parent().children().last().after('<a href="#" onclick="gatewayLink(\'' + $(this).attr('data-siteUrl') + '\')">Create an account</a>');
|
$(this).parent().children().last().after('<a href="#" onclick="gatewayLink(\'' + $(this).attr('data-siteUrl') + '\')">Create an account</a>');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: THIS IS JUST TO SHOW THE IMAGES, STYLE IS SET INLINE STYLE
|
||||||
|
$('.creditcard-types').each(function(){
|
||||||
|
var contents = $(this).parent().contents();
|
||||||
|
contents[contents.length - 1].nodeValue = '';
|
||||||
|
$(this).after('<img style="width: 60px; display: inline;" src="' +$(this).attr('data-imageUrl') + '" /><br />');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
setFieldsShown();
|
setFieldsShown();
|
||||||
$('.two-column .form-group .col-lg-8').removeClass('col-lg-8');
|
$('.two-column .form-group .col-lg-8').removeClass('col-lg-8');
|
||||||
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |