Changeset View
Changeset View
Standalone View
Standalone View
src/app/Providers/Payment/Mollie.php
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | public function createMandate(Wallet $wallet, array $payment): ?array | ||||
'amount' => [ | 'amount' => [ | ||||
'currency' => $payment['currency'], | 'currency' => $payment['currency'], | ||||
'value' => sprintf('%.2f', $amount / 100), | 'value' => sprintf('%.2f', $amount / 100), | ||||
], | ], | ||||
'customerId' => $customer_id, | 'customerId' => $customer_id, | ||||
'sequenceType' => 'first', | 'sequenceType' => 'first', | ||||
'description' => $payment['description'], | 'description' => $payment['description'], | ||||
'webhookUrl' => Utils::serviceUrl('/api/webhooks/payment/mollie'), | 'webhookUrl' => Utils::serviceUrl('/api/webhooks/payment/mollie'), | ||||
'redirectUrl' => Utils::serviceUrl('/wallet'), | 'redirectUrl' => self::redirectUrl(), | ||||
'locale' => 'en_US', | 'locale' => 'en_US', | ||||
'method' => $payment['methodId'] | 'method' => $payment['methodId'] | ||||
]; | ]; | ||||
// Create the payment in Mollie | // Create the payment in Mollie | ||||
$response = mollie()->payments()->create($request); | $response = mollie()->payments()->create($request); | ||||
if ($response->mandateId) { | if ($response->mandateId) { | ||||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | public function payment(Wallet $wallet, array $payment): ?array | ||||
'value' => sprintf('%.2f', $amount / 100), | 'value' => sprintf('%.2f', $amount / 100), | ||||
], | ], | ||||
'customerId' => $customer_id, | 'customerId' => $customer_id, | ||||
'sequenceType' => $payment['type'], | 'sequenceType' => $payment['type'], | ||||
'description' => $payment['description'], | 'description' => $payment['description'], | ||||
'webhookUrl' => Utils::serviceUrl('/api/webhooks/payment/mollie'), | 'webhookUrl' => Utils::serviceUrl('/api/webhooks/payment/mollie'), | ||||
'locale' => 'en_US', | 'locale' => 'en_US', | ||||
'method' => $payment['methodId'], | 'method' => $payment['methodId'], | ||||
'redirectUrl' => Utils::serviceUrl('/wallet') // required for non-recurring payments | 'redirectUrl' => self::redirectUrl() // required for non-recurring payments | ||||
]; | ]; | ||||
// TODO: Additional payment parameters for better fraud protection: | // TODO: Additional payment parameters for better fraud protection: | ||||
// billingEmail - for bank transfers, Przelewy24, but not creditcard | // billingEmail - for bank transfers, Przelewy24, but not creditcard | ||||
// billingAddress (it is a structured field not just text) | // billingAddress (it is a structured field not just text) | ||||
// Create the payment in Mollie | // Create the payment in Mollie | ||||
$response = mollie()->payments()->create($request); | $response = mollie()->payments()->create($request); | ||||
▲ Show 20 Lines • Show All 413 Lines • Show Last 20 Lines |