{"action":"created","issue":{"url":"https://api.github.com/repos/boxbilling/boxbilling/issues/251","labels_url":"https://api.github.com/repos/boxbilling/boxbilling/issues/251/labels{/name}","comments_url":"https://api.github.com/repos/boxbilling/boxbilling/issues/251/comments","events_url":"https://api.github.com/repos/boxbilling/boxbilling/issues/251/events","html_url":"https://github.com/boxbilling/boxbilling/issues/251","id":56783054,"number":251,"title":"Bitcoin payment","user":{"login":"mdaskin","id":10865015,"avatar_url":"https://avatars.githubusercontent.com/u/10865015?v=3","gravatar_id":"","url":"https://api.github.com/users/mdaskin","html_url":"https://github.com/mdaskin","followers_url":"https://api.github.com/users/mdaskin/followers","following_url":"https://api.github.com/users/mdaskin/following{/other_user}","gists_url":"https://api.github.com/users/mdaskin/gists{/gist_id}","starred_url":"https://api.github.com/users/mdaskin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdaskin/subscriptions","organizations_url":"https://api.github.com/users/mdaskin/orgs","repos_url":"https://api.github.com/users/mdaskin/repos","events_url":"https://api.github.com/users/mdaskin/events{/privacy}","received_events_url":"https://api.github.com/users/mdaskin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-06T08:14:12Z","updated_at":"2015-02-07T18:49:02Z","closed_at":null,"body":"i have create bitcoin payment adapter \r\nMay optimize for usage \r\n\r\n\r\n<?php\r\nclass Payment_Adapter_Bitcoin\r\n{\r\n    private $config = array();\r\n    protected $di;\r\n     public function __construct($config)\r\n    {\r\n        $this->config = $config;\r\n        if(!$this->config['btcaddress']) {\r\n            throw new Exception('Payment gateway \"Bitcoin\" is not configured properly. Please update configuration parameter \"Bitcoin address\" at \"Configuration -> Payments\".');\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @param Box_Di $di\r\n     */\r\n    public function setDi($di)\r\n    {\r\n        $this->di = $di;\r\n    }\r\n    public static function getConfig()\r\n    {\r\n        return array(\r\n            'can_load_in_iframe'   =>  true,\r\n            'supports_one_time_payments'   =>  true,\r\n            'supports_subscriptions'       =>  false,\r\n            'description'     =>  'bitcoin',\r\n            'form'  => array(\r\n                'btcaddress' => array('text', array(\r\n                            'label' => 'Your Btc Address',\r\n                            \r\n                    ),\r\n                 ),\r\n            ),\r\n        );\r\n    }\r\n    /**\r\n     * Generate payment text\r\n     * \r\n     * @param Api_Admin $api_admin\r\n     * @param int $invoice_id\r\n     * @param bool $subscription\r\n     * \r\n     * @since BoxBilling v2.9.15\r\n     * \r\n     * @return string - html form with auto submit javascript\r\n     */\r\n    public function getHtml($api_admin, $invoice_id, $subscription)\r\n    {\r\n        $data['btcaddress']           = $this->config['btcaddress'];\r\n        $invoiceModel = $this->di['db']->load('Invoice', $invoice_id);\r\n        $invoiceService = $this->di['mod_service'](\"Invoice\");\r\n        $invoice = $invoiceService->toApiArray($invoiceModel, true);\r\n        $rate = json_decode(file_get_contents(\"http://www.coinvibes.com/api/v1/tickers/btce/btc_eur\"),1);\r\n        $price_in_btc = round($invoice['total'] / $rate['average'],8);\r\n        return \"Price in BTC = <strong>\".$price_in_btc.\"</strong>BTC<br>Please send to <strong>\".$data['btcaddress'].\"</strong><br>or Scan QR code your bitcoin app<br><img style='margin:5px' id='qrsend' src='https://blockchain.info/qr?data=bitcoin:\".$data['btcaddress'].\"%3Famount=\".$price_in_btc.\"%26label=CCcamServer.com&size=125'/><br>When You sent your payment <a href='/support' class='btn btn-info btn-small' target='_blank'type='button' data-toggle='modal'>Open Ticket</a> which included your Bitcoin address.\";\r\n    }\r\n    public function process($tx)\r\n    {\r\n        //do processing\r\n        return true;\r\n    }\r\n}\r\n"},"comment":{"url":"https://api.github.com/repos/boxbilling/boxbilling/issues/comments/73377168","html_url":"https://github.com/boxbilling/boxbilling/issues/251#issuecomment-73377168","issue_url":"https://api.github.com/repos/boxbilling/boxbilling/issues/251","id":73377168,"user":{"login":"legion726","id":10427411,"avatar_url":"https://avatars.githubusercontent.com/u/10427411?v=3","gravatar_id":"","url":"https://api.github.com/users/legion726","html_url":"https://github.com/legion726","followers_url":"https://api.github.com/users/legion726/followers","following_url":"https://api.github.com/users/legion726/following{/other_user}","gists_url":"https://api.github.com/users/legion726/gists{/gist_id}","starred_url":"https://api.github.com/users/legion726/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/legion726/subscriptions","organizations_url":"https://api.github.com/users/legion726/orgs","repos_url":"https://api.github.com/users/legion726/repos","events_url":"https://api.github.com/users/legion726/events{/privacy}","received_events_url":"https://api.github.com/users/legion726/received_events","type":"User","site_admin":false},"created_at":"2015-02-07T18:49:02Z","updated_at":"2015-02-07T18:49:02Z","body":"Thank U. useful to"}}