@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | { |
41 | 41 | $this->sofortApi->setAmount($purchase->total()); |
42 | 42 | $this->sofortApi->setCurrencyCode('EUR'); |
43 | - $this->sofortApi->setReason('#'.$purchase->id . ' Purchase'); |
|
43 | + $this->sofortApi->setReason('#' . $purchase->id . ' Purchase'); |
|
44 | 44 | $this->sofortApi->setSuccessUrl(route('ts.payment.successful', [ |
45 | 45 | 'purchase' => $purchase->random_id, |
46 | 46 | 'secret' => $purchase->payment_secret |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | if ($this->sofortApi->isError()) { |
54 | 54 | // SOFORT-API didn't accept the data |
55 | - foreach($this->sofortApi->getErrors() as $error) { |
|
55 | + foreach ($this->sofortApi->getErrors() as $error) { |
|
56 | 56 | Log::error($error); |
57 | 57 | } |
58 | 58 | throw new PaymentProviderException("SOFORT got errors..."); |
@@ -50,10 +50,10 @@ |
||
50 | 50 | $seatMap->description = $validated['description']; |
51 | 51 | $seatMap->seats = $validated['seats']; |
52 | 52 | |
53 | - if( !empty(json_decode($validated['layout'])) ) |
|
53 | + if (!empty(json_decode($validated['layout']))) |
|
54 | 54 | { |
55 | 55 | $numberOfSeatsInLayout = preg_match_all('/a/', $validated['layout']); |
56 | - if($numberOfSeatsInLayout != $validated['seats']) { |
|
56 | + if ($numberOfSeatsInLayout != $validated['seats']) { |
|
57 | 57 | return redirect() |
58 | 58 | ->route('admin.dependencies.seatmap.get', $seatMap) |
59 | 59 | ->with('status', 'Counted seats of layout (' . $numberOfSeatsInLayout . ') does not match the given seats (' . $validated['seats'] . ')!'); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function passes($attribute, $value) |
37 | 37 | { |
38 | - if($value === NULL || $value === "") { |
|
38 | + if ($value === NULL || $value === "") { |
|
39 | 39 | // it is allowed for the value to be empty |
40 | 40 | return true; |
41 | 41 | } |
@@ -45,20 +45,20 @@ discard block |
||
45 | 45 | |
46 | 46 | // if json_decode result is falsy, then json object could |
47 | 47 | // not be decoded and therefore the input is invalid |
48 | - if(!$rows) { |
|
48 | + if (!$rows) { |
|
49 | 49 | return false; |
50 | 50 | } |
51 | 51 | |
52 | 52 | // iterate over all rows to check that only valid |
53 | 53 | // characters ('a' and '_') have been submitted |
54 | - foreach( $rows as $row ) { |
|
54 | + foreach ($rows as $row) { |
|
55 | 55 | // explanation for regex ^[a_]*$ |
56 | 56 | // ^ = Start of string |
57 | 57 | // [a_] = Only characters "a" and "_" allowed |
58 | 58 | // * = zero or more characters |
59 | 59 | // $ = End of string |
60 | 60 | // Complete: Only match strings that contain from start to end only zero or more characters on the whitelist of a and _ |
61 | - if( !preg_match('/^[a_]*$/', $row) ) { |
|
61 | + if (!preg_match('/^[a_]*$/', $row)) { |
|
62 | 62 | return false; |
63 | 63 | } |
64 | 64 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | public function getRowAndSeat() |
43 | 43 | { |
44 | - if( !$this->event->seatMap->layout ) { |
|
44 | + if (!$this->event->seatMap->layout) { |
|
45 | 45 | return null; |
46 | 46 | } |
47 | 47 | |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | $columnCounter = 0; |
50 | 50 | $result = []; |
51 | 51 | $rows = json_decode($this->event->seatMap->layout); |
52 | - foreach( $rows as $rowId => $row ) { |
|
52 | + foreach ($rows as $rowId => $row) { |
|
53 | 53 | $columnCounter = 0; |
54 | - foreach( str_split($row) as $charId => $char) { |
|
55 | - if($char === 'a') { |
|
54 | + foreach (str_split($row) as $charId => $char) { |
|
55 | + if ($char === 'a') { |
|
56 | 56 | $counter++; |
57 | 57 | $columnCounter++; |
58 | 58 | } |
59 | - if($counter === $this->seat_number) { |
|
60 | - $result['row'] = $rowId+1; |
|
59 | + if ($counter === $this->seat_number) { |
|
60 | + $result['row'] = $rowId + 1; |
|
61 | 61 | $result['seat'] = $columnCounter; |
62 | 62 | break; |
63 | 63 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | public function getRowsAndColumns() |
17 | 17 | { |
18 | - if(!$this->layout) { |
|
18 | + if (!$this->layout) { |
|
19 | 19 | return null; |
20 | 20 | } |
21 | 21 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $result['rows'] = count($rows); |
26 | 26 | $result['columns'] = array_reduce($rows, function($intermediate, $row) { |
27 | 27 | $columns = strlen($row); |
28 | - if($intermediate < $columns) { |
|
28 | + if ($intermediate < $columns) { |
|
29 | 29 | return $columns; |
30 | 30 | } else { |
31 | 31 | return $intermediate; |
@@ -41,7 +41,7 @@ |
||
41 | 41 | try { |
42 | 42 | DB::statement('show tables'); |
43 | 43 | $this->info('Database connection available!'); |
44 | - } catch( \Illuminate\Database\QueryException $e) { |
|
44 | + } catch (\Illuminate\Database\QueryException $e) { |
|
45 | 45 | $this->error('Database connection not available!'); |
46 | 46 | exit(1); // return a non-0-code to be used in shell scripts as a falsy exit state |
47 | 47 | } |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function boot() |
19 | 19 | { |
20 | - Blade::directive('time', function ($expression) { |
|
20 | + Blade::directive('time', function($expression) { |
|
21 | 21 | return "<?php echo strftime('%H:%M', date_create($expression)->getTimestamp()); ?>"; |
22 | 22 | }); |
23 | - Blade::directive('datetime', function ($expression) { |
|
23 | + Blade::directive('datetime', function($expression) { |
|
24 | 24 | return "<?php echo strftime('%A, %d.%m.%Y', date_create($expression)->getTimestamp()); ?>"; |
25 | 25 | }); |
26 | 26 | } |
@@ -33,18 +33,18 @@ discard block |
||
33 | 33 | public function register() |
34 | 34 | { |
35 | 35 | $this->app->bind('App\PaymentProvider\Klarna', function() { |
36 | - return new Klarna( config('paymentprovider.sofortConfigKey') ); |
|
36 | + return new Klarna(config('paymentprovider.sofortConfigKey')); |
|
37 | 37 | }); |
38 | 38 | |
39 | 39 | $this->app->bind('App\PaymentProvider\PayPal', function() { |
40 | 40 | return new PayPal( |
41 | - config('paymentprovider.payPalClientId'), // ClientID |
|
41 | + config('paymentprovider.payPalClientId'), // ClientID |
|
42 | 42 | config('paymentprovider.payPalClientSecret') // ClientSecret |
43 | 43 | ); |
44 | 44 | }); |
45 | 45 | |
46 | 46 | $this->app->bind('App\PaymentProvider\Mollie', function() { |
47 | - return new Mollie( config('paymentprovider.mollieApiKey') ); |
|
47 | + return new Mollie(config('paymentprovider.mollieApiKey')); |
|
48 | 48 | }); |
49 | 49 | } |
50 | 50 | } |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | $purchase->payment_id = $payment->id; |
69 | 69 | $purchase->save(); |
70 | 70 | |
71 | - } catch( \Mollie\Api\Exceptions\ApiException $e ) { |
|
72 | - throw new PaymentProviderException( $e ); |
|
71 | + } catch (\Mollie\Api\Exceptions\ApiException $e) { |
|
72 | + throw new PaymentProviderException($e); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | // Set a reference to the customer, depending if a user object exists |
@@ -97,48 +97,48 @@ discard block |
||
97 | 97 | $purchaseId = $payment->metadata->purchase_id; |
98 | 98 | $purchase = Purchase::find($purchaseId); |
99 | 99 | |
100 | - if( !$purchase ) { |
|
100 | + if (!$purchase) { |
|
101 | 101 | throw new PaymentProviderException('Payment-Id "' . $paymentId . '" has no matching purchase!'); |
102 | 102 | } |
103 | 103 | |
104 | - if( $payment->isPaid() && !$payment->hasRefunds() && !$payment->hasChargebacks() ) { |
|
104 | + if ($payment->isPaid() && !$payment->hasRefunds() && !$payment->hasChargebacks()) { |
|
105 | 105 | /* |
106 | 106 | * The payment is paid and isn't refunded or charged back. |
107 | 107 | */ |
108 | 108 | // Only send an email with the tickets on the change of state to "paid" |
109 | - if($purchase->state != 'paid') { |
|
109 | + if ($purchase->state != 'paid') { |
|
110 | 110 | Log::info('[Purchase#' . $purchase->id . '] Sending Ticket-Mail.'); |
111 | 111 | Mail::to($purchase->customer)->send(new TicketsPaid($purchase)); |
112 | 112 | } |
113 | - } elseif( $payment->isOpen() ) { |
|
113 | + } elseif ($payment->isOpen()) { |
|
114 | 114 | /* |
115 | 115 | * The payment is open. |
116 | 116 | */ |
117 | - } elseif( $payment->isPending() ) { |
|
117 | + } elseif ($payment->isPending()) { |
|
118 | 118 | /* |
119 | 119 | * The payment is pending. |
120 | 120 | */ |
121 | - } elseif( $payment->isFailed() ) { |
|
121 | + } elseif ($payment->isFailed()) { |
|
122 | 122 | /* |
123 | 123 | * The payment has failed. |
124 | 124 | */ |
125 | 125 | $purchase->deleteWithAllData(); |
126 | - } elseif( $payment->isExpired() ) { |
|
126 | + } elseif ($payment->isExpired()) { |
|
127 | 127 | /* |
128 | 128 | * The payment is expired. |
129 | 129 | */ |
130 | 130 | $purchase->deleteWithAllData(); |
131 | - } elseif( $payment->isCanceled() ) { |
|
131 | + } elseif ($payment->isCanceled()) { |
|
132 | 132 | /* |
133 | 133 | * The payment has been canceled. |
134 | 134 | */ |
135 | 135 | $purchase->deleteWithAllData(); |
136 | - } elseif( $payment->hasRefunds() ) { |
|
136 | + } elseif ($payment->hasRefunds()) { |
|
137 | 137 | /* |
138 | 138 | * The payment has been (partially) refunded. |
139 | 139 | * The status of the payment is still "paid" |
140 | 140 | */ |
141 | - } elseif( $payment->hasChargebacks() ) { |
|
141 | + } elseif ($payment->hasChargebacks()) { |
|
142 | 142 | /* |
143 | 143 | * The payment has been (partially) charged back. |
144 | 144 | * The status of the payment is still "paid" |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $purchase->save(); |
152 | 152 | |
153 | 153 | } catch (\Mollie\Api\Exceptions\ApiException $e) { |
154 | - throw new PaymentProviderException( $e ); |
|
154 | + throw new PaymentProviderException($e); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | // Someone could try to cause high load on webservice by |
52 | 52 | // requesting the webhook endpoint with fake ids |
53 | 53 | $purchase = Purchase::firstWhere('payment_id', $id); |
54 | - if( !$purchase ) { |
|
54 | + if (!$purchase) { |
|
55 | 55 | return response('PaymentId invalid', 403); |
56 | 56 | } |
57 | 57 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // First check, if the purchase is linked to mollie. |
74 | 74 | // Else we would trigger unneccessary api calls |
75 | 75 | $mollie = User::firstWhere('email', '[email protected]'); |
76 | - if( $purchase->vendor->id !== $mollie->id ) { |
|
76 | + if ($purchase->vendor->id !== $mollie->id) { |
|
77 | 77 | return response('Not a mollie purchase!', 403); // 403 = Forbidden |
78 | 78 | } |
79 | 79 |