TestPay.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: stanley-king
  5. * Date: 16/6/15
  6. * Time: 下午3:12
  7. */
  8. define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
  9. require_once (BASE_ROOT_PATH . '/fooder.php');
  10. require_once (BASE_ROOT_PATH . '/helper/util_helper.php');
  11. require_once (BASE_ROOT_PATH . '/helper/pay/IPay.php');
  12. require_once (BASE_ROOT_PATH . '/helper/pay/aopay.php');
  13. require_once (BASE_ROOT_PATH . '/core/framework/function/http.php');
  14. class TestPay extends PHPUnit_Framework_TestCase
  15. {
  16. public static function setUpBeforeClass()
  17. {
  18. Base::run_util();
  19. }
  20. public static function tearDownAfterClass()
  21. {
  22. }
  23. public function testAdd()
  24. {
  25. $y = unserialize('a:8:{s:11:"home1_title";s:9:"那句好";s:5:"image";s:0:"";s:9:"show_type";s:4:"vote";s:9:"show_data";s:0:"";s:4:"type";s:4:"vote";s:4:"data";s:75:"[{"id":0,"text":"u7b2cu4e00u53e5"},{"id":1,"text":"u7b2cu4e8cu53e5"}]";s:5:"title";s:9:"那句好";s:8:"reserved";s:11:"vote_type=0";}');
  26. $mobiles = array();
  27. $mobiles['139111269867'] = '江海苗C';
  28. $mobiles['139111269868'] = '江海苗C';
  29. $mobiles['139111269869'] = '江海苗C';
  30. }
  31. public function testSerialize()
  32. {
  33. $data = array (
  34. 'home1_title' => '今年春节放几天假',
  35. 'image' => '',
  36. 'show_type' => 'vote',
  37. 'show_data' => '',
  38. 'type' => 'vote',
  39. 'data' => '[{"id":0,"text":"\\u4e00\\u5929"},{"id":1,"text":"\\u4e24\\u5929"},{"id":2,"text":"\\u4e09\\u5929"}]',
  40. 'title' => '今年春节放几天假',
  41. 'reserved' => 'vote_type=0',
  42. );
  43. $x = serialize($data);
  44. $y = unserialize($x);
  45. }
  46. public function testAopay()
  47. {
  48. $payer = new Pay\aopay();
  49. $ret = $payer->gen_pay('100510761183646482',0.01,'8000000000002204',"实物订单");
  50. }
  51. public function testHfivePay()
  52. {
  53. $body = '<xml><appid><![CDATA[wxfdaeb25e38c4c47e]]></appid>
  54. <attach><![CDATA[590604488911416534]]></attach>
  55. <bank_type><![CDATA[CFT]]></bank_type>
  56. <cash_fee><![CDATA[15400]]></cash_fee>
  57. <fee_type><![CDATA[CNY]]></fee_type>
  58. <is_subscribe><![CDATA[N]]></is_subscribe>
  59. <mch_id><![CDATA[1380733702]]></mch_id>
  60. <nonce_str><![CDATA[0al5w566fsnpvn56zoo5lbf59kymmhbs]]></nonce_str>
  61. <openid><![CDATA[oQH7D5My2UkjSWv-7YYwM-faZ_3c]]></openid>
  62. <out_trade_no><![CDATA[590604488911416534686]]></out_trade_no>
  63. <result_code><![CDATA[SUCCESS]]></result_code>
  64. <return_code><![CDATA[SUCCESS]]></return_code>
  65. <sign><![CDATA[7C677137D72376B9B1815D1F084FC068]]></sign>
  66. <time_end><![CDATA[20190226093533]]></time_end>
  67. <total_fee>15400</total_fee>
  68. <trade_type><![CDATA[MWEB]]></trade_type>
  69. <transaction_id><![CDATA[4200000279201902260421273158]]></transaction_id>
  70. </xml>^M';
  71. $resp = http_post_data('https://passport.lrlz.com/mobile/web_wxnotify.php',$body);
  72. }
  73. }