Exemplo n.º 1
0
 protected function setUp()
 {
     parent::setUp();
     $this->beforeSpecify(function () {
         $this->checkOrderRequest = Mockery::mock('sergasd\\yandexkassa\\CheckOrderRequest');
         $this->paymentAvisoRequest = Mockery::mock('sergasd\\yandexkassa\\PaymentAvisoRequest');
         $this->requestFactory = Mockery::mock('sergasd\\yandexkassa\\RequestFactory');
         $this->requestFactory->shouldReceive('createCheckOrderRequest')->andReturn($this->checkOrderRequest);
         $this->requestFactory->shouldReceive('createPaymentAvisoRequest')->andReturn($this->paymentAvisoRequest);
         $this->requestHandler = Mockery::mock('sergasd\\yandexkassa\\IRequestHandler');
         $this->kassa = new YandexKassa($this->requestHandler, $this->requestFactory);
         $this->kassa->shopId = $this->shopId;
         $this->kassa->shopPassword = $this->shopPassword;
     });
 }
Exemplo n.º 2
0
 public function testCreatePaymentAvisoRequest()
 {
     $this->specify('It should create payment aviso request with properties', function () {
         $requestData = ['requestDatetime' => '2011-05-04T20:38:00.000+04:00', 'action' => 'checkOrder', 'md5' => '8256D2A032A35709EAF156270C9EFE2E', 'shopId' => '13', 'shopArticleId' => '456', 'invoiceId' => '1234567', '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', 'paymentPayerCode' => '42007148320', 'paymentType' => 'AC', 'myCustomField1' => 'value1', 'myCustomField2' => 'value2'];
         $request = $this->requestFactory->createPaymentAvisoRequest($requestData);
         foreach ($requestData as $attributeName => $value) {
             if (property_exists(get_class($request), $attributeName)) {
                 $this->assertEquals($value, $request->{$attributeName});
             }
         }
         $this->assertEquals('value1', $request->customFields['myCustomField1']);
         $this->assertEquals('value2', $request->customFields['myCustomField2']);
         $this->assertEquals($this->secret, $this->readAttribute($request, 'secretKey'));
     });
 }