Ejemplo n.º 1
0
 /**
  * @test
  */
 public function shouldAllowUpdatePayment()
 {
     $payment = new Payment();
     $payment->setId(uniqid());
     $payment->setTotalAmount(123);
     $payment->setClientEmail('*****@*****.**');
     $storage = $this->app['payum']->getStorage($payment);
     $storage->update($payment);
     //guard
     $this->getClient()->putJson('/payments/' . $payment->getId(), ['totalAmount' => 123, 'currencyCode' => 'USD', 'clientEmail' => '*****@*****.**', 'clientId' => 'theClientId']);
     $this->assertClientResponseStatus(200);
     $this->assertClientResponseContentJson();
     $content = $this->getClientResponseJsonContent();
     $this->assertObjectHasAttribute('payment', $content);
     $this->assertObjectHasAttribute('clientEmail', $content->payment);
     $this->assertEquals('*****@*****.**', $content->payment->clientEmail);
     $this->assertObjectHasAttribute('totalAmount', $content->payment);
     $this->assertEquals(123, $content->payment->totalAmount);
 }
Ejemplo n.º 2
0
 /**
  * @test
  */
 public function shouldAllowUpdatePayment()
 {
     $payment = new Payment();
     $payment->setTotalAmount(123);
     $payment->setClientEmail('*****@*****.**');
     $payment->setAfterUrl('http://example.com');
     $storage = $this->app['payum']->getStorage($payment);
     $storage->update($payment);
     $token = $this->app['payum.security.token_factory']->createToken('paypal_express_checkout', $payment, 'payment_get');
     //guard
     $this->getClient()->putJson('/payments/' . $token->getHash(), ['totalAmount' => 123, 'currencyCode' => 'USD', 'clientEmail' => '*****@*****.**', 'clientId' => 'theClientId', 'gatewayName' => 'stripe_js', 'afterUrl' => 'http://example.com']);
     $this->assertClientResponseStatus(200);
     $this->assertClientResponseContentJson();
     $content = $this->getClientResponseJsonContent();
     $this->assertObjectHasAttribute('payment', $content);
     $this->assertObjectHasAttribute('clientEmail', $content->payment);
     $this->assertEquals('*****@*****.**', $content->payment->clientEmail);
     $this->assertObjectHasAttribute('totalAmount', $content->payment);
     $this->assertEquals(123, $content->payment->totalAmount);
 }