pingpp 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pingpp/batch_transfer.rb +5 -0
- data/lib/pingpp/version.rb +1 -1
- data/test/balance_test.rb +34 -0
- data/test/balance_transaction_test.rb +20 -0
- data/test/batch_refund_test.rb +41 -0
- data/test/batch_transfer_test.rb +71 -0
- data/test/batch_withdrawal_test.rb +20 -0
- data/test/charge_test.rb +51 -0
- data/test/coupon_template_test.rb +34 -0
- data/test/customs_test_bak.rb +32 -0
- data/test/order_refund_test.rb +19 -0
- data/test/order_test.rb +57 -0
- data/test/refund_test.rb +33 -0
- data/test/ruby_version_test.rb +9 -0
- data/test/test_assistant.rb +34 -0
- data/test/test_data.rb +61 -0
- data/test/transaction_statistics_test.rb +14 -0
- data/test/user_test.rb +33 -0
- metadata +36 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8f53007b5dd51db5fd3d152e791d3cd7648b9d1
|
4
|
+
data.tar.gz: 416dde32d6e1fcabd2c6d0f1b0fa8d8ab44234a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 047eec644d6721d68432edd081247649c053b72ced74689aca3220645a8cd3914ef4c5242ab9c97437fe8bb2d4989512fde1d6536d2900b7939e3dee3a1e95c7
|
7
|
+
data.tar.gz: 2601c98fc1e10ff69dc70fb149c707c5377110bac632d8e053918f0a81138f860266ae5fb7296bade6a7b45611c4a7fc1ef488b9dd491603cfdfea5f4dff8401
|
@@ -2,6 +2,7 @@ module Pingpp
|
|
2
2
|
class BatchTransfer < APIResource
|
3
3
|
extend Pingpp::APIOperations::Create
|
4
4
|
extend Pingpp::APIOperations::List
|
5
|
+
include Pingpp::APIOperations::Update
|
5
6
|
|
6
7
|
def self.object_name
|
7
8
|
'batch_transfer'
|
@@ -10,5 +11,9 @@ module Pingpp
|
|
10
11
|
def self.resource_url(opts={})
|
11
12
|
'/v1/batch_transfers'
|
12
13
|
end
|
14
|
+
|
15
|
+
def self.cancel(id, opts={})
|
16
|
+
update(id, {:status => 'canceled'}, opts)
|
17
|
+
end
|
13
18
|
end
|
14
19
|
end
|
data/lib/pingpp/version.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path('../test_assistant', __FILE__)
|
2
|
+
require "digest/md5"
|
3
|
+
|
4
|
+
module Pingpp
|
5
|
+
class BalanceTest < Test::Unit::TestCase
|
6
|
+
should "execute should return a transfer balance_transaction" do
|
7
|
+
obj = Pingpp::Balance.create_transfer(
|
8
|
+
:user => 'test_user_001',
|
9
|
+
:recipient => 'test_user_004',
|
10
|
+
:description => 'Balance transfer description.',
|
11
|
+
:amount => 200
|
12
|
+
)
|
13
|
+
|
14
|
+
puts obj
|
15
|
+
|
16
|
+
assert obj.object == 'balance_transaction'
|
17
|
+
end
|
18
|
+
|
19
|
+
should "execute should return a receipts balance_transaction list" do
|
20
|
+
obj = Pingpp::Balance.create_receipts(
|
21
|
+
:type => 'receipts_earning',
|
22
|
+
:description => 'Balance receipts description.',
|
23
|
+
:receipts => [
|
24
|
+
{ :user => 'test_user_001', :amount => 500 },
|
25
|
+
{ :user => 'test_user_003', :amount => 700 }
|
26
|
+
]
|
27
|
+
)
|
28
|
+
|
29
|
+
puts obj
|
30
|
+
|
31
|
+
assert obj.object == 'list'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path('../test_assistant', __FILE__)
|
2
|
+
require "digest/md5"
|
3
|
+
|
4
|
+
module Pingpp
|
5
|
+
class BalanceTransactionTest < Test::Unit::TestCase
|
6
|
+
should "execute should return a balance_transaction list when passed correct parameters" do
|
7
|
+
txns = Pingpp::BalanceTransaction.list({:per_page => 3}, {:user => get_user_id})
|
8
|
+
|
9
|
+
assert txns.object == 'list'
|
10
|
+
assert txns.data.count <= 3
|
11
|
+
end
|
12
|
+
|
13
|
+
should "execute should return an exist balance_transaction when passed correct id" do
|
14
|
+
txn = Pingpp::BalanceTransaction.retrieve(get_txn_id, {:user => get_user_id})
|
15
|
+
|
16
|
+
assert txn.object == 'balance_transaction'
|
17
|
+
assert txn.id == get_txn_id
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require File.expand_path('../test_assistant', __FILE__)
|
2
|
+
require "digest/md5"
|
3
|
+
|
4
|
+
module Pingpp
|
5
|
+
class BatchRefundTest < Test::Unit::TestCase
|
6
|
+
should "execute should return a new batch_refund when passed correct parameters" do
|
7
|
+
batch_no = Digest::MD5.hexdigest(Time.now.to_i.to_s)[0,12]
|
8
|
+
|
9
|
+
params = {
|
10
|
+
:app => get_app_id,
|
11
|
+
:batch_no => batch_no,
|
12
|
+
:charges => make_charges_for_batch_refund,
|
13
|
+
:description => 'This is a batch_refund test.',
|
14
|
+
:metadata => {
|
15
|
+
:custom_key => 'custom_content'
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
batre = Pingpp::BatchRefund.create(params)
|
20
|
+
assert batre.object == 'batch_refund'
|
21
|
+
|
22
|
+
assert batre.charges == params[:charges]
|
23
|
+
assert batre.batch_no = params[:batch_no]
|
24
|
+
end
|
25
|
+
|
26
|
+
should "execute should return a batch_refund list" do
|
27
|
+
batres = Pingpp::BatchRefund.list(:per_page => 3)
|
28
|
+
|
29
|
+
assert batres.object == 'list'
|
30
|
+
assert batres.url.start_with?('/v1/batch_refunds')
|
31
|
+
assert batres.data.length <= 3
|
32
|
+
end
|
33
|
+
|
34
|
+
should "execute should return an exist batch_refund when passed correct id" do
|
35
|
+
batre = Pingpp::BatchRefund.retrieve(get_bat_re_id)
|
36
|
+
|
37
|
+
assert batre.id == get_bat_re_id
|
38
|
+
assert batre.object == 'batch_refund'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require File.expand_path('../test_assistant', __FILE__)
|
2
|
+
require "digest/md5"
|
3
|
+
|
4
|
+
module Pingpp
|
5
|
+
class BatchTransferTest < Test::Unit::TestCase
|
6
|
+
should "execute should return a new batch_transfer when passed correct parameters" do
|
7
|
+
batch_no = Digest::MD5.hexdigest(Time.now.to_i.to_s)[0,12]
|
8
|
+
|
9
|
+
params = {
|
10
|
+
:app => get_app_id,
|
11
|
+
:batch_no => batch_no,
|
12
|
+
:channel => 'unionpay',
|
13
|
+
:amount => 700,
|
14
|
+
:type => 'b2c',
|
15
|
+
:description => 'This is a batch_transfer test.',
|
16
|
+
:metadata => {
|
17
|
+
:custom_key => 'custom_content'
|
18
|
+
},
|
19
|
+
:currency => 'cny',
|
20
|
+
:recipients => [
|
21
|
+
{
|
22
|
+
:amount => 300,
|
23
|
+
:name => 'name01',
|
24
|
+
:open_bank_code => '0102',
|
25
|
+
:account => '6226000022223333'
|
26
|
+
}, {
|
27
|
+
:amount => 400,
|
28
|
+
:name => 'name02',
|
29
|
+
:open_bank_code => '0102',
|
30
|
+
:account => '622600002222334'
|
31
|
+
}
|
32
|
+
]
|
33
|
+
}
|
34
|
+
|
35
|
+
battr = Pingpp::BatchTransfer.create(params)
|
36
|
+
|
37
|
+
puts battr
|
38
|
+
|
39
|
+
assert battr.object == 'batch_transfer'
|
40
|
+
assert battr.amount == params[:amount]
|
41
|
+
assert battr.batch_no = params[:batch_no]
|
42
|
+
assert battr.app == params[:app]
|
43
|
+
assert battr.recipients.count == params[:recipients].count
|
44
|
+
end
|
45
|
+
|
46
|
+
should "execute should return a batch_transfer list" do
|
47
|
+
batres = Pingpp::BatchTransfer.list(:per_page => 3)
|
48
|
+
|
49
|
+
assert batres.object == 'list'
|
50
|
+
assert batres.url.start_with?('/v1/batch_transfers')
|
51
|
+
assert batres.data.count <= 3
|
52
|
+
end
|
53
|
+
|
54
|
+
should "execute should return an exist batch_transfer when passed correct id" do
|
55
|
+
batre = Pingpp::BatchTransfer.retrieve("1801612271223448888")
|
56
|
+
puts batre
|
57
|
+
|
58
|
+
assert batre.id == get_bat_tr_id
|
59
|
+
assert batre.object == 'batch_transfer'
|
60
|
+
end
|
61
|
+
|
62
|
+
should "execute should return a canceled batch_transfer" do
|
63
|
+
# # batres = Pingpp::BatchTransfer.list(:per_page => 3)
|
64
|
+
# # puts batres
|
65
|
+
# batre = Pingpp::BatchTransfer.retrieve('1811612271212521002')
|
66
|
+
# puts batre
|
67
|
+
# batre = Pingpp::BatchTransfer.cancel('1811612271212521002')
|
68
|
+
# puts batre
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path('../test_assistant', __FILE__)
|
2
|
+
require "digest/md5"
|
3
|
+
|
4
|
+
module Pingpp
|
5
|
+
class BatchWithdrawalTest < Test::Unit::TestCase
|
6
|
+
should "execute should return a batch_withdrawal object when passed correct parameters" do
|
7
|
+
params = {
|
8
|
+
:withdrawals => [
|
9
|
+
'1701611160206541729',
|
10
|
+
'1701611160207110403'
|
11
|
+
]
|
12
|
+
}
|
13
|
+
bw = Pingpp::BatchWithdrawal.create(params)
|
14
|
+
|
15
|
+
puts bw
|
16
|
+
|
17
|
+
assert bw.object == 'batch_withdrawal'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/test/charge_test.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.expand_path('../test_assistant', __FILE__)
|
2
|
+
require "digest/md5"
|
3
|
+
|
4
|
+
module Pingpp
|
5
|
+
class ChargeTest < Test::Unit::TestCase
|
6
|
+
should "execute should return a new, fully executed charge when passed correct parameters" do
|
7
|
+
order_no = Digest::MD5.hexdigest(Time.now.to_i.to_s)[0,12]
|
8
|
+
channel = 'wx'
|
9
|
+
|
10
|
+
params = {
|
11
|
+
:order_no => order_no,
|
12
|
+
:app => { :id => get_app_id },
|
13
|
+
:channel => channel, # 支付使用的第三方支付渠道取值,请参考:https://www.pingxx.com/api#api-c-new
|
14
|
+
:amount => 128000, # 订单总金额, 人民币单位:分(如订单总金额为 1 元,此处请填 100)
|
15
|
+
:client_ip => "127.0.0.1", # 发起支付请求客户端的 IP 地址,格式为 IPV4,如: 127.0.0.1
|
16
|
+
:currency => "cny",
|
17
|
+
:subject => "Your Subject",
|
18
|
+
:body => "Your Body",
|
19
|
+
:extra => {}
|
20
|
+
}
|
21
|
+
|
22
|
+
c = Pingpp::Charge.create(params)
|
23
|
+
|
24
|
+
assert c.order_no == params[:order_no]
|
25
|
+
assert c.app == get_app_id
|
26
|
+
assert c.channel == params[:channel]
|
27
|
+
assert c.amount == params[:amount]
|
28
|
+
assert c.paid == false
|
29
|
+
end
|
30
|
+
|
31
|
+
should "execute should return a charge list when passed correct parameters" do
|
32
|
+
l = Pingpp::Charge.list(
|
33
|
+
:app => { :id => get_app_id },
|
34
|
+
:limit => 3,
|
35
|
+
:paid => true,
|
36
|
+
:refunded => false
|
37
|
+
)
|
38
|
+
|
39
|
+
assert l.object == 'list'
|
40
|
+
assert l.data.count <= 3
|
41
|
+
end
|
42
|
+
|
43
|
+
should "execute should return an exist charge when passed correct charge id" do
|
44
|
+
ch_id = get_charge_id # 'ch_0mLyb5KmffX5yrnb1OvLKKSO'
|
45
|
+
c = Pingpp::Charge.retrieve(ch_id)
|
46
|
+
|
47
|
+
assert c.object == 'charge'
|
48
|
+
assert c.id == ch_id
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path('../test_assistant', __FILE__)
|
2
|
+
require "digest/md5"
|
3
|
+
|
4
|
+
module Pingpp
|
5
|
+
class CouponTemplateTest < Test::Unit::TestCase
|
6
|
+
should "execute should return a coupon_template list when passed correct parameters" do
|
7
|
+
ctmpl = Pingpp::CouponTemplate.list({:per_page => 3})
|
8
|
+
|
9
|
+
assert ctmpl.object == 'list'
|
10
|
+
assert ctmpl.data.count <= 3
|
11
|
+
end
|
12
|
+
|
13
|
+
should "execute should return an exist coupon_template when passed correct id" do
|
14
|
+
ctmpl = Pingpp::CouponTemplate.retrieve(get_coupon_template_id)
|
15
|
+
|
16
|
+
assert ctmpl.object == 'coupon_template'
|
17
|
+
assert ctmpl.id == get_coupon_template_id
|
18
|
+
end
|
19
|
+
|
20
|
+
should "execute should return a coupon list made from coupon_template when passed correct coupon_template_id" do
|
21
|
+
coupons = Pingpp::CouponTemplate.list_coupons(get_coupon_template_id, {:per_page => 3})
|
22
|
+
|
23
|
+
assert coupons.object == 'list'
|
24
|
+
assert coupons.data.count <= 3
|
25
|
+
end
|
26
|
+
|
27
|
+
# should "execute should return a coupon list made from coupon_template when passed correct coupon_template_id and parameters" do
|
28
|
+
# coupons = Pingpp::CouponTemplate.create_coupons(get_coupon_template_id, {:users => [get_user_id]})
|
29
|
+
#
|
30
|
+
# assert coupons.object == 'list'
|
31
|
+
# assert coupons.data.count <= 3
|
32
|
+
# end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.expand_path('../test_assistant', __FILE__)
|
2
|
+
require "digest/md5"
|
3
|
+
|
4
|
+
module Pingpp
|
5
|
+
class CustomsTest < Test::Unit::TestCase
|
6
|
+
should "execute should return a new customs when passed correct parameters" do
|
7
|
+
order_no = Digest::MD5.hexdigest(Time.now.to_i.to_s)[0,12]
|
8
|
+
channel = 'upacp'
|
9
|
+
|
10
|
+
params = {
|
11
|
+
:app => get_app_id,
|
12
|
+
:charge => get_charge_id,
|
13
|
+
:channel => channel,
|
14
|
+
:trade_no => order_no,
|
15
|
+
:customs_code => 'GUANGZHOU',
|
16
|
+
:amount => 10,
|
17
|
+
:transport_amount => 1,
|
18
|
+
:is_split => true,
|
19
|
+
:sub_order_no => 'subord11010002',
|
20
|
+
:extra => {
|
21
|
+
:pay_account => '1234567890',
|
22
|
+
:certif_type => '02',
|
23
|
+
:customer_name => 'name',
|
24
|
+
:certif_id => '1234',
|
25
|
+
:tax_amount => 1
|
26
|
+
}
|
27
|
+
}
|
28
|
+
cu = Pingpp::Customs.create(params)
|
29
|
+
puts cu
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path('../test_assistant', __FILE__)
|
2
|
+
require "digest/md5"
|
3
|
+
|
4
|
+
module Pingpp
|
5
|
+
class OrderRefundTest < Test::Unit::TestCase
|
6
|
+
should "execute should return a order_refund list when passed correct order id" do
|
7
|
+
l = Pingpp::OrderRefund.list('2001609130000002762')
|
8
|
+
puts l
|
9
|
+
assert l.object == 'list'
|
10
|
+
assert l.data.count <= 3
|
11
|
+
end
|
12
|
+
|
13
|
+
should "execute should return an exist order_refund when passed correct id" do
|
14
|
+
o = Pingpp::OrderRefund.retrieve('2001609130000002762', '2001609130000002763')
|
15
|
+
|
16
|
+
assert o.object == 'order_order'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/test/order_test.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require File.expand_path('../test_assistant', __FILE__)
|
2
|
+
require "digest/md5"
|
3
|
+
|
4
|
+
module Pingpp
|
5
|
+
class OrderTest < Test::Unit::TestCase
|
6
|
+
should "execute should return a new, fully executed order when passed correct parameters" do
|
7
|
+
order_no = Digest::MD5.hexdigest(Time.now.to_i.to_s)[0,12]
|
8
|
+
|
9
|
+
params = {
|
10
|
+
:merchant_order_no => order_no,
|
11
|
+
:app => get_app_id,
|
12
|
+
:amount => 100, # 订单总金额, 人民币单位:分(如订单总金额为 1 元,此处请填 100)
|
13
|
+
:client_ip => "127.0.0.1", # 发起支付请求客户端的 IP 地址,格式为 IPV4,如: 127.0.0.1
|
14
|
+
:currency => "cny",
|
15
|
+
:subject => "Your Subject",
|
16
|
+
:body => "Your Body",
|
17
|
+
:uid => get_user_id
|
18
|
+
}
|
19
|
+
|
20
|
+
o = Pingpp::Order.create(params)
|
21
|
+
|
22
|
+
assert o.merchant_order_no == params[:merchant_order_no]
|
23
|
+
assert o.app == get_app_id
|
24
|
+
assert o.amount == 100
|
25
|
+
assert o.paid == false
|
26
|
+
end
|
27
|
+
|
28
|
+
should "execute should return an order list when passed correct parameters" do
|
29
|
+
l = Pingpp::Order.list(:app => get_app_id, :per_page => 3, :paid => true)
|
30
|
+
|
31
|
+
assert l.object == 'list'
|
32
|
+
assert l.data.count <= 3
|
33
|
+
end
|
34
|
+
|
35
|
+
should "execute should return an canceled order when passed correct id" do
|
36
|
+
o = Pingpp::Order.cancel(get_unpaid_order_id)
|
37
|
+
|
38
|
+
assert o.object == 'order'
|
39
|
+
assert o.status == 'canceled'
|
40
|
+
end
|
41
|
+
|
42
|
+
should "execute should return an exist order when passed correct id" do
|
43
|
+
o = Pingpp::Order.retrieve('2001609130000002762')
|
44
|
+
|
45
|
+
assert o.object == 'order'
|
46
|
+
end
|
47
|
+
|
48
|
+
should "execute should return an order with credential when passed correct id and parameters" do
|
49
|
+
o = Pingpp::Order.pay('2001609130000002762', {:balance_amount => 0,
|
50
|
+
:charge_amount => 10,
|
51
|
+
:channel => 'alipay'})
|
52
|
+
|
53
|
+
assert o.object == 'order'
|
54
|
+
assert o.has_key?('charge_essentials')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/test/refund_test.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path('../test_assistant', __FILE__)
|
2
|
+
require "digest/md5"
|
3
|
+
|
4
|
+
module Pingpp
|
5
|
+
class RefundTest < Test::Unit::TestCase
|
6
|
+
should "execute should return a refund list when passed correct parameters" do
|
7
|
+
l = Pingpp::Refund.list(get_charge_id, {:limit => 3})
|
8
|
+
|
9
|
+
assert l.object == 'list'
|
10
|
+
assert l.data.count <= 3
|
11
|
+
end
|
12
|
+
|
13
|
+
should "execute should return a refund when passed correct parameters" do
|
14
|
+
ch_id = get_charge_id
|
15
|
+
|
16
|
+
r = Pingpp::Refund.create(ch_id, {:amount => 1, :description => 'Refund amount test.'})
|
17
|
+
|
18
|
+
assert r.object == 'refund'
|
19
|
+
assert r.charge == ch_id
|
20
|
+
end
|
21
|
+
|
22
|
+
should "execute should return an exist refund when passed correct charge id and refund id" do
|
23
|
+
re_id = get_refund_id
|
24
|
+
ch_id = get_charge_id
|
25
|
+
|
26
|
+
r = Pingpp::Refund.retrieve(ch_id, re_id)
|
27
|
+
|
28
|
+
assert r.object == 'refund'
|
29
|
+
assert r.id == re_id
|
30
|
+
assert r.charge == ch_id
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'pingpp'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'mocha/setup'
|
4
|
+
require 'stringio'
|
5
|
+
require 'shoulda/context'
|
6
|
+
require File.expand_path('../test_data', __FILE__)
|
7
|
+
|
8
|
+
module Pingpp
|
9
|
+
@mock_rest_client = nil
|
10
|
+
|
11
|
+
def self.mock_rest_client=(mock_client)
|
12
|
+
@mock_rest_client = mock_client
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Test::Unit::TestCase
|
17
|
+
include Pingpp::TestData
|
18
|
+
include Mocha
|
19
|
+
|
20
|
+
setup do
|
21
|
+
@mock = mock
|
22
|
+
# Pingpp.mock_rest_client = @mock
|
23
|
+
Pingpp.api_base = 'https://apidev.afon.ninja'
|
24
|
+
Pingpp.api_key = get_api_key_live
|
25
|
+
Pingpp.app_id = get_app_id
|
26
|
+
|
27
|
+
Pingpp.private_key_path = File.expand_path('../rsa_private_key.pem', __FILE__)
|
28
|
+
end
|
29
|
+
|
30
|
+
teardown do
|
31
|
+
Pingpp.mock_rest_client = nil
|
32
|
+
Pingpp.api_key = nil
|
33
|
+
end
|
34
|
+
end
|
data/test/test_data.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
module Pingpp
|
2
|
+
module TestData
|
3
|
+
@charge_id_created = nil
|
4
|
+
|
5
|
+
def get_api_key
|
6
|
+
'sk_test_ibbTe5jLGCi5rzfH4OqPW9KC'
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_api_key_live
|
10
|
+
'sk_live_vjfr90jj1q985KuPO84iP8KO'
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_app_id
|
14
|
+
# 'app_1Gqj58ynP0mHeX1q'
|
15
|
+
'app_LibTW1n1SOq9Pin1'
|
16
|
+
end
|
17
|
+
|
18
|
+
def set_charge_id(ch_id)
|
19
|
+
@charge_id_created = ch_id
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_charge_id
|
23
|
+
'ch_rXvbvHyfLmWD0aSGKG488WnT'
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_refund_id
|
27
|
+
're_iXrDb5qF54OCz9mnH0844G0S'
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_bat_re_id
|
31
|
+
'1501611031340575011'
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_bat_tr_id
|
35
|
+
'1801611031338284973'
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_user_id
|
39
|
+
'test_user_001'
|
40
|
+
end
|
41
|
+
|
42
|
+
def get_txn_id
|
43
|
+
'310216101213443000003501'
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_coupon_template_id
|
47
|
+
'300116082416033500000800'
|
48
|
+
end
|
49
|
+
|
50
|
+
def get_unpaid_order_id
|
51
|
+
'2001611040000002171'
|
52
|
+
end
|
53
|
+
|
54
|
+
def make_charges_for_batch_refund
|
55
|
+
[
|
56
|
+
'ch_PyfLSGLiHKS0rDunTO4W9y18',
|
57
|
+
'ch_bfbjr5TaPG8CarLyHG1eHGK0'
|
58
|
+
]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.expand_path('../test_assistant', __FILE__)
|
2
|
+
|
3
|
+
module Pingpp
|
4
|
+
class TransactionStatisticsTest < Test::Unit::TestCase
|
5
|
+
should "execute should return a transaction_statistics object" do
|
6
|
+
ts = Pingpp::TransactionStatistics.retrieve(
|
7
|
+
:time_start => Time.now.to_i - 86400 * 60,
|
8
|
+
:time_end => Time.now.to_i - 86400 * 30
|
9
|
+
)
|
10
|
+
|
11
|
+
assert ts.object == 'transaction_statistics'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/test/user_test.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path('../test_assistant', __FILE__)
|
2
|
+
require "digest/md5"
|
3
|
+
|
4
|
+
module Pingpp
|
5
|
+
class UserTest < Test::Unit::TestCase
|
6
|
+
# should "execute should return a new user when passed correct parameters" do
|
7
|
+
# user_id = Digest::MD5.hexdigest(Time.now.to_i.to_s)[0,12]
|
8
|
+
#
|
9
|
+
# params = {
|
10
|
+
# :id => user_id
|
11
|
+
# }
|
12
|
+
#
|
13
|
+
# u = Pingpp::User.create(params)
|
14
|
+
#
|
15
|
+
# assert u.object == 'user'
|
16
|
+
# assert u.id == user_id
|
17
|
+
# end
|
18
|
+
|
19
|
+
should "execute should return an exist user when passed correct id" do
|
20
|
+
u = Pingpp::User.retrieve(get_user_id)
|
21
|
+
|
22
|
+
assert u.object == 'user'
|
23
|
+
assert u.id == get_user_id
|
24
|
+
end
|
25
|
+
|
26
|
+
should "execute should return a list of users when passed correct parameters" do
|
27
|
+
u = Pingpp::User.list(:per_page => 3)
|
28
|
+
|
29
|
+
assert u.object == 'list'
|
30
|
+
assert u.data.count <= 3
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pingpp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xufeng Weng
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -69,6 +69,22 @@ files:
|
|
69
69
|
- lib/pingpp/version.rb
|
70
70
|
- lib/pingpp/webhook.rb
|
71
71
|
- lib/pingpp/wx_pub_oauth.rb
|
72
|
+
- test/balance_test.rb
|
73
|
+
- test/balance_transaction_test.rb
|
74
|
+
- test/batch_refund_test.rb
|
75
|
+
- test/batch_transfer_test.rb
|
76
|
+
- test/batch_withdrawal_test.rb
|
77
|
+
- test/charge_test.rb
|
78
|
+
- test/coupon_template_test.rb
|
79
|
+
- test/customs_test_bak.rb
|
80
|
+
- test/order_refund_test.rb
|
81
|
+
- test/order_test.rb
|
82
|
+
- test/refund_test.rb
|
83
|
+
- test/ruby_version_test.rb
|
84
|
+
- test/test_assistant.rb
|
85
|
+
- test/test_data.rb
|
86
|
+
- test/transaction_statistics_test.rb
|
87
|
+
- test/user_test.rb
|
72
88
|
homepage: https://www.pingxx.com/api
|
73
89
|
licenses:
|
74
90
|
- MIT
|
@@ -89,8 +105,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
105
|
version: '0'
|
90
106
|
requirements: []
|
91
107
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.2.2
|
93
109
|
signing_key:
|
94
110
|
specification_version: 4
|
95
111
|
summary: Ruby bindings for the PingPlusPlus API
|
96
|
-
test_files:
|
112
|
+
test_files:
|
113
|
+
- test/balance_test.rb
|
114
|
+
- test/balance_transaction_test.rb
|
115
|
+
- test/batch_refund_test.rb
|
116
|
+
- test/batch_transfer_test.rb
|
117
|
+
- test/batch_withdrawal_test.rb
|
118
|
+
- test/charge_test.rb
|
119
|
+
- test/coupon_template_test.rb
|
120
|
+
- test/customs_test_bak.rb
|
121
|
+
- test/order_refund_test.rb
|
122
|
+
- test/order_test.rb
|
123
|
+
- test/refund_test.rb
|
124
|
+
- test/ruby_version_test.rb
|
125
|
+
- test/test_assistant.rb
|
126
|
+
- test/test_data.rb
|
127
|
+
- test/transaction_statistics_test.rb
|
128
|
+
- test/user_test.rb
|