add user data to subscription metadata
This commit is contained in:
parent
59638daad9
commit
84fd12a9a3
|
@ -30,7 +30,8 @@ module DiscoursePatrons
|
||||||
|
|
||||||
@subscription = ::Stripe::Subscription.create(
|
@subscription = ::Stripe::Subscription.create(
|
||||||
customer: params[:customer],
|
customer: params[:customer],
|
||||||
items: [ { plan: params[:plan] } ]
|
items: [ { plan: params[:plan] } ],
|
||||||
|
metadata: { username_lower: current_user.username_lower },
|
||||||
)
|
)
|
||||||
|
|
||||||
group = plan_group(plan)
|
group = plan_group(plan)
|
||||||
|
|
|
@ -24,7 +24,8 @@ module DiscoursePatrons
|
||||||
::Stripe::Plan.expects(:retrieve).returns(metadata: { group_name: 'awesome' })
|
::Stripe::Plan.expects(:retrieve).returns(metadata: { group_name: 'awesome' })
|
||||||
::Stripe::Subscription.expects(:create).with(
|
::Stripe::Subscription.expects(:create).with(
|
||||||
customer: 'cus_1234',
|
customer: 'cus_1234',
|
||||||
items: [ plan: 'plan_1234' ]
|
items: [ plan: 'plan_1234' ],
|
||||||
|
metadata: { username_lower: user.username_lower },
|
||||||
)
|
)
|
||||||
post "/patrons/subscriptions.json", params: { plan: 'plan_1234', customer: 'cus_1234' }
|
post "/patrons/subscriptions.json", params: { plan: 'plan_1234', customer: 'cus_1234' }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue