示例#1
0
 public function testPaymentAviso()
 {
     $this->requestData = ['requestDatetime' => '2011-05-04T20:38:00.000+04:00', 'action' => 'paymentAviso', 'md5' => '45125C95A20A7F25B63D58EA304AFED2', 'shopId' => $this->shopId, 'shopArticleId' => '456', 'invoiceId' => $this->invoiceId, 'customerNumber' => '8123294469', 'orderCreatedDatetime' => '2011-05-04T20:38:00.000+04:00', 'orderSumAmount' => '87.10', 'orderSumCurrencyPaycash' => '643', 'orderSumBankPaycash' => '1001', 'shopSumAmount' => '86.23', 'shopSumCurrencyPaycash' => '643', 'shopSumBankPaycash' => '1001', 'paymentDatetime' => '2011-05-04T20:38:10.000+04:00', 'paymentPayerCode' => '42007148320', 'paymentType' => 'AC', 'cps_user_country_code' => 'RU', 'MyField' => 'My value'];
     $this->responseData = ['performedDatetime' => $this->performedDatetime, 'invoiceId' => $this->invoiceId, 'shopId' => $this->shopId];
     $this->specify('It should return OK when request is valid AND callback return true', function () {
         $this->fillPaymentAvisoRequest($this->requestData);
         $this->expectsPaymentAvisoRequestIsValid();
         $this->expectsPaymentAvisoCallbackReturn(true);
         $xml = $this->makePaymentAvisoResponseXml(['code' => YandexKassaResponse::STATUS_SUCCESS]);
         $this->assertXmlStringEqualsXmlString($xml, $this->kassa->createPaymentAvisoResponse($this->requestData)->getContent());
     });
     $this->specify('It should return with error when request is invalid', function () {
         $this->fillPaymentAvisoRequest($this->requestData);
         $this->expectsPaymentAvisoCallbackReturn(true);
         $this->expectsPaymentAvisoRequestIsInvalid();
         $xml = $this->makePaymentAvisoResponseXml(['code' => YandexKassaResponse::STATUS_AUTHORIZE_ERROR, 'message' => YandexKassaResponse::MESSAGE_INVALID_REQUEST]);
         $this->assertXmlStringEqualsXmlString($xml, $this->kassa->createPaymentAvisoResponse($this->requestData)->getContent());
     });
     $this->specify('It should return empty response when order check callback return false', function () {
         $this->fillPaymentAvisoRequest($this->requestData);
         $this->expectsPaymentAvisoCallbackReturn(false);
         $this->expectsPaymentAvisoRequestIsValid();
         $this->assertEmpty($this->kassa->createPaymentAvisoResponse($this->requestData)->getContent());
     });
 }
示例#2
0
 public function createPaymentAvisoResponse(array $requestData)
 {
     return $this->kassa->createPaymentAvisoResponse($requestData);
 }