Commit df510619 by bandi

ePay.info wallet provider support

parent 0e1ebcd8
<?php
class EpayWalletProvider extends WalletProvider
{
protected $epay = NULL;
public function __construct()
{
$this->epay = new SoapClient('http://api.epay.info/?wsdl');
}
public function getBalance()
{
global $epayApiKey;
return $this->epay->f_balance($epayApiKey, 1);
}
public function sendMoney($address, $balance)
{
global $cashoutMessage, $epayApiKey;
$response = $this->epay->send($epayApiKey, $address, $balance, 1, $cashoutMessage);
if ($response["status"] > 0) {
return $response["status"];
}
if ($response["status"] == -3) {
throw new NoCashException("Insufficient funds", 0);
}
if ($response["status"] == -2) {
throw new Exception("Wrong api key", 0);
}
if ($response["status"] == -5) {
throw new Exception("You have to wait until ".date(DATE_RFC2822, $response["time"]), 0);
}
if ($response["status"] == -10) {
throw new Exception("Daily budget reached, try again later", 0);
}
if ($response["status"] == -11) {
throw new Exception("Time-frame limit reached, try again later", 0);
}
throw new Exception("Error: " . $response["status"], 0);
}
}
......@@ -5,7 +5,7 @@ abstract class WalletProvider {
public static function getInstance($refresh = false)
{
global $apiKey, $guid, $rpchost, $appId, $blockIoApiKey, $faucetBoxKey;
global $apiKey, $guid, $rpchost, $appId, $blockIoApiKey, $faucetBoxKey, $epayApiKey;
if (is_null(self::$environment) || $refresh) {
if (!empty($apiKey)) {
self::$environment = new CoinbaseWalletProvider();
......@@ -15,6 +15,8 @@ abstract class WalletProvider {
self::$environment = new XapoWalletProvider();
} elseif (!empty($blockIoApiKey)) {
self::$environment = new BlockIoWalletProvider();
} elseif (!empty($epayApiKey)) {
self::$environment = new EpayWalletProvider();
} elseif (!empty($faucetBoxKey)) {
self::$environment = new FaucetBOXWalletProvider();
} elseif (!empty($rpchost)) {
......
......@@ -74,6 +74,9 @@ $guid = "";
$firstpassword = "";
$secondpassword = "";
// ePay.info Account
$epayApiKey = "";
// Xapo Account
$appId = "";
$appSecret = "";
......
......@@ -31,6 +31,7 @@ require_once 'WalletProviders/BlockchainWalletProvider.php';
require_once 'WalletProviders/BlockIoWalletProvider.php';
require_once 'WalletProviders/CoinbaseWalletProvider.php';
require_once 'WalletProviders/XapoWalletProvider.php';
require_once 'WalletProviders/EpayWalletProvider.php';
require_once 'WalletProviders/FaucetBOXWalletProvider.php';
define("COIN_NAME", getCoinName($coinType));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment