代码拉取完成,页面将自动刷新
var api = new require("./index").WechatPayAPI({
appid:"XXXXXXXXXXXXXXXX",
mch_id:"XXXXXXXXXXX",
partner_key:"XXXXXXXXXXXXXXXX",
cert:"certs/apiclient_cert.pem",
cert_key:"certs/apiclient_key.pem"
});
//var item = {batch:"v0101",name:"tedi3231",age:2030};
//var str = api._generate_string_form_obj(item);
//console.log(str);
function test_unifiedorder(){
var order_item = {
notify_url:"http://wedo.avosapps.com/order/aa.php",
openid:"opmukt4SZzas_TinMqpT5JkC3z6Q",
out_trade_no:Number.parseInt(Math.random()*1000000),
spbill_create_ip:"14.23.150.211",
total_fee:1,
trade_type:"NATIVE",
body:"aavv"
};
api.unifiedorder(order_item).then(function(data){
console.log(data);
}).fail(function(err){
console.log(err);
});
}
test_unifiedorder();
api.orderquery("1005450053201511261776573190","").then(function(data){
console.log(data);
}).fail(function(err){
console.log(err);
});
/*
api.closeorder("35370664").then(function(data){
console.log(data);
}).fail(function(err){
console.log(err);
});
*/
/*
api.orderquery("1005450053201511261776573190","").then(function(data){
console.log("data is ",data);
});
*/
/*
var api = new require("./wxapi")("wxbd626ed750b05e5f","ca545a10101efc536107e8cf9eda83f7");
api.get_token().then(function(access_token){
console.log("access_token 1 is ",access_token);
});
setTimeout(function(){
api.get_token().then(function(access_token){
console.log("access_token 2 is ",access_token);
});
},10000);
api.get_ticket().then(function(access_token){
console.log("ticket 1 ",access_token);
});
setTimeout(function(){
api.get_ticket().then(function(access_token){
console.log("ticket 2 " ,access_token);
});
},10000);
setTimeout(function(){
api.get_sns_token("001d2b3c211a0b1858ee558bc9210388").then(function(res){
console.log("ticket 1 ",res);
});
},10000);
*/
/*
var https = require("https");
function test_https(){
var options = {
hostname: 'mail.qq.com',
port: 443,
path: '/',
method: 'GET',
};
var req = https.request(options,function(res){
console.log("Jejjjj");
console.log(res);
});
req.end();
}
*/
/*
https.get('https://mail.qq.com/', function(res) {
console.log("statusCode: ", res.statusCode);
console.log("headers: ", res.headers);
res.on('data', function(d) {
process.stdout.write(d);
});
}).on('error', function(e) {
console.error(e);
});
*/
//test_https();
/*
var q = require("q");
function test_promise(){
function one(){
var deferred = q.defer();
deferred.resolve(500);
return deferred.promise;
}
one().then(function(data){ console.log(data);});
}
test_promise();
*/
//测试退款功能
function test_refund(){
var params = {
device_info:"WEB",
transaction_id:"1005270053201511261778229445",
out_refund_no:"REFUND0001",
total_fee:1,
refund_fee:1,
refund_fee_type:"CNY",
op_user_id:"1289247501"
};
api.refund(params).then(function(data){
console.log("refund data is ", data);
}).fail(function(err){
console.log("refund erro is",err);
});
}
function test_refundquery(){
var params = {
device_info:"WEB",
transaction_id:"1005270053201511261778229445",
out_refund_no:"REFUND0001"
};
api.refund(params).then(function(data){
console.log("refundquery data is ", data);
}).fail(function(err){
console.log("refundquery erro is",err);
});
}
//test_refund();
function test_generate_barcode_url(){
var url = api.generate_barcode_url(Number.parseInt(Math.random()*100000000));
console.log("barcode url is ",url);
}
test_generate_barcode_url();
var test = function(){}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。