add config and support for alt domains/ports
This commit is contained in:
parent
bbeba01571
commit
0f4a101d50
|
@ -1 +1,2 @@
|
|||
*.swp
|
||||
lib/bitpay/bp_config.php
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
$bpconfig_host="bitpay.com";
|
||||
$bpconfig_port="";
|
||||
$bpconfig_hostAndPort=$bpconfig_host;
|
||||
if (strlen($bpconfig_port)>0)
|
||||
$bpconfig_hostAndPort.=":".$bpconfig_port;
|
||||
?>
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
require_once 'bp_config_default.php';
|
||||
if (file_exists('bp_config.php'))
|
||||
require_once 'bp_config.php';
|
||||
require_once 'bp_options.php';
|
||||
|
||||
function bpCurl($url, $apiKey, $post = false) {
|
||||
|
@ -80,7 +83,7 @@ function bpCreateInvoice($orderId, $price, $posData, $options = array()) {
|
|||
$post[$o] = $options[$o];
|
||||
$post = json_encode($post);
|
||||
|
||||
$response = bpCurl('https://bitpay.com/api/invoice/', $options['apiKey'], $post);
|
||||
$response = bpCurl('https://'.$bpconfig_hostAndPort.'/api/invoice/', $options['apiKey'], $post);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
@ -117,7 +120,7 @@ function bpGetInvoice($invoiceId, $apiKey=false) {
|
|||
if (!$apiKey)
|
||||
$apiKey = $bpOptions['apiKey'];
|
||||
|
||||
$response = bpCurl('https://bitpay.com/api/invoice/'.$invoiceId, $apiKey);
|
||||
$response = bpCurl('https://'.$bpconfig_hostAndPort.'/api/invoice/'.$invoiceId, $apiKey);
|
||||
if (is_string($response))
|
||||
return $response; // error
|
||||
$response['posData'] = json_decode($response['posData'], true);
|
||||
|
@ -127,4 +130,4 @@ function bpGetInvoice($invoiceId, $apiKey=false) {
|
|||
}
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue