examples/apis/subscriptions.rb in mollie-api-ruby-2.2.1 vs examples/apis/subscriptions.rb in mollie-api-ruby-3.1.0
- old
+ new
@@ -100,11 +100,11 @@
response 500, description: 'Unexpected error'
end
end
post '/v1/subscriptions/first_payment' do
- payment = client.payments.create(
+ payment = Mollie::Payment.create(
amount: json_params['amount'],
customer_id: json_params['customer_id'],
description: json_params['description'],
redirect_url: json_params['redirect_url'],
recurring_type: "first",
@@ -114,16 +114,16 @@
)
JSON.pretty_generate(payment.attributes)
end
get '/v1/subscriptions/mandates/:customer_id' do
- mandates = client.customers_mandates.with(params[:customer_id]).all
+ mandates = Mollie::Customer::Mandates.all(customer_id: params[:customer_id])
JSON.pretty_generate(mandates.attributes)
end
post '/v1/subscriptions/on_demand' do
- payment = client.payments.create(
+ payment = Mollie::Payment.create(
amount: json_params['amount'],
customer_id: json_params['customer_id'],
description: json_params['description'],
redirect_url: json_params['redirect_url'],
recurring_type: "recurring",
@@ -133,21 +133,21 @@
)
JSON.pretty_generate(payment.attributes)
end
get '/v1/customers/:customer_id/subscriptions' do
- subscriptions = client.customers_subscriptions.with(params[:customer_id]).all(params[:offset], params[:count], testmode: params[:testmode])
+ subscriptions = Mollie::Customer::Subscription.all(params[:offset], params[:count], testmode: params[:testmode], customer_id: params[:customer_id])
JSON.pretty_generate(subscriptions.attributes)
end
get '/v1/customers/:customer_id/subscriptions/:id' do
- payment = client.customers_subscriptions.with(params[:customer_id]).get(params[:id], testmode: params[:testmode])
+ payment = Mollie::Customer::Subscription.get(params[:id], testmode: params[:testmode], customer_id: params[:customer_id])
JSON.pretty_generate(payment.attributes)
end
post '/v1/customers/:customer_id/subscriptions' do
- subscription = client.customers_subscriptions.with(params[:customer_id]).create(
+ subscription = Mollie::Customer::Subscription.create(
amount: json_params['amount'],
times: json_params['times'],
interval: json_params['interval'],
start_date: json_params['start_date'],
description: json_params["description"],
@@ -157,9 +157,9 @@
)
JSON.pretty_generate(subscription.attributes)
end
delete '/v1/customers/:customer_id/subscriptions/:id' do
- client.customers_subscriptions.with(params[:customer_id]).delete(params[:id], testmode: params[:testmode])
+ Mollie::Customer::Subscription.delete(params[:id], testmode: params[:testmode], customer_id: params[:customer_id])
"deleted"
end
end