Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/WalletsController.php
Show First 20 Lines • Show All 242 Lines • ▼ Show 20 Lines | public function transactions($id) | ||||
$result->pop(); | $result->pop(); | ||||
$hasMore = true; | $hasMore = true; | ||||
} | } | ||||
} | } | ||||
$result = $result->map(function ($item) use ($isAdmin) { | $result = $result->map(function ($item) use ($isAdmin) { | ||||
$amount = $item->amount; | $amount = $item->amount; | ||||
if (in_array($item->type, [Transaction::WALLET_PENALTY, Transaction::WALLET_DEBIT])) { | $negatives = [ | ||||
Transaction::WALLET_CHARGEBACK, | |||||
Transaction::WALLET_DEBIT, | |||||
Transaction::WALLET_PENALTY, | |||||
Transaction::WALLET_REFUND, | |||||
]; | |||||
if (in_array($item->type, $negatives)) { | |||||
$amount *= -1; | $amount *= -1; | ||||
} | } | ||||
$entry = [ | $entry = [ | ||||
'id' => $item->id, | 'id' => $item->id, | ||||
'createdAt' => $item->created_at->format('Y-m-d H:i'), | 'createdAt' => $item->created_at->format('Y-m-d H:i'), | ||||
'type' => $item->type, | 'type' => $item->type, | ||||
'description' => $item->shortDescription(), | 'description' => $item->shortDescription(), | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |