/** * {@inheritDoc} * @return ResponseInterface * @throws InvalidResponseException */ public function handleResponse(BillableInterface $billable, $params = []) { if ($params['trans_number'] != $billable->getBillableId()) { throw new InvalidResponseException('Billable id does not match with trans number'); } return new Response($billable, $params['success'], $params['error_code'], $params['error_desc'], $params['card_number']); }
public function it_should_run_transasction_validator_on_validating(TransactionValidator $validator, BillableInterface $billable) { $billable->getPaymentPrice()->willReturn(500); $billable->getBillableId()->willReturn('billable-id'); $validator->handle('billable-id', 500)->shouldBeCalled(); $this->setValidator($validator); $this->validate(); }
public function it_should_not_handle_a_response_when_billable_id_did_not_match_with_trans_number(BillableInterface $billable) { $billable->getBillableId()->willReturn('billable-id'); $params = ['trans_number' => 'wrong-billable-id']; $this->shouldThrow('Selmonal\\Payment\\Exceptions\\InvalidResponseException')->duringHandleResponse($billable, $params); }