Exemplo n.º 1
0
 function it_should_mark_new_if_empty_model(GetStatusInterface $request)
 {
     $model = new ArrayObject(array());
     $request->getModel()->willReturn($model);
     $request->markNew()->shouldBeCalled();
     $this->execute($request);
 }
Exemplo n.º 2
0
 /**
  * @param GetStatusInterface $request
  */
 public function execute($request)
 {
     /** @var BitPayResponse $model */
     $model = $request->getModel()->getResponse();
     switch ($model->getStatus()) {
         case BitPayResponse::STATUS_NEW:
             $request->markNew();
             break;
         case BitPayResponse::STATUS_PAID:
             $request->markPending();
             break;
         case BitPayResponse::STATUS_INVALID:
             $request->markFailed();
             break;
         case BitPayResponse::STATUS_EXPIRED:
             $request->markExpired();
             break;
         case BitPayResponse::STATUS_CONFIRMED:
         case BitPayResponse::STATUS_COMPLETE:
             $request->markSuccess();
             break;
         default:
             $request->markUnknown();
     }
 }
 function it_should_mark_new_if_order_have_empty_payment_details(PaymentInterface $payment, GetStatusInterface $statusRequest)
 {
     $payment->getDetails()->willReturn(array());
     $statusRequest->getModel()->willReturn($payment);
     $statusRequest->markNew()->shouldBeCalled();
     $this->execute($statusRequest);
 }
 function it_returns_requests_marked_as_new(Transaction $model, BitPayResponse $response, GetStatusInterface $request)
 {
     $model->getResponse()->willReturn($response);
     $response->getStatus()->willReturn(BitPayResponse::STATUS_NEW);
     $request->getModel()->willReturn($model);
     $request->markNew()->shouldBeCalled();
     $this->execute($request);
 }
Exemplo n.º 5
0
 /**
  * @param GetStatusInterface $request
  */
 public function execute($request)
 {
     $model = $request->getModel();
     if (false == isset($model['status'])) {
         $request->markNew();
         return;
     }
     if (isset($model['status']) && 'captured' == $model['status']) {
         $request->markCaptured();
         return;
     }
     if (isset($model['status']) && 'error' == $model['status']) {
         $request->markFailed();
         return;
     }
     $request->markUnknown();
 }