/**
  * @expectedException  \Laratalks\PaymentGateways\Exceptions\PaymentGatewayBadRequestException
  */
 public function testCallAndGetReturnUrlExceptedException()
 {
     $needs = new PaymentRequestNeeds(1000, 'http://localhost/');
     $needs->set('description', 'something');
     $paymentResponse = $this->provider->callPaymentRequest($needs);
     $this->assertTrue($paymentResponse instanceof PaymentRequestResponse);
 }
Exemplo n.º 2
0
    }
}
$manager->extend('example', function () {
    return new ExampleProvider();
});
/**
 * PaymentRequestNeeds
 * you can create new PaymentRequestNeeds
 * and customize it for your own provider
 *
 * for more information read Default payment providers
 */
$requestNeeds = new PaymentRequestNeeds();
$requestNeeds->setAmount(1000);
$requestNeeds->setReturnUrl('YOUR_CALLBACK_URL');
$requestNeeds->set('attr', 'value');
// Call with provider name
// by this, you can change provider on-the-fly
$manager->provider('example')->callPaymentRequest($requestNeeds);
// OR set provider as default provider
// this set example as default provider
// and you can call provider methods directly from manager
$manager->setDefaultProvider('example');
$response = $manager->callPaymentRequest($requestNeeds);
$verifyNeeds = new PaymentNeeds();
$verifyNeeds->set('amount', 1000);
$verifyNeeds->set('payment_id', 15415648);
$response = $manager->callPaymentVerify($verifyNeeds);
// Zarinpal example
$provider = $manager->provider('zarinpal');
// create payment request: