@@ -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 |
@@ -24,13 +24,13 @@ |
||
24 | 24 | public function rules() |
25 | 25 | { |
26 | 26 | $filter = 'in:'; |
27 | - if(config('paymentprovider.sofortConfigKey')) { |
|
27 | + if (config('paymentprovider.sofortConfigKey')) { |
|
28 | 28 | $filter .= 'Klarna,'; |
29 | 29 | } |
30 | - if(config('paymentprovider.payPalClientSecret')) { |
|
30 | + if (config('paymentprovider.payPalClientSecret')) { |
|
31 | 31 | $filter .= 'PayPal,'; |
32 | 32 | } |
33 | - if(config('paymentprovider.mollieApiKey')) { |
|
33 | + if (config('paymentprovider.mollieApiKey')) { |
|
34 | 34 | $filter .= 'Mollie'; |
35 | 35 | } |
36 | 36 | return [ |