stripe_local 0.2.2 → 0.2.3
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/app/models/stripe_local/balance.rb +6 -1
- data/app/models/stripe_local/customer.rb +12 -13
- data/app/models/stripe_local/invoice.rb +24 -22
- data/app/models/stripe_local/line_item.rb +18 -16
- data/lib/stripe_local/version.rb +1 -1
- data/spec/dummy/log/test.log +1164 -0
- data/spec/models/stripe_local/invoice_spec.rb +0 -1
- data/spec/webhook_fixtures/invoice.created.json +75 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c68aa4d6366705198c9794090f4b968675a1eb2
|
4
|
+
data.tar.gz: 076d8c5e321492e3c3d8d70e2507025e9fcde5d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f6df3f43b07cca40cb77ff4564c59530dc98a8afd0f3ec8fb5b829448f8268cb7ee1cae192db0639a266cf2cc9e793024b9cc3bb64a7b68ce20419e4d42f73c
|
7
|
+
data.tar.gz: d7f8b5a968c52ae71b1f6e41d75fccf56e2fb3b40e94a9cb033d07a07100f813beef56fb5201622040fd7bbd14449d78d4396d4ce18bec63c214c7580cc43bd8
|
@@ -59,18 +59,17 @@ module StripeLocal
|
|
59
59
|
MultiJson.load read_attribute( :metadata ), symbolize_keys: true
|
60
60
|
end
|
61
61
|
|
62
|
-
#=!=>>>
|
63
|
-
# ~<Schema>~
|
64
|
-
# t.string :id
|
65
|
-
# t.integer :account_balance
|
66
|
-
# t.string :default_card
|
67
|
-
# t.boolean :delinquent
|
68
|
-
# t.string :description
|
69
|
-
# t.string :email
|
70
|
-
# t.text :metadata
|
71
|
-
# t.integer :model_id
|
72
|
-
# t.timestamps
|
73
|
-
|
74
|
-
#=¡=>>>
|
75
62
|
end
|
63
|
+
#=!=#
|
64
|
+
# ==Database Schema
|
65
|
+
#
|
66
|
+
# string :id
|
67
|
+
# integer :account_balance
|
68
|
+
# string :default_card
|
69
|
+
# boolean :delinquent
|
70
|
+
# string :description
|
71
|
+
# string :email
|
72
|
+
# text :metadata
|
73
|
+
# integer :model_id
|
74
|
+
#=¡=#
|
76
75
|
end
|
@@ -35,11 +35,11 @@ module StripeLocal
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def succeed inv
|
38
|
-
|
38
|
+
find( inv.id ).update_attributes closed: true, paid: true, next_payment_attempt: nil
|
39
39
|
end
|
40
40
|
|
41
41
|
def fail inv
|
42
|
-
|
42
|
+
find( inv.id ).update_attributes paid: false
|
43
43
|
end
|
44
44
|
|
45
45
|
def paid
|
@@ -53,25 +53,27 @@ module StripeLocal
|
|
53
53
|
end
|
54
54
|
|
55
55
|
|
56
|
-
#=!=#>>>
|
57
|
-
# string :id
|
58
|
-
# string :customer_id
|
59
|
-
# integer :amount_due
|
60
|
-
# integer :subtotal
|
61
|
-
# integer :total
|
62
|
-
# boolean :attempted
|
63
|
-
# integer :attempt_count
|
64
|
-
# boolean :paid
|
65
|
-
# boolean :closed
|
66
|
-
# datetime :date
|
67
|
-
# datetime :period_start
|
68
|
-
# datetime :period_end
|
69
|
-
# string :currency
|
70
|
-
# integer :starting_balance
|
71
|
-
# integer :ending_balance
|
72
|
-
# string :charge_id
|
73
|
-
# integer :discount
|
74
|
-
# datetime :next_payment_attempt
|
75
|
-
#=¡=#>>>
|
76
56
|
end
|
57
|
+
#=!=#
|
58
|
+
# ==Database Schema
|
59
|
+
#
|
60
|
+
# string :id
|
61
|
+
# string :customer_id
|
62
|
+
# integer :amount_due
|
63
|
+
# integer :subtotal
|
64
|
+
# integer :total
|
65
|
+
# boolean :attempted
|
66
|
+
# integer :attempt_count
|
67
|
+
# boolean :paid
|
68
|
+
# boolean :closed
|
69
|
+
# datetime :date
|
70
|
+
# datetime :period_start
|
71
|
+
# datetime :period_end
|
72
|
+
# string :currency
|
73
|
+
# integer :starting_balance
|
74
|
+
# integer :ending_balance
|
75
|
+
# string :charge_id
|
76
|
+
# integer :discount
|
77
|
+
# datetime :next_payment_attempt
|
78
|
+
#=¡=#
|
77
79
|
end
|
@@ -24,8 +24,8 @@ module StripeLocal
|
|
24
24
|
attrs.each_with_object({}) do |(k,v),h|
|
25
25
|
key = case k.to_sym
|
26
26
|
when :invoice then :invoice_id
|
27
|
-
when :plan then h[:plan_id]
|
28
|
-
when :metadata then h[:metadata] = MultiJson.dump( v.to_hash ) and next
|
27
|
+
when :plan then h[:plan_id] = ( v.nil? ? "" : v.id ) and next # will be nil if this is a one off charge
|
28
|
+
when :metadata then h[:metadata] = MultiJson.dump( v.try :to_hash ) and next
|
29
29
|
when :type then h[:subscription] = (v == "subscription" ? true : false) and next
|
30
30
|
when :period then h[:period_start] = Time.at(v.start) and h[:period_end] = Time.at(v.end) and next
|
31
31
|
when ->(x){attribute_method? x} then k.to_sym
|
@@ -36,19 +36,21 @@ module StripeLocal
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
#=!=#>>>
|
40
|
-
# string :id
|
41
|
-
# string :invoice_id
|
42
|
-
# boolean :subscription
|
43
|
-
# integer :amount
|
44
|
-
# string :currency
|
45
|
-
# boolean :proration
|
46
|
-
# datetime :period_start
|
47
|
-
# datetime :period_end
|
48
|
-
# integer :quantity
|
49
|
-
# string :plan_id
|
50
|
-
# string :description
|
51
|
-
# text :metadata
|
52
|
-
#=¡=#>>>
|
53
39
|
end
|
40
|
+
#=!=#
|
41
|
+
# ==Database Schema
|
42
|
+
#
|
43
|
+
# string :id
|
44
|
+
# string :invoice_id
|
45
|
+
# boolean :subscription
|
46
|
+
# integer :amount
|
47
|
+
# string :currency
|
48
|
+
# boolean :proration
|
49
|
+
# datetime :period_start
|
50
|
+
# datetime :period_end
|
51
|
+
# integer :quantity
|
52
|
+
# string :plan_id
|
53
|
+
# string :description
|
54
|
+
# text :metadata
|
55
|
+
#=¡=#
|
54
56
|
end
|
data/lib/stripe_local/version.rb
CHANGED