stripe-cli 1.4.6 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -33
- data/lib/stripe/cli/commands.rb +1 -0
- data/lib/stripe/cli/commands/charges.rb +2 -2
- data/lib/stripe/cli/commands/refunds.rb +52 -0
- data/lib/stripe/cli/runner.rb +3 -2
- data/lib/stripe/cli/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afab1ce2dae3b3d4d5c028e647829d329ff2e324
|
4
|
+
data.tar.gz: d3a8fbcc13accd0a239dc90a3c01ccd47633d734
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30a7abda94bd08232483b3b480e2099f00856247ad3e6749f8e56e420b530b0ad3b331b8f2ba85751794a0bf15f90d6ac3f6bbdca51e3c1fdadc2f9baa139479
|
7
|
+
data.tar.gz: a6b057451bf64665368bd64a755c5030b892e2b0a84456421419e5ab097b618123d4bdbf63ee83ab27450b8f971bb9440c8dfff19b7f725188bf44a210c95627
|
data/README.md
CHANGED
@@ -18,19 +18,6 @@ Note that Date/Time stamps are converted automatically. No more Epoch/Unix time
|
|
18
18
|
|
19
19
|
$ gem install stripe-cli
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
you may also clone the repo and build the gem locally yourself
|
24
|
-
|
25
|
-
$ git clone https://github.com/stripe-contrib/stripe-cli.git
|
26
|
-
$ cd ./stripe-cli
|
27
|
-
$ gem build stripe-cli.gemspec
|
28
|
-
$ gem install stripe-cli
|
29
|
-
|
30
|
-
> because RubyGems looks **first** at the **current directory** before moving on to [rubygems.org](https://rubygems.org), that last step will install the local gem you just built.
|
31
|
-
|
32
|
-
|
33
|
-
|
34
21
|
## Configuration
|
35
22
|
|
36
23
|
For authentication, pass your secret key using the `-k` or `--key` option
|
@@ -39,7 +26,7 @@ For authentication, pass your secret key using the `-k` or `--key` option
|
|
39
26
|
|
40
27
|
To use a specific api version, pass in the `-v` or `--version` option
|
41
28
|
|
42
|
-
$ stripe balance_transactions list -v "
|
29
|
+
$ stripe balance_transactions list -v "2014-08-04"
|
43
30
|
|
44
31
|
You may also store default configurations in a `~/.stripecli` file that conforms to the following example
|
45
32
|
|
@@ -73,17 +60,18 @@ If you choose to go this route, make sure to add `.stripecli` to your `.gitignor
|
|
73
60
|
## Usage
|
74
61
|
|
75
62
|
Commands:
|
76
|
-
stripe balance # show currently available
|
63
|
+
stripe balance # show currently available & pending balance amounts
|
77
64
|
stripe cards # find, list, create, & delete cards for both customers & recipients
|
78
65
|
stripe charges # find, list, create, capture, & refund charges
|
79
66
|
stripe coupons # find, list, create, & delete coupons
|
80
67
|
stripe customers # find, list, create, & delete customers
|
81
68
|
stripe events # find & list events
|
82
69
|
stripe help [COMMAND] # Describe available commands or one specific command
|
83
|
-
stripe invoices # find, list, pay,
|
70
|
+
stripe invoices # find, list, pay, & close invoices
|
84
71
|
stripe plans # find, list, create, & delete plans
|
85
|
-
stripe recipients # find, list, create & delete recipients
|
86
|
-
stripe
|
72
|
+
stripe recipients # find, list, create, & delete recipients
|
73
|
+
stripe refunds # find, list, & create refunds
|
74
|
+
stripe subscriptions # find, list, create, cancel, & reactivate multiple subscriptions per customer
|
87
75
|
stripe tokens # find & create tokens for bank accounts & credit cards
|
88
76
|
stripe transactions # find & list balance transactions
|
89
77
|
stripe transfers # find, list, & create transfers
|
@@ -101,6 +89,18 @@ or
|
|
101
89
|
|
102
90
|
$ stripe charges create [--amount=AMOUNT][--customer=CUST_ID]
|
103
91
|
|
92
|
+
### Interactive Menus
|
93
|
+
|
94
|
+
Passing NO (or partial) arguments to any operation, will trigger an interactive menu
|
95
|
+
|
96
|
+
$ stripe charges create
|
97
|
+
Amount in dollars: __
|
98
|
+
|
99
|
+
or
|
100
|
+
|
101
|
+
$ stripe charges create [--amount=AMOUNT]
|
102
|
+
Name on Card: __
|
103
|
+
|
104
104
|
### cursor-based pagination
|
105
105
|
|
106
106
|
for all ```list``` operations
|
@@ -117,19 +117,6 @@ e.g. fetching a second page
|
|
117
117
|
|
118
118
|
stripe events list --count=10 --offset=10
|
119
119
|
|
120
|
-
|
121
|
-
### Interactive Menus
|
122
|
-
|
123
|
-
Passing NO (or partial) arguments to any operation, will trigger an interactive menu
|
124
|
-
|
125
|
-
$ stripe charges create
|
126
|
-
Amount in dollars: __
|
127
|
-
|
128
|
-
or
|
129
|
-
|
130
|
-
$ stripe charges create [--amount=AMOUNT]
|
131
|
-
Name on Card: __
|
132
|
-
|
133
120
|
### Exception Recovery
|
134
121
|
|
135
122
|
Api errors are rescued and their messages displayed for you to read. No more ```barfing``` to ```stdout```
|
@@ -143,7 +130,7 @@ Api errors are rescued and their messages displayed for you to read. No more ``
|
|
143
130
|
stripe charges create # Create a charge
|
144
131
|
stripe charges find ID # Find a charge
|
145
132
|
stripe charges help [COMMAND] # Describe subcommands or one specific subcommand
|
146
|
-
stripe charges list # List charges
|
133
|
+
stripe charges list # List charges (optionally by customer_id)
|
147
134
|
stripe charges refund ID # Refund a charge
|
148
135
|
|
149
136
|
### Tokens
|
@@ -221,7 +208,7 @@ Api errors are rescued and their messages displayed for you to read. No more ``
|
|
221
208
|
Commands:
|
222
209
|
stripe transactions find ID # Find a transaction
|
223
210
|
stripe transactions help [COMMAND] # Describe subcommands or one specific subcommand
|
224
|
-
stripe transactions list [TYPE] # List transactions, optionaly filter by type:
|
211
|
+
stripe transactions list [TYPE] # List transactions, optionaly filter by type:(charge refund adjustment application_fee application_fee_refund transfer transfer_failure)
|
225
212
|
|
226
213
|
### Recipients
|
227
214
|
|
@@ -232,6 +219,16 @@ Api errors are rescued and their messages displayed for you to read. No more ``
|
|
232
219
|
stripe recipients help [COMMAND] # Describe subcommands or one specific subcommand
|
233
220
|
stripe recipients list # List recipients
|
234
221
|
|
222
|
+
### Refunds
|
223
|
+
|
224
|
+
Though ```refund``` is still a supported operation of the ```charges``` command. The ```refunds``` command offers additional functionality.
|
225
|
+
|
226
|
+
Commands:
|
227
|
+
stripe refunds create --charge=CHARGE # apply a new refund to CHARGE charge
|
228
|
+
stripe refunds find ID --charge=CHARGE # Find ID refund of CHARGE charge
|
229
|
+
stripe refunds help [COMMAND] # Describe subcommands or one specific subcommand
|
230
|
+
stripe refunds list --charge=CHARGE # List refunds for CHARGE charge
|
231
|
+
|
235
232
|
### Transfers
|
236
233
|
|
237
234
|
Commands:
|
data/lib/stripe/cli/commands.rb
CHANGED
@@ -12,6 +12,7 @@ module Stripe
|
|
12
12
|
autoload :Transactions, 'stripe/cli/commands/transactions'
|
13
13
|
autoload :Balance, 'stripe/cli/commands/balance'
|
14
14
|
autoload :Recipients, 'stripe/cli/commands/recipients'
|
15
|
+
autoload :Refunds, 'stripe/cli/commands/refunds'
|
15
16
|
autoload :Subscriptions, 'stripe/cli/commands/subscriptions'
|
16
17
|
autoload :Transfers, 'stripe/cli/commands/transfers'
|
17
18
|
autoload :Version, 'stripe/cli/commands/gem_version'
|
@@ -17,11 +17,11 @@ module Stripe
|
|
17
17
|
|
18
18
|
desc "find ID", "Find a charge"
|
19
19
|
def find charge_id
|
20
|
-
|
20
|
+
super Stripe::Charge, charge_id
|
21
21
|
end
|
22
22
|
|
23
23
|
desc "refund ID", "Refund a charge"
|
24
|
-
option :amount, :type => :numeric, :desc => "Refund amount in dollars"
|
24
|
+
option :amount, :type => :numeric, :desc => "Refund amount in dollars. (Entire charge by default)"
|
25
25
|
option :metadata, :type => :hash
|
26
26
|
option :refund_application_fee, :type => :boolean, :default => false, :desc => "Whether or not to refund the application fee"
|
27
27
|
def refund charge_id
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Stripe
|
2
|
+
module CLI
|
3
|
+
module Commands
|
4
|
+
class Refunds < Command
|
5
|
+
desc "list", "List refunds for CHARGE charge"
|
6
|
+
option :starting_after, :desc => "The ID of the last object in the previous paged result set. For cursor-based pagination."
|
7
|
+
option :ending_before, :desc => "The ID of the first object in the previous paged result set, when paging backwards through the list."
|
8
|
+
option :limit, :desc => "a limit on the number of resources returned, between 1 and 100"
|
9
|
+
option :offset, :desc => "the starting index to be used, relative to the entire list"
|
10
|
+
option :count, :desc => "depricated: use limit"
|
11
|
+
option :charge, :aliases => :c, :required => true, :desc => "Id of charge to search"
|
12
|
+
def list
|
13
|
+
if charge = retrieve_charge(options.delete :charge)
|
14
|
+
super charge.refunds, options
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "find ID", "Find ID refund of CHARGE charge"
|
19
|
+
option :charge, :aliases => :c, :required => true, :desc => "Id of charge to search"
|
20
|
+
def find refund_id
|
21
|
+
if charge = retrieve_charge(options.delete :charge)
|
22
|
+
super charge.refunds, refund_id
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "create", "apply a new refund to CHARGE charge"
|
27
|
+
option :amount, :type => :numeric, :desc => "Refund amount in dollars. (Entire charge by default)"
|
28
|
+
option :metadata, :type => :hash
|
29
|
+
option :refund_application_fee, :type => :boolean, :default => false, :desc => "Whether or not to refund the application fee"
|
30
|
+
option :charge, :aliases => :c, :required => true, :desc => "Id of charge to apply refund"
|
31
|
+
def create
|
32
|
+
options[:amount] = (Float(options[:amount]) * 100).to_i if options[:amount]
|
33
|
+
if charge = retrieve_charge(options.delete :charge)
|
34
|
+
super charge.refunds, options
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def retrieve_charge id
|
41
|
+
begin
|
42
|
+
Stripe::Charge.retrieve(id, api_key)
|
43
|
+
rescue Exception => e
|
44
|
+
ap e.message
|
45
|
+
false
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/stripe/cli/runner.rb
CHANGED
@@ -10,10 +10,11 @@ module Stripe
|
|
10
10
|
register Commands::Plans, 'plans', 'plans', 'find, list, create, & delete plans'
|
11
11
|
register Commands::Coupons, 'coupons', 'coupons', 'find, list, create, & delete coupons'
|
12
12
|
register Commands::Events, 'events', 'events', 'find & list events'
|
13
|
-
register Commands::Invoices, 'invoices', 'invoices', 'find, list, pay,
|
13
|
+
register Commands::Invoices, 'invoices', 'invoices', 'find, list, pay, & close invoices'
|
14
14
|
register Commands::Transactions, 'transactions', 'transactions', 'find & list balance transactions'
|
15
|
-
register Commands::Balance, 'balance', 'balance', 'show currently available
|
15
|
+
register Commands::Balance, 'balance', 'balance', 'show currently available & pending balance amounts'
|
16
16
|
register Commands::Recipients, 'recipients', 'recipients', 'find, list, create & delete recipients'
|
17
|
+
register Commands::Refunds, 'refunds', 'refunds', 'find, list, & create refunds'
|
17
18
|
register Commands::Subscriptions, 'subscriptions', 'subscriptions', 'find, list, create, cancel & reactivate multiple subscriptions per customer'
|
18
19
|
register Commands::Transfers, 'transfers', 'transfers', 'find, list, & create transfers'
|
19
20
|
register Commands::Version, 'version', 'version', 'display current gem version', hide: true
|
data/lib/stripe/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex MacCaw
|
@@ -176,6 +176,7 @@ files:
|
|
176
176
|
- lib/stripe/cli/commands/invoices.rb
|
177
177
|
- lib/stripe/cli/commands/plans.rb
|
178
178
|
- lib/stripe/cli/commands/recipients.rb
|
179
|
+
- lib/stripe/cli/commands/refunds.rb
|
179
180
|
- lib/stripe/cli/commands/subscriptions.rb
|
180
181
|
- lib/stripe/cli/commands/tokens.rb
|
181
182
|
- lib/stripe/cli/commands/transactions.rb
|