本文整理匯總了PHP中Gateway::getPayment方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gateway::getPayment方法的具體用法?PHP Gateway::getPayment怎麽用?PHP Gateway::getPayment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gateway
的用法示例。
在下文中一共展示了Gateway::getPayment方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUp
/**
* @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);
}
示例2: testGetPayment
/**
* @covers pay\Gateway::getPayment
* @todo Implement testGetPayment().
*/
public function testGetPayment()
{
$instance = $this->object->getPayment(array('wechat' => 'jsapi'));
$this->assertInstanceOf('pay\\gateway\\GatewayInterface', $instance);
}
示例3: Pay
$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());
}