Mini API: avatar, wallet payout/withdraw, stale-payment auto-cancel.
Deploy Ladill Mini / deploy (push) Successful in 48s
Deploy Ladill Mini / deploy (push) Successful in 48s
Adds account avatar upload (multipart proxy to identity), wallet payout-account + withdrawal endpoints, and a hourly mini:cancel-stale-payments command that cancels payments pending beyond 6h (new MiniPayment::STATUS_CANCELED). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
c39e38cbe0
commit
af1f197059
@@ -62,4 +62,54 @@ class WalletController extends Controller
|
||||
|
||||
return response()->json(['data' => ['checkout_url' => $checkoutUrl]]);
|
||||
}
|
||||
|
||||
public function payoutAccount(): JsonResponse
|
||||
{
|
||||
$response = $this->identitySend('GET', '/api/identity/payout-account?user='.urlencode((string) ladill_account()->public_id), []);
|
||||
|
||||
return response()->json(['data' => ['payout_account' => $response->json('data.payout_account')]]);
|
||||
}
|
||||
|
||||
public function updatePayoutAccount(Request $request): JsonResponse
|
||||
{
|
||||
$data = $request->validate([
|
||||
'account_type' => ['required', 'in:mobile_money,bank_account'],
|
||||
'account_name' => ['required', 'string', 'max:200'],
|
||||
'account_number' => ['required', 'string', 'max:30'],
|
||||
'bank_code' => ['required', 'string', 'max:30'],
|
||||
'bank_name' => ['required', 'string', 'max:200'],
|
||||
'currency' => ['sometimes', 'string', 'size:3'],
|
||||
]);
|
||||
$data['currency'] = $data['currency'] ?? 'GHS';
|
||||
|
||||
$response = $this->identitySend('PUT', '/api/identity/payout-account', array_merge(
|
||||
['user' => ladill_account()->public_id],
|
||||
$data,
|
||||
));
|
||||
$this->rethrowValidation($response, 'account_number');
|
||||
|
||||
return response()->json(['data' => ['payout_account' => $response->json('data.payout_account')]]);
|
||||
}
|
||||
|
||||
public function withdrawals(): JsonResponse
|
||||
{
|
||||
$response = $this->identitySend('GET', '/api/identity/wallet/withdrawals?user='.urlencode((string) ladill_account()->public_id), []);
|
||||
|
||||
return response()->json(['data' => $response->json('data', [])]);
|
||||
}
|
||||
|
||||
public function withdraw(Request $request): JsonResponse
|
||||
{
|
||||
$data = $request->validate([
|
||||
'amount' => ['required', 'numeric', 'min:1', 'max:50000'],
|
||||
]);
|
||||
|
||||
$response = $this->identitySend('POST', '/api/identity/wallet/withdraw', [
|
||||
'user' => ladill_account()->public_id,
|
||||
'amount' => (float) $data['amount'],
|
||||
]);
|
||||
$this->rethrowValidation($response, 'amount');
|
||||
|
||||
return response()->json(['data' => $response->json('data', [])]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user