Exemple #1
0
 /**
  * @dataProvider getPayment
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $instance = Gateway::getPayment(['wechat' => 'native']);
     $this->object = new Pay($instance);
 }
Exemple #2
0
 /**
  * @covers pay\Gateway::getPayment
  * @todo   Implement testGetPayment().
  */
 public function testGetPayment()
 {
     $instance = $this->object->getPayment(array('wechat' => 'jsapi'));
     $this->assertInstanceOf('pay\\gateway\\GatewayInterface', $instance);
 }
Exemple #3
0
$object = new Pay($instance);
$data = array('subject' => 'test', 'out_trade_no' => date('Ymd') . mt_rand(10000, 99999), 'total_amount' => 0.01);
try {
    $result = $object->createOrder($data);
    var_dump('alipay_qrcode:');
    var_dump($result);
} catch (\Exception $e) {
    var_dump('alipay_qrcode:' . $e->getMessage());
}
//手机网站即时到账支付
$instance = Gateway::getPayment(['alipay' => 'wap']);
$object = new Pay($instance);
$data = array('subject' => 'test', 'out_trade_no' => date('Ymd') . mt_rand(10000, 99999), 'total_fee' => 0.01, 'show_url' => 'http://www.lohas100.com');
try {
    $result = $object->createOrder($data);
    var_dump('alipay_wap:');
    var_dump($result);
} catch (\Exception $e) {
    var_dump('alipay_wap:' . $e->getMessage());
}
//即时到账支付
$instance = Gateway::getPayment(['alipay' => 'wap']);
$object = new Pay($instance);
$data = array('subject' => 'test', 'out_trade_no' => date('Ymd') . mt_rand(10000, 99999), 'total_fee' => 0.01);
try {
    $result = $object->createOrder($data);
    var_dump('alipay_web:');
    var_dump($result);
} catch (\Exception $e) {
    var_dump('alipay_web:' . $e->getMessage());
}