예제 #1
0
<?php

// Run on console:
// php -f .\sample\payment-api\DeletePaymentEndpoint.php
require __DIR__ . '/../bootstrap.php';
use BlockCypher\Auth\SimpleTokenCredential;
use BlockCypher\Client\PaymentForwardClient;
use BlockCypher\Rest\ApiContext;
$apiContext = ApiContext::create('main', 'btc', 'v1', new SimpleTokenCredential('c0afcccdde5081d6429de37d16166ead'), array('mode' => 'sandbox', 'log.LogEnabled' => true, 'log.FileName' => 'BlockCypher.log', 'log.LogLevel' => 'DEBUG'));
$paymentForwardClient = new PaymentForwardClient($apiContext);
$paymentForwardClient->deleteForwardingAddress('1fdf8f9b-cc37-4955-882b-8cbcd670a433');
ResultPrinter::printResult("Delete Payment Endpoint", "PaymentForward", '1fdf8f9b-cc37-4955-882b-8cbcd670a433', null, null);
예제 #2
0
<?php

// Run on console:
// php -f .\sample\payment-api\ListPaymentsEndpoint.php
require __DIR__ . '/../bootstrap.php';
use BlockCypher\Auth\SimpleTokenCredential;
use BlockCypher\Client\PaymentForwardClient;
use BlockCypher\Rest\ApiContext;
$apiContext = ApiContext::create('main', 'btc', 'v1', new SimpleTokenCredential('c0afcccdde5081d6429de37d16166ead'), array('mode' => 'sandbox', 'log.LogEnabled' => true, 'log.FileName' => 'BlockCypher.log', 'log.LogLevel' => 'DEBUG'));
$paymentForwardClient = new PaymentForwardClient($apiContext);
$paymentForwardArray = $paymentForwardClient->listForwardingAddresses();
ResultPrinter::printResult("List all PaymentForwards", "PaymentForward[]", null, null, $paymentForwardArray);
 /**
  * @dataProvider mockProvider
  * @param PaymentForwardClient $obj
  * @param PHPUnit_Framework_MockObject_MockObject|ApiContext $mockApiContext
  * @param PHPUnit_Framework_MockObject_MockObject|BlockCypherRestCall $mockBlockCypherRestCall
  */
 public function testDelete($obj, $mockApiContext, $mockBlockCypherRestCall)
 {
     $mockBlockCypherRestCall->expects($this->any())->method('execute')->will($this->returnValue(true));
     $result = $obj->delete(PaymentForwardTest::getObject()->getId(), $mockApiContext, $mockBlockCypherRestCall);
     $this->assertNotNull($result);
 }
예제 #4
0
<?php

// Run on console:
// php -f .\sample\payment-api\CreatePaymentEndpoint.php
require __DIR__ . '/../bootstrap.php';
use BlockCypher\Api\PaymentForward;
use BlockCypher\Auth\SimpleTokenCredential;
use BlockCypher\Client\PaymentForwardClient;
use BlockCypher\Rest\ApiContext;
$apiContext = ApiContext::create('main', 'btc', 'v1', new SimpleTokenCredential('c0afcccdde5081d6429de37d16166ead'), array('mode' => 'sandbox', 'log.LogEnabled' => true, 'log.FileName' => 'BlockCypher.log', 'log.LogLevel' => 'DEBUG'));
$paymentForwardClient = new PaymentForwardClient($apiContext);
$options = array('callback_url' => 'http://requestb.in/rwp6jirw?uniqid=' . uniqid());
$paymentForward = $paymentForwardClient->createForwardingAddress('15qx9ug952GWGTNn7Uiv6vode4RcGrRemh', $options);
// For Sample Purposes Only.
$request = new PaymentForward();
$request->setDestination('15qx9ug952GWGTNn7Uiv6vode4RcGrRemh');
$request->setCallbackUrl('http://requestb.in/rwp6jirw?uniqid=' . uniqid());
ResultPrinter::printResult("Create Payment Endpoint", "PaymentForward", $paymentForward->getId(), $request, $paymentForward);