Merge branch 'master' into charge-vat-at-organiser-level

This commit is contained in:
Jeremy Quinton 2018-07-18 19:37:56 +02:00 committed by GitHub
commit cd213b56b3
6 changed files with 700 additions and 599 deletions

View File

@ -3,12 +3,15 @@
namespace App\Http\Controllers;
use App\Events\OrderCompletedEvent;
use App\Models\Account;
use App\Models\AccountPaymentGateway;
use App\Models\Affiliate;
use App\Models\Attendee;
use App\Models\Event;
use App\Models\EventStats;
use App\Models\Order;
use App\Models\OrderItem;
use App\Models\PaymentGateway;
use App\Models\QuestionAnswer;
use App\Models\ReservedTickets;
use App\Models\Ticket;
@ -185,6 +188,15 @@ class EventCheckoutController extends Controller
]);
}
if (config('attendize.enable_dummy_payment_gateway') == TRUE) {
$activeAccountPaymentGateway = new AccountPaymentGateway();
$activeAccountPaymentGateway->fill(['payment_gateway_id' => config('attendize.payment_gateway_dummy')]);
$paymentGateway= $activeAccountPaymentGateway;
} else {
$activeAccountPaymentGateway = count($event->account->active_payment_gateway) ? $event->account->active_payment_gateway : false;
$paymentGateway = count($event->account->active_payment_gateway) ? $event->account->active_payment_gateway->payment_gateway : false;
}
/*
* The 'ticket_order_{event_id}' session stores everything we need to complete the transaction.
*/
@ -204,8 +216,8 @@ class EventCheckoutController extends Controller
'order_requires_payment' => (ceil($order_total) == 0) ? false : true,
'account_id' => $event->account->id,
'affiliate_referral' => Cookie::get('affiliate_' . $event_id),
'account_payment_gateway' => count($event->account->active_payment_gateway) ? $event->account->active_payment_gateway : false,
'payment_gateway' => count($event->account->active_payment_gateway) ? $event->account->active_payment_gateway->payment_gateway : false,
'account_payment_gateway' => $activeAccountPaymentGateway,
'payment_gateway' => $paymentGateway
]);
/*
@ -324,23 +336,41 @@ class EventCheckoutController extends Controller
}
try {
$transaction_data = [];
if (config('attendize.enable_dummy_payment_gateway') == TRUE) {
$formData = config('attendize.fake_card_data');
$transaction_data = [
'card' => $formData
];
$gateway = Omnipay::create($ticket_order['payment_gateway']->name);
$gateway = Omnipay::create('Dummy');
$gateway->initialize();
$gateway->initialize($ticket_order['account_payment_gateway']->config + [
'testMode' => config('attendize.enable_test_payments'),
]);
} else {
$gateway = Omnipay::create($ticket_order['payment_gateway']->name);
$gateway->initialize($ticket_order['account_payment_gateway']->config + [
'testMode' => config('attendize.enable_test_payments'),
]);
}
$orderService = new OrderService($ticket_order['order_total'], $ticket_order['total_booking_fee'], $event);
$orderService->calculateFinalCosts();
$transaction_data = [
$transaction_data += [
'amount' => $orderService->getGrandTotal(),
'currency' => $event->currency->code,
'description' => 'Order for customer: ' . $request->get('order_email'),
];
];
switch ($ticket_order['payment_gateway']->id) {
case config('attendize.payment_gateway_dummy'):
$token = uniqid();
$transaction_data += [
'token' => $token,
'receipt_email' => $request->get('order_email'),
'card' => $formData
];
break;
case config('attendize.payment_gateway_paypal'):
case config('attendize.payment_gateway_coinbase'):

9
composer.json Normal file → Executable file
View File

@ -25,21 +25,22 @@
"omnipay/paypal": "*",
"omnipay/bitpay": "dev-master",
"omnipay/coinbase": "dev-master",
"omnipay/dummy": "~2.2",
"laracasts/utilities": "^2.1",
"predis/predis": "~1.0",
"guzzlehttp/guzzle": "^6.2",
"omnipay/migs": "^2.1",
"mcamara/laravel-localization": "^1.2",
"potsky/laravel-localization-helpers": "2.3.*"
"potsky/laravel-localization-helpers": "2.3.*",
"doctrine/dbal": "~2.3",
"barryvdh/laravel-ide-helper": "^2.4"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"fzaninotto/faker": "^1.5",
"symfony/dom-crawler": "~3.0",
"symfony/css-selector": "~3.0",
"doctrine/dbal": "~2.3",
"barryvdh/laravel-ide-helper": "^2.1"
"symfony/css-selector": "~3.0"
},
"autoload": {

1223
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -7,12 +7,18 @@ return [
'ticket_status_sold_out' => 1,
'ticket_status_after_sale_date' => 2,//
'enable_test_payments' => env('ENABLE_TEST_PAYMENTS', false),
'enable_dummy_payment_gateway' => false,
'payment_gateway_dummy' => 0,
'payment_gateway_stripe' => 1,
'payment_gateway_paypal' => 2,
'payment_gateway_coinbase' => 3,
'payment_gateway_migs' => 4,
'fake_card_data' => [
'number' => '4242424242424242',
'expiryMonth' => '6',
'expiryYear' => '2030',
'cvv' => '123'
],
'outgoing_email_noreply' => env('MAIL_FROM_ADDRESS'),
'outgoing_email' => env('MAIL_FROM_ADDRESS'),
'outgoing_email_name' => env('MAIL_FROM_NAME'),

View File

@ -119,6 +119,13 @@ docker-compose run php php artisan attendize:install
Attendize should now be available at `http://localhost:8080` and maildev at `http://localhost:1080`
### Enabling Dummy Payment Gateway for testing purposes ###
To be able to test the journey of buying and paying for tickets from the event page you need to have a payment gateway enabled else you can't complete the journey. To enable the dummy gateway that allows you to go through the journey
end to end change the configuration option enable_dummy_payment_gateway in ./config/attendize.php to true
```
'enable_dummy_payment_gateway' => true
```
### Manual Installation
---

View File

@ -69,7 +69,7 @@
@if (($event->bg_type == 'image' || $event->bg_type == 'custom_image' || Input::get('bg_img_preview')) && !Input::get('bg_color_preview'))
<style>
body {
background: url({{(Input::get('bg_img_preview') ? '/'.Input::get('bg_img_preview') : asset(config('attendize.cdn_url_static_assets').'/'.$event->bg_image_path))}}) no-repeat center center fixed;
background: url({{(Input::get('bg_img_preview') ? URL::to(Input::get('bg_img_preview')) : asset(config('attendize.cdn_url_static_assets').'/'.$event->bg_image_path))}}) no-repeat center center fixed;
background-size: cover;
}
</style>