stripe_tester 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -4
  3. data/lib/stripe_tester.rb +2 -2
  4. data/lib/stripe_tester/version.rb +1 -1
  5. data/spec/stripe_tester_spec.rb +11 -11
  6. data/stripe_webhooks/2015-10-16/account_external_account_created.yml +24 -0
  7. data/stripe_webhooks/2015-10-16/account_external_account_deleted.yml +24 -0
  8. data/stripe_webhooks/2015-10-16/account_external_account_updated.yml +25 -0
  9. data/stripe_webhooks/2015-10-16/account_updated.yml +90 -0
  10. data/stripe_webhooks/2015-10-16/balance_available.yml +19 -0
  11. data/stripe_webhooks/2015-10-16/bitcoin_receiver_created.yml +30 -0
  12. data/stripe_webhooks/2015-10-16/bitcoin_receiver_filled.yml +30 -0
  13. data/stripe_webhooks/2015-10-16/bitcoin_receiver_transaction_created.yml +18 -0
  14. data/stripe_webhooks/2015-10-16/bitcoin_receiver_updated.yml +31 -0
  15. data/stripe_webhooks/2015-10-16/charge_captured.yml +66 -0
  16. data/stripe_webhooks/2015-10-16/charge_dispute_closed.yml +56 -0
  17. data/stripe_webhooks/2015-10-16/charge_dispute_created.yml +56 -0
  18. data/stripe_webhooks/2015-10-16/charge_dispute_funds_reinstated.yml +56 -0
  19. data/stripe_webhooks/2015-10-16/charge_dispute_funds_withdrawn.yml +56 -0
  20. data/stripe_webhooks/2015-10-16/charge_dispute_updated.yml +85 -0
  21. data/stripe_webhooks/2015-10-16/charge_failed.yml +66 -0
  22. data/stripe_webhooks/2015-10-16/charge_refunded.yml +77 -0
  23. data/stripe_webhooks/2015-10-16/charge_succeeded.yml +66 -0
  24. data/stripe_webhooks/2015-10-16/charge_updated.yml +68 -0
  25. data/stripe_webhooks/2015-10-16/coupon_created.yml +25 -0
  26. data/stripe_webhooks/2015-10-16/coupon_deleted.yml +25 -0
  27. data/stripe_webhooks/2015-10-16/coupon_updated.yml +26 -0
  28. data/stripe_webhooks/2015-10-16/customer_bank_account_created.yml +24 -0
  29. data/stripe_webhooks/2015-10-16/customer_bank_account_deleted.yml +24 -0
  30. data/stripe_webhooks/2015-10-16/customer_bank_account_updated.yml +25 -0
  31. data/stripe_webhooks/2015-10-16/customer_card_created.yml +33 -0
  32. data/stripe_webhooks/2015-10-16/customer_card_deleted.yml +33 -0
  33. data/stripe_webhooks/2015-10-16/customer_card_updated.yml +35 -0
  34. data/stripe_webhooks/2015-10-16/customer_created.yml +36 -0
  35. data/stripe_webhooks/2015-10-16/customer_deleted.yml +36 -0
  36. data/stripe_webhooks/2015-10-16/customer_discount_created.yml +31 -0
  37. data/stripe_webhooks/2015-10-16/customer_discount_deleted.yml +31 -0
  38. data/stripe_webhooks/2015-10-16/customer_discount_updated.yml +47 -0
  39. data/stripe_webhooks/2015-10-16/customer_subscription_created.yml +41 -0
  40. data/stripe_webhooks/2015-10-16/customer_subscription_deleted.yml +41 -0
  41. data/stripe_webhooks/2015-10-16/customer_subscription_trial_will_end.yml +41 -0
  42. data/stripe_webhooks/2015-10-16/customer_subscription_updated.yml +55 -0
  43. data/stripe_webhooks/2015-10-16/customer_updated.yml +38 -0
  44. data/stripe_webhooks/2015-10-16/invoice_created.yml +74 -0
  45. data/stripe_webhooks/2015-10-16/invoice_payment_failed.yml +74 -0
  46. data/stripe_webhooks/2015-10-16/invoice_payment_succeeded.yml +74 -0
  47. data/stripe_webhooks/2015-10-16/invoice_updated.yml +76 -0
  48. data/stripe_webhooks/2015-10-16/invoiceitem_created.yml +29 -0
  49. data/stripe_webhooks/2015-10-16/invoiceitem_deleted.yml +29 -0
  50. data/stripe_webhooks/2015-10-16/invoiceitem_updated.yml +31 -0
  51. data/stripe_webhooks/2015-10-16/order_created.yml +45 -0
  52. data/stripe_webhooks/2015-10-16/order_payment_failed.yml +45 -0
  53. data/stripe_webhooks/2015-10-16/order_payment_succeeded.yml +45 -0
  54. data/stripe_webhooks/2015-10-16/order_updated.yml +46 -0
  55. data/stripe_webhooks/2015-10-16/plan_created.yml +23 -0
  56. data/stripe_webhooks/2015-10-16/plan_deleted.yml +23 -0
  57. data/stripe_webhooks/2015-10-16/plan_updated.yml +25 -0
  58. data/stripe_webhooks/2015-10-16/product_created.yml +34 -0
  59. data/stripe_webhooks/2015-10-16/product_updated.yml +35 -0
  60. data/stripe_webhooks/2015-10-16/recipient_created.yml +30 -0
  61. data/stripe_webhooks/2015-10-16/recipient_deleted.yml +30 -0
  62. data/stripe_webhooks/2015-10-16/recipient_updated.yml +31 -0
  63. data/stripe_webhooks/2015-10-16/transfer_canceled.yml +38 -0
  64. data/stripe_webhooks/2015-10-16/transfer_created.yml +38 -0
  65. data/stripe_webhooks/2015-10-16/transfer_failed.yml +38 -0
  66. data/stripe_webhooks/2015-10-16/transfer_paid.yml +38 -0
  67. data/stripe_webhooks/2015-10-16/transfer_updated.yml +40 -0
  68. data/supported_webhook_versions.md +134 -2
  69. metadata +64 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59041d8698f80e26a381056c0c25e0cdf7d5f31d
4
- data.tar.gz: 6af7b4b4997c87846474978f95db1b880eb56fe9
3
+ metadata.gz: a5d6588a9b68ab057dd68fcc3993570646959caf
4
+ data.tar.gz: d680724170f2d7dd8245ff26f21fa4f2e2905597
5
5
  SHA512:
6
- metadata.gz: d1a85d5c17521d969ac7d89c4d36cf40244670c2e5e85c7c44fb5041d6483c6d76e22c1a5e67564d628758133dc69c0210268d344f2ce4442d3a1879faa098b3
7
- data.tar.gz: 52934234d1ee2715fd9d92f888700de485d4859d08101b2dfc157da8d8a4f05d994f78920b57b17288c26fe71db757c29e9b6b257c8035db58c1e93e0e93b837
6
+ metadata.gz: 16fc57063e28c4da0d11df37ddda0a709dd4c72acbc81cebc3893b75ce1ce1f5e48f8ae7693c387ceaf8299347e3600e0f7cba5381183d46ad8fe825c1d8f673
7
+ data.tar.gz: 7640f63293d9f31772a3a288bef5207aa27c85af277213c608979d9435a3e47ac153d5c1873773b04abd72d0da0ea4cc0b0acf4b3a72638ea06da7f76dc28fc8
data/README.md CHANGED
@@ -10,7 +10,7 @@ StripeTester allows you to submit webhooks to your application without hitting S
10
10
 
11
11
  Add this line to your application's Gemfile:
12
12
  ```ruby
13
- gem 'stripe_tester', "~> 0.3.2"
13
+ gem 'stripe_tester', "~> 0.3.3"
14
14
  ```
15
15
  And then execute:
16
16
  ```bash
@@ -42,14 +42,14 @@ In your test:
42
42
 
43
43
  2. If you want to specify which Stripe webhook API version you would like to use (the default will be the latest [supported version](https://github.com/buttercloud/stripe_tester#supported-stripe-webhook-api-versions)):
44
44
  ```ruby
45
- StripeTester.stripe_version = "2013-09-08"
45
+ StripeTester.stripe_version = "2015-10-16"
46
46
  ```
47
47
 
48
48
  3. Send the webhook. This will send a POST request to the URL with the event data as JSON:
49
49
  ```ruby
50
50
  # as a symbol
51
51
  StripeTester.create_event(:invoice_created)
52
-
52
+
53
53
  # or as a string
54
54
  StripeTester.create_event("invoice_created")
55
55
  ```
@@ -76,6 +76,8 @@ json = StripeTester.load_template(:invoice_payment_failed, {"data"=>{"object"=>{
76
76
 
77
77
  ## Supported Stripe Webhook API Versions
78
78
 
79
+ * [2015-10-16](https://github.com/buttercloud/stripe_tester/blob/master/supported_webhook_versions.md#version-2015-10-16)
80
+ * [2015-10-01](https://github.com/buttercloud/stripe_tester/blob/master/supported_webhook_versions.md#version-2015-10-01)
79
81
  * [2015-04-07](https://github.com/buttercloud/stripe_tester/blob/master/supported_webhook_versions.md#version-2015-04-07)
80
82
  * [2014-10-07](https://github.com/buttercloud/stripe_tester/blob/master/supported_webhook_versions.md#version-2014-10-07)
81
83
  * [2013-08-13](https://github.com/buttercloud/stripe_tester/blob/master/supported_webhook_versions.md#version-2013-08-13)
@@ -90,7 +92,7 @@ json = StripeTester.load_template(:invoice_payment_failed, {"data"=>{"object"=>{
90
92
  * Add your changes, and add a test for the changes.
91
93
  * Run tests using
92
94
 
93
- ```bash
95
+ ```bash
94
96
  $ rspec spec
95
97
  ```
96
98
  * Make sure everything is passing
@@ -6,14 +6,14 @@ require 'psych'
6
6
 
7
7
  module StripeTester
8
8
 
9
- LATEST_STRIPE_VERSION = "2015-10-01"
9
+ LATEST_STRIPE_VERSION = "2015-10-16"
10
10
 
11
11
  # send the url the webhook event
12
12
  # There are two options you can use. :method=>:overwrite, or :method=>:merge
13
13
  # Each will use a different way of merging the new attributes.
14
14
  def self.create_event(callback_type, attributes={}, options={method: :overwrite})
15
15
  webhook_data = self.load_template(callback_type, attributes, options)
16
-
16
+
17
17
  post_to_url(webhook_data) if webhook_data
18
18
  end
19
19
 
@@ -1,3 +1,3 @@
1
1
  module StripeTester
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -4,7 +4,7 @@ describe StripeTester do
4
4
 
5
5
  describe "instance methods" do
6
6
 
7
- LATEST_STRIPE_VERSION = "2015-10-01"
7
+ LATEST_STRIPE_VERSION = "2015-10-16"
8
8
 
9
9
  before(:each) do
10
10
  StripeTester.remove_url
@@ -74,9 +74,9 @@ describe StripeTester do
74
74
  url = "http://localhost:3000/transactions"
75
75
  StripeTester.webhook_url = url
76
76
 
77
- FakeWeb.register_uri(:post,
78
- url,
79
- body: data.to_json,
77
+ FakeWeb.register_uri(:post,
78
+ url,
79
+ body: data.to_json,
80
80
  content_type: 'application/json')
81
81
 
82
82
  response = StripeTester.post_to_url(data)
@@ -89,9 +89,9 @@ describe StripeTester do
89
89
  url = "http://localhost:3000/"
90
90
  StripeTester.webhook_url = url
91
91
 
92
- FakeWeb.register_uri(:post,
93
- url,
94
- body: data.to_json,
92
+ FakeWeb.register_uri(:post,
93
+ url,
94
+ body: data.to_json,
95
95
  content_type: 'application/json',
96
96
  status: ["404", "Not Found"])
97
97
 
@@ -107,9 +107,9 @@ describe StripeTester do
107
107
  url = "https://localhost:3000/pathname"
108
108
  StripeTester.webhook_url = url
109
109
 
110
- FakeWeb.register_uri(:post,
111
- url,
112
- body: data.to_json,
110
+ FakeWeb.register_uri(:post,
111
+ url,
112
+ body: data.to_json,
113
113
  content_type: 'application/json')
114
114
 
115
115
  response = StripeTester.post_to_url(data)
@@ -161,4 +161,4 @@ describe StripeTester do
161
161
  expect(new_data[:info][:address][:state]).to eq('NC')
162
162
  end
163
163
  end
164
- end
164
+ end
@@ -0,0 +1,24 @@
1
+ ---
2
+ created: 1326853478
3
+ livemode: false
4
+ id: evt_00000000000000
5
+ type: account.external_account.created
6
+ object: event
7
+ request:
8
+ pending_webhooks: 1
9
+ api_version: '2015-10-16'
10
+ data:
11
+ object:
12
+ id: ba_00000000000000
13
+ object: bank_account
14
+ account: acct_00000000000000
15
+ bank_name: STRIPE TEST BANK
16
+ country: US
17
+ currency: usd
18
+ default_for_currency: false
19
+ fingerprint: BoBS64BqvgqBDUKQ
20
+ last4: '6789'
21
+ metadata: {}
22
+ name:
23
+ routing_number: '110000000'
24
+ status: new
@@ -0,0 +1,24 @@
1
+ ---
2
+ created: 1326853478
3
+ livemode: false
4
+ id: evt_00000000000000
5
+ type: account.external_account.deleted
6
+ object: event
7
+ request:
8
+ pending_webhooks: 1
9
+ api_version: '2015-10-16'
10
+ data:
11
+ object:
12
+ id: ba_00000000000000
13
+ object: bank_account
14
+ account: acct_00000000000000
15
+ bank_name: STRIPE TEST BANK
16
+ country: US
17
+ currency: usd
18
+ default_for_currency: false
19
+ fingerprint: BoBS64BqvgqBDUKQ
20
+ last4: '6789'
21
+ metadata: {}
22
+ name:
23
+ routing_number: '110000000'
24
+ status: new
@@ -0,0 +1,25 @@
1
+ ---
2
+ created: 1326853478
3
+ livemode: false
4
+ id: evt_00000000000000
5
+ type: account.external_account.updated
6
+ object: event
7
+ request:
8
+ pending_webhooks: 1
9
+ api_version: '2015-10-16'
10
+ data:
11
+ object:
12
+ id: ba_00000000000000
13
+ object: bank_account
14
+ account: acct_00000000000000
15
+ bank_name: STRIPE TEST BANK
16
+ country: US
17
+ currency: usd
18
+ default_for_currency: false
19
+ fingerprint: BoBS64BqvgqBDUKQ
20
+ last4: '6789'
21
+ metadata: {}
22
+ name:
23
+ routing_number: '110000000'
24
+ status: new
25
+ previous_attributes:
@@ -0,0 +1,90 @@
1
+ ---
2
+ created: 1326853478
3
+ livemode: false
4
+ id: evt_00000000000000
5
+ type: account.updated
6
+ object: event
7
+ request:
8
+ pending_webhooks: 1
9
+ api_version: '2015-10-16'
10
+ data:
11
+ object:
12
+ id: acct_00000000000000
13
+ object: account
14
+ business_logo:
15
+ business_name:
16
+ business_url:
17
+ charges_enabled: false
18
+ country: US
19
+ currencies_supported:
20
+ - usd
21
+ - aed
22
+ - afn
23
+ - "..."
24
+ debit_negative_balances: true
25
+ decline_charge_on:
26
+ avs_failure: false
27
+ cvc_failure: false
28
+ default_currency: usd
29
+ details_submitted: true
30
+ display_name:
31
+ email: test@stripe.com
32
+ external_accounts:
33
+ object: list
34
+ data: []
35
+ has_more: false
36
+ total_count: 0
37
+ url: "/v1/accounts/acct_27GvSMUrw6nMBU84mVCr/external_accounts"
38
+ legal_entity:
39
+ additional_owners:
40
+ address:
41
+ city:
42
+ country: US
43
+ line1:
44
+ line2:
45
+ postal_code:
46
+ state:
47
+ business_name:
48
+ dob:
49
+ day:
50
+ month:
51
+ year:
52
+ first_name:
53
+ last_name:
54
+ personal_address:
55
+ city:
56
+ country:
57
+ line1:
58
+ line2:
59
+ postal_code:
60
+ state:
61
+ personal_id_number_provided: false
62
+ ssn_last_4_provided: false
63
+ type:
64
+ verification:
65
+ details:
66
+ details_code: failed_other
67
+ document:
68
+ status: unverified
69
+ managed: false
70
+ product_description:
71
+ statement_descriptor: TEST
72
+ support_phone:
73
+ timezone: Etc/UTC
74
+ tos_acceptance:
75
+ date:
76
+ ip:
77
+ user_agent:
78
+ transfer_schedule:
79
+ delay_days: 7
80
+ interval: daily
81
+ transfers_enabled: false
82
+ verification:
83
+ disabled_reason: fields_needed
84
+ due_by: 1450348258
85
+ fields_needed:
86
+ - legal_entity.verification.document
87
+ previous_attributes:
88
+ verification:
89
+ fields_needed: []
90
+ due_by:
@@ -0,0 +1,19 @@
1
+ ---
2
+ created: 1326853478
3
+ livemode: false
4
+ id: evt_00000000000000
5
+ type: balance.available
6
+ object: event
7
+ request:
8
+ pending_webhooks: 1
9
+ api_version: '2015-10-16'
10
+ data:
11
+ object:
12
+ object: balance
13
+ available:
14
+ - amount: 0
15
+ currency: usd
16
+ livemode: false
17
+ pending:
18
+ - amount: 0
19
+ currency: usd
@@ -0,0 +1,30 @@
1
+ ---
2
+ created: 1326853478
3
+ livemode: false
4
+ id: evt_00000000000000
5
+ type: bitcoin.receiver.created
6
+ object: event
7
+ request:
8
+ pending_webhooks: 1
9
+ api_version: '2015-10-16'
10
+ data:
11
+ object:
12
+ id: btcrcv_00000000000000
13
+ object: bitcoin_receiver
14
+ active: false
15
+ amount: 100
16
+ amount_received: 0
17
+ bitcoin_amount: 1757908
18
+ bitcoin_amount_received: 0
19
+ bitcoin_uri: bitcoin:test_7i9Fo4b5wXcUAuoVBFrc7nc9HDxD1?amount=0.01757908
20
+ created: 1450089072
21
+ currency: usd
22
+ description: Receiver for John Doe
23
+ email: test@example.com
24
+ filled: false
25
+ inbound_address: test_7i9Fo4b5wXcUAuoVBFrc7nc9HDxD1
26
+ livemode: false
27
+ metadata: {}
28
+ refund_address:
29
+ uncaptured_funds: false
30
+ used_for_payment: false
@@ -0,0 +1,30 @@
1
+ ---
2
+ created: 1326853478
3
+ livemode: false
4
+ id: evt_00000000000000
5
+ type: bitcoin.receiver.filled
6
+ object: event
7
+ request:
8
+ pending_webhooks: 1
9
+ api_version: '2015-10-16'
10
+ data:
11
+ object:
12
+ id: btcrcv_00000000000000
13
+ object: bitcoin_receiver
14
+ active: false
15
+ amount: 100
16
+ amount_received: 0
17
+ bitcoin_amount: 1757908
18
+ bitcoin_amount_received: 0
19
+ bitcoin_uri: bitcoin:test_7i9Fo4b5wXcUAuoVBFrc7nc9HDxD1?amount=0.01757908
20
+ created: 1450089075
21
+ currency: usd
22
+ description: Receiver for John Doe
23
+ email: test@example.com
24
+ filled: false
25
+ inbound_address: test_7i9Fo4b5wXcUAuoVBFrc7nc9HDxD1
26
+ livemode: false
27
+ metadata: {}
28
+ refund_address:
29
+ uncaptured_funds: false
30
+ used_for_payment: false
@@ -0,0 +1,18 @@
1
+ ---
2
+ created: 1326853478
3
+ livemode: false
4
+ id: evt_00000000000000
5
+ type: bitcoin.receiver.transaction.created
6
+ object: event
7
+ request:
8
+ pending_webhooks: 1
9
+ api_version: '2015-10-16'
10
+ data:
11
+ object:
12
+ id: btctxn_00000000000000
13
+ object: bitcoin_transaction
14
+ amount: 2000
15
+ bitcoin_amount: 20000000
16
+ created: 1450089083
17
+ currency: usd
18
+ receiver: btcrcv_17HVlw2eZvKYlo2COTH4sLs2
@@ -0,0 +1,31 @@
1
+ ---
2
+ created: 1326853478
3
+ livemode: false
4
+ id: evt_00000000000000
5
+ type: bitcoin.receiver.updated
6
+ object: event
7
+ request:
8
+ pending_webhooks: 1
9
+ api_version: '2015-10-16'
10
+ data:
11
+ object:
12
+ id: btcrcv_00000000000000
13
+ object: bitcoin_receiver
14
+ active: false
15
+ amount: 100
16
+ amount_received: 0
17
+ bitcoin_amount: 1757908
18
+ bitcoin_amount_received: 0
19
+ bitcoin_uri: bitcoin:test_7i9Fo4b5wXcUAuoVBFrc7nc9HDxD1?amount=0.01757908
20
+ created: 1450089079
21
+ currency: usd
22
+ description: Receiver for John Doe
23
+ email: test@example.com
24
+ filled: false
25
+ inbound_address: test_7i9Fo4b5wXcUAuoVBFrc7nc9HDxD1
26
+ livemode: false
27
+ metadata: {}
28
+ refund_address:
29
+ uncaptured_funds: false
30
+ used_for_payment: false
31
+ previous_attributes:
@@ -0,0 +1,66 @@
1
+ ---
2
+ created: 1326853478
3
+ livemode: false
4
+ id: evt_00000000000000
5
+ type: charge.captured
6
+ object: event
7
+ request:
8
+ pending_webhooks: 1
9
+ api_version: '2015-10-16'
10
+ data:
11
+ object:
12
+ id: ch_00000000000000
13
+ object: charge
14
+ amount: 212
15
+ amount_refunded: 0
16
+ application_fee:
17
+ balance_transaction: txn_00000000000000
18
+ captured: true
19
+ created: 1419171865
20
+ currency: usd
21
+ customer: cus_00000000000000
22
+ description:
23
+ destination:
24
+ dispute:
25
+ failure_code:
26
+ failure_message:
27
+ fraud_details: {}
28
+ invoice: in_00000000000000
29
+ livemode: false
30
+ metadata: {}
31
+ paid: true
32
+ receipt_email:
33
+ receipt_number:
34
+ refunded: false
35
+ refunds:
36
+ object: list
37
+ data: []
38
+ has_more: false
39
+ total_count: 0
40
+ url: "/v1/charges/ch_5MuSnHsHswLrRL/refunds"
41
+ shipping:
42
+ source:
43
+ id: card_00000000000000
44
+ object: card
45
+ address_city:
46
+ address_country:
47
+ address_line1:
48
+ address_line1_check:
49
+ address_line2:
50
+ address_state:
51
+ address_zip:
52
+ address_zip_check:
53
+ brand: Visa
54
+ country: US
55
+ customer: cus_00000000000000
56
+ cvc_check: pass
57
+ dynamic_last4:
58
+ exp_month: 12
59
+ exp_year: 2017
60
+ funding: credit
61
+ last4: '4242'
62
+ metadata: {}
63
+ name: Shit man
64
+ tokenization_method:
65
+ statement_descriptor:
66
+ status: succeeded