Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
David Bomba 2016-03-10 20:14:54 +11:00
commit 280a485a84
5 changed files with 16 additions and 4 deletions

View File

@ -99,6 +99,8 @@ class InvoiceController extends BaseController
->where('invitations.deleted_at', '=', null) ->where('invitations.deleted_at', '=', null)
->select('contacts.public_id')->lists('public_id'); ->select('contacts.public_id')->lists('public_id');
$clients = Client::scope()->withTrashed()->with('contacts', 'country');
if ($clone) { if ($clone) {
$invoice->id = $invoice->public_id = null; $invoice->id = $invoice->public_id = null;
$invoice->invoice_number = $account->getNextInvoiceNumber($invoice); $invoice->invoice_number = $account->getNextInvoiceNumber($invoice);
@ -111,6 +113,7 @@ class InvoiceController extends BaseController
Utils::trackViewed($invoice->getDisplayName().' - '.$invoice->client->getDisplayName(), $invoice->getEntityType()); Utils::trackViewed($invoice->getDisplayName().' - '.$invoice->client->getDisplayName(), $invoice->getEntityType());
$method = 'PUT'; $method = 'PUT';
$url = "{$entityType}s/{$publicId}"; $url = "{$entityType}s/{$publicId}";
$clients->whereId($invoice->client_id);
} }
$invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date); $invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
@ -157,7 +160,7 @@ class InvoiceController extends BaseController
$lastSent = ($invoice->is_recurring && $invoice->last_sent_date) ? $invoice->recurring_invoices->last() : null; $lastSent = ($invoice->is_recurring && $invoice->last_sent_date) ? $invoice->recurring_invoices->last() : null;
$data = array( $data = array(
'clients' => Client::scope()->withTrashed()->with('contacts', 'country')->whereId($invoice->client_id)->get(), 'clients' => $clients->get(),
'entityType' => $entityType, 'entityType' => $entityType,
'showBreadcrumbs' => $clone, 'showBreadcrumbs' => $clone,
'invoice' => $invoice, 'invoice' => $invoice,

View File

@ -101,7 +101,9 @@ class PublicClientController extends BaseController
// Checkout.com requires first getting a payment token // Checkout.com requires first getting a payment token
$checkoutComToken = false; $checkoutComToken = false;
$checkoutComKey = false; $checkoutComKey = false;
$checkoutComDebug = false;
if ($accountGateway = $account->getGatewayConfig(GATEWAY_CHECKOUT_COM)) { if ($accountGateway = $account->getGatewayConfig(GATEWAY_CHECKOUT_COM)) {
$checkoutComDebug = $accountGateway->getConfigField('testMode');
if ($checkoutComToken = $this->paymentService->getCheckoutComToken($invitation)) { if ($checkoutComToken = $this->paymentService->getCheckoutComToken($invitation)) {
$checkoutComKey = $accountGateway->getConfigField('publicApiKey'); $checkoutComKey = $accountGateway->getConfigField('publicApiKey');
$invitation->transaction_reference = $checkoutComToken; $invitation->transaction_reference = $checkoutComToken;
@ -126,6 +128,7 @@ class PublicClientController extends BaseController
'paymentURL' => $paymentURL, 'paymentURL' => $paymentURL,
'checkoutComToken' => $checkoutComToken, 'checkoutComToken' => $checkoutComToken,
'checkoutComKey' => $checkoutComKey, 'checkoutComKey' => $checkoutComKey,
'checkoutComDebug' => $checkoutComDebug,
'phantomjs' => Input::has('phantomjs'), 'phantomjs' => Input::has('phantomjs'),
); );

View File

@ -41,7 +41,7 @@ class AccountGatewayService extends BaseService
[ [
'name', 'name',
function ($model) { function ($model) {
return link_to("gateways/{$model->public_id}/edit", $model->name); return link_to("gateways/{$model->public_id}/edit", $model->name)->toHtml();
} }
], ],
[ [

View File

@ -1,9 +1,13 @@
@if ($checkoutComDebug)
<script src="https://sandbox.checkout.com/js/v1/checkout.js"></script> <script src="https://sandbox.checkout.com/js/v1/checkout.js"></script>
@else
<script src="https://cdn.checkout.com/js/checkout.js"></script>
@endif
<form method="POST" class="payment-form"> <form method="POST" class="payment-form">
<script> <script>
Checkout.render({ Checkout.render({
debugMode: true, debugMode: {{ $checkoutComDebug ? 'true' : 'false' }},
publicKey: '{{ $checkoutComKey }}', publicKey: '{{ $checkoutComKey }}',
paymentToken: '{{ $checkoutComToken }}', paymentToken: '{{ $checkoutComToken }}',
customerEmail: '{{ $contact->email }}', customerEmail: '{{ $contact->email }}',

View File

@ -29,7 +29,9 @@ class TaxRatesCest
$total = $itemCost; $total = $itemCost;
$total += round($itemCost * $itemTaxRate / 100, 2); $total += round($itemCost * $itemTaxRate / 100, 2);
$total += round($itemCost * $invoiceTaxRate / 100, 2); $total += round($itemCost * $invoiceTaxRate / 100, 2);
$itemTaxRate = number_format($itemTaxRate, 2); $itemTaxRate = number_format($itemTaxRate, 2);
$invoiceTaxRate = number_format($invoiceTaxRate, 2);
// create tax rates // create tax rates
$I->amOnPage('/tax_rates/create'); $I->amOnPage('/tax_rates/create');