Пример #1
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_returns_requests_marked_as_success_from_completed(Transaction $model, BitPayResponse $response, GetStatusInterface $request)
 {
     $model->getResponse()->willReturn($response);
     $response->getStatus()->willReturn(BitPayResponse::STATUS_COMPLETE);
     $request->getModel()->willReturn($model);
     $request->markSuccess()->shouldBeCalled();
     $this->execute($request);
 }