function it_returns_requests_marked_as_unknown(Transaction $model, BitPayResponse $response, GetStatusInterface $request)
 {
     $model->getResponse()->willReturn($response);
     $response->getStatus()->willReturn('unknown_status');
     $request->getModel()->willReturn($model);
     $request->markUnknown()->shouldBeCalled();
     $this->execute($request);
 }
示例#2
0
 /**
  * @param Transaction $model
  *
  * @return void
  */
 protected function doUpdateModel($model)
 {
     echo "Invoice {$model->getResponse()->getId()} has been stored\n";
 }
示例#3
0
<?php

/**
 * @author      Peter Fox <*****@*****.**>
 * @copyright   Peter Fox 2014
 *
 * @package     payum-bitpay
 */
require_once __DIR__ . '/config.php';
use Payum\Core\Request\Capture;
use Payum\Core\Request\GetHumanStatus;
use PayumBitPay\Model\Transaction;
// Create the Transaction and configure the invoice request
$model = new Transaction();
$model->createRequest(0.0001, 'BTC')->setItemCode('TEST-ITEM-001')->setItemDesc('This is a test item using Payum BitPay')->setOrderID('TEST-ORDER-001');
// Request the invoice and check the current status
$payment = $registry->getPayment('bitpay');
$payment->execute(new Capture($model));
$payment->execute($status = new GetHumanStatus($model));
// If the status is new then it was created, BitPay will only make a request as complete
// when the invoice is paid and the blockchain has confirmed the payment which
// you would typically handle with HTTPS notifications
if ($status->isNew()) {
    echo "You can access your invoice at {$model->getResponse()->getUrl()}\n";
} else {
    if ($status->isFailed()) {
        echo "An error occured\n";
    } else {
        echo "Something went wrong but we don`t know the exact status\n";
    }
}