File tree Expand file tree Collapse file tree 4 files changed +34
-12
lines changed Expand file tree Collapse file tree 4 files changed +34
-12
lines changed Original file line number Diff line number Diff line change 11// api_key 获取方式:登录 [Dashboard](https://dashboard.pingxx.com)->点击管理平台右上角公司名称->开发信息-> Secret Key
2- var API_KEY = " sk_test_ibbTe5jLGCi5rzfH4OqPW9KC"
2+ var API_KEY = ' sk_test_ibbTe5jLGCi5rzfH4OqPW9KC' ;
33// 设置 api_key
44var pingpp = require ( '../lib/pingpp' ) ( API_KEY ) ;
55
6- pingpp . charges . list ( { limit : 3 } , function ( err , charges ) {
7- if ( err != null ) {
8- console . log ( "pingpp.charges.list fail:" , err ) ;
6+ pingpp . charges . list (
7+ { limit : 3 , app : { id : 'app_1Gqj58ynP0mHeX1q' } } ,
8+ function ( err , charges ) {
9+ if ( err != null ) {
10+ console . log ( 'pingpp.charges.list fail:' , err ) ;
11+ }
12+ // YOUR CODE
13+ console . log ( charges ) ;
914 }
10- // YOUR CODE
11- } ) ;
15+ ) ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- var path = require ( 'path' ) ;
43var utils = require ( './utils' ) ;
54var OPTIONAL_REGEX = / ^ o p t i o n a l ! / ;
65
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ Pingpp.USER_AGENT = {
1616 platform : process . platform ,
1717 publisher : 'pingplusplus' ,
1818 uname : null
19- }
19+ } ;
2020
2121Pingpp . USER_AGENT_SERIALIZED = null ;
2222
@@ -37,7 +37,7 @@ var resources = {
3737var wxPubOauth = require ( './WxPubOauth' ) ;
3838var _ = require ( 'lodash' ) ;
3939var HEADERS_TO_PARSE = [ 'Pingpp-One-Version' , 'Pingpp-Sdk-Version' ] ;
40- var fs = require ( "fs" ) ;
40+ var fs = require ( 'fs' ) ;
4141
4242Pingpp . PingppResource = require ( './PingppResource' ) ;
4343Pingpp . resources = resources ;
@@ -137,7 +137,7 @@ Pingpp.prototype = {
137137 } ,
138138
139139 setPrivateKeyPath : function ( path ) {
140- this . _privateKey = fs . readFileSync ( path , " utf8" ) ;
140+ this . _privateKey = fs . readFileSync ( path , ' utf8' ) ;
141141 } ,
142142
143143 _prepResources : function ( ) {
@@ -161,7 +161,7 @@ Pingpp.prototype = {
161161 var self = this ;
162162 this [ 'wxPubOauth' ] = wxPubOauth ;
163163 this [ 'parseHeaders' ] = function ( headers ) {
164- if ( typeof headers == " undefined" ) {
164+ if ( typeof headers == ' undefined' ) {
165165 return ;
166166 }
167167 for ( var k in headers ) {
Original file line number Diff line number Diff line change 11'use strict' ;
22
33var PingppResource = require ( '../PingppResource' ) ;
4+ var Error = require ( '../Error' ) ;
45var pingppMethod = PingppResource . method ;
6+ var hasOwn = { } . hasOwnProperty ;
57
68module . exports = PingppResource . extend ( {
79
810 path : 'charges' ,
911
1012 includeBasic : [
11- 'create' , 'list' , ' retrieve'
13+ 'create' , 'retrieve'
1214 ] ,
1315
16+ _listCharges : pingppMethod ( {
17+ method : 'GET'
18+ } ) ,
19+
20+ list : function ( params , cb ) {
21+ if ( ! hasOwn . call ( params , 'app' )
22+ || typeof params . app != 'object'
23+ || ! hasOwn . call ( params . app , 'id' )
24+ ) {
25+ cb . call ( null , new Error . PingppInvalidRequestError ( {
26+ message : 'Please pass app[id] as parameter.'
27+ } ) ) ;
28+ } else {
29+ this . _listCharges ( params , cb ) ;
30+ }
31+ } ,
32+
1433 /**
1534 * Charge: Refund methods
1635 */
You can’t perform that action at this time.
0 commit comments