forked from laravelcm/laravel.cm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add new tags * Delete telescope styles * Update NotchPay payment process * Update phpstan error
- Loading branch information
1 parent
2057888
commit 3ccbebb
Showing
23 changed files
with
126,130 additions
and
734 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,10 @@ | |
use App\Models\Transaction; | ||
use App\Models\User; | ||
use Illuminate\Contracts\View\View; | ||
use Illuminate\Support\Facades\Log; | ||
use LivewireUI\Modal\ModalComponent; | ||
use NotchPay\NotchPay; | ||
use NotchPay\Payment; | ||
|
||
class AnonymousSponsors extends ModalComponent | ||
{ | ||
|
@@ -31,22 +33,28 @@ public function mount(string $amount, string $option, string $currency): void | |
|
||
public function submit(): void | ||
{ | ||
$this->validate([ | ||
'name' => 'required', | ||
'email' => 'required|email', | ||
], [ | ||
'name.required' => __('Votre nom est requis'), | ||
'email.required' => __('Une adresse e-mail est requise'), | ||
'email.email' => __('Veuillez renseigner une adresse e-mail valide'), | ||
]); | ||
$this->validate( | ||
rules: [ | ||
'name' => 'required', | ||
'email' => 'required|email', | ||
], | ||
messages: [ | ||
'name.required' => __('Votre nom est requis'), | ||
'email.required' => __('Une adresse e-mail est requise'), | ||
'email.email' => __('Veuillez renseigner une adresse e-mail valide'), | ||
] | ||
); | ||
|
||
$adminUser = User::findByEmailAddress('[email protected]'); | ||
$adminUser = User::findByEmailAddress( | ||
emailAddress: app()->environment('production') ? '[email protected]' : '[email protected]' | ||
); | ||
|
||
$notchPay = new NotchPay(config('lcm.notch-pay-public-token')); | ||
NotchPay::setApiKey( | ||
apiKey: config('lcm.notch-pay-public-token') | ||
); | ||
|
||
try { | ||
// @phpstan-ignore-next-line | ||
$payload = $notchPay->payment->initialize([ | ||
$payload = Payment::initialize([ | ||
'amount' => $this->amount, | ||
'email' => $this->email, | ||
'name' => $this->name, | ||
|
@@ -80,9 +88,13 @@ public function submit(): void | |
] | ||
]); | ||
|
||
$this->redirect($payload->authorization_url); | ||
} catch (NotchPay\Exception\ApiException $e) { | ||
session()->flash('error', __('Impossible de procéder au paiement, veuillez recommencer plus tard. Merci')); | ||
$this->redirect($payload->authorization_url); // @phpstan-ignore-line | ||
} catch (\NotchPay\Exceptions\ApiException $e) { | ||
Log::error($e->getMessage()); | ||
session()->flash( | ||
key: 'error', | ||
value: __('Impossible de procéder au paiement, veuillez recommencer plus tard. Merci') | ||
); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.