Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/PaymentsController.php
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | public function store(Request $request) | ||||
// The same customer could technicly have multiple | // The same customer could technicly have multiple | ||||
// Mollie IDs, then we'd need to use some "virtual" email | // Mollie IDs, then we'd need to use some "virtual" email | ||||
// address (e.g. <wallet-id>@<user-domain>) instead of the user email address | // address (e.g. <wallet-id>@<user-domain>) instead of the user email address | ||||
$customer_id = $current_user->getSetting('mollie_id'); | $customer_id = $current_user->getSetting('mollie_id'); | ||||
$seq_type = 'oneoff'; | $seq_type = 'oneoff'; | ||||
if (empty($customer_id)) { | if (empty($customer_id)) { | ||||
$customer = mollie()->customers()->create([ | $customer = mollie()->customers()->create([ | ||||
'name' => $current_user->name, | 'name' => $current_user->name(), | ||||
'email' => $current_user->email, | 'email' => $current_user->email, | ||||
]); | ]); | ||||
$seq_type = 'first'; | $seq_type = 'first'; | ||||
$customer_id = $customer->id; | $customer_id = $customer->id; | ||||
$current_user->setSetting('mollie_id', $customer_id); | $current_user->setSetting('mollie_id', $customer_id); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 162 Lines • Show Last 20 Lines |