Skip to content

Instantly share code, notes, and snippets.

@zetas
Created August 27, 2013 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zetas/6355870 to your computer and use it in GitHub Desktop.
Save zetas/6355870 to your computer and use it in GitHub Desktop.
Super complex bitcoin api callback!
/**
* @Route("/bitcoin/{token}", name="api_bitcoin_callback")
* @Template
*/
public function bitcoinCallbackAction($token, Request $request) {
$bitcoinSVC = $this->get('main_user.bitcoinservice');
if (!$uid = $bitcoinSVC->validateCallback($token,$request->get('destination_address')))
return false;
$value = $request->get('value') / 100000000;
$confirmations = $request->get('confirmations');
if ($confirmations >= 3) {
$user = $this->em->getRepository("MainUserBundle:User")
->find($uid)
;
$user->incrementDigitalBalance($value);
$this->em->flush($user);
}
return array('confirmations' => $confirmations);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment