Implemented coin purchase-flow

This commit is contained in:
Edd
2025-12-31 18:28:29 +00:00
parent ff16a57a97
commit c0af76abd3
7 changed files with 202 additions and 25 deletions
@@ -15,7 +15,7 @@ class CoinPurchaseController extends Controller
{
$validated = $request->validate([
'euros' => 'required|numeric|min:1|max:100',
'payment_type' => 'required|in:MBWAY,IBAN,MB,VISA,PAYPAL',
'payment_type' => 'required|in:MBWAY,MB,VISA,PAYPAL',
'payment_reference' => [
'required',
function ($attribute, $value, $fail) use ($request) {
@@ -24,7 +24,6 @@ class CoinPurchaseController extends Controller
switch ($type) {
case 'MBWAY': $regex = '/^9[0-9]{8}$/'; break;
case 'IBAN': $regex = '/^[A-Z]{2}[0-9]{23}$/'; break;
case 'MB': $regex = '/^[0-9]{5}-[0-9]{9}$/'; break;
case 'VISA': $regex = '/^4[0-9]{15}$/'; break;
case 'PAYPAL':
+19 -1
View File
@@ -25,6 +25,12 @@ Content-Type: application/json
Accept: application/json
Authorization: Bearer {{token}}
### Get me coins
GET http://localhost:8000/api/v1/users/me/coins
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{token}}
### Get me matches
GET http://localhost:8000/api/v1/users/{{id}}/matches
Content-Type: application/json
@@ -35,4 +41,16 @@ Authorization: Bearer {{token}}
GET http://localhost:8000/api/v1/users/{{id}}/transactions?type=C
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{token}}
Authorization: Bearer {{token}}
### post coin-purchases
POST http://localhost:8000/api/v1/coin-purchases
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{token}}
{
"euros": 1,
"payment_type": "MBWAY",
"payment_reference": "912345678"
}