Skip to content

Commit 516a458

Browse files
committed
Withdraw from non-existing account
1 parent ea1f111 commit 516a458

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

app/Http/Controllers/EventController.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ public function store(Request $request)
1717
$request->input('destination'),
1818
$request->input('amount')
1919
);
20+
} elseif ($request->input('type') === 'withdraw') {
21+
return $this->withdraw(
22+
$request->input('origin'),
23+
$request->input('amount')
24+
);
2025
}
2126
}
2227

@@ -36,4 +41,15 @@ private function deposit($destination, $amount)
3641
]
3742
], 201);
3843
}
44+
45+
// Withdraw from non-existing account
46+
//POST /event {"type":"withdraw", "origin":"200", "amount":10}
47+
//404 0
48+
49+
private function withdraw($origin, $amount)
50+
{
51+
$account = Account::findOrFail([
52+
'id' => $origin
53+
]);
54+
}
3955
}

0 commit comments

Comments
 (0)