Class: PaymentGateway::Mundipagg::Subscription
- Inherits:
-
Base
- Object
- Base
- PaymentGateway::Mundipagg::Subscription
show all
- Defined in:
- lib/payment_gateway/mundipagg/subscription.rb
Constant Summary
Constants inherited
from Base
Base::API_URL
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#cancel(subscription_id) ⇒ Object
Also known as:
destroy
28
29
30
31
|
# File 'lib/payment_gateway/mundipagg/subscription.rb', line 28
def cancel(subscription_id)
url = mount_url("/#{subscription_id}")
request(:delete, url)
end
|
#create(subscription_data) ⇒ Object
16
17
18
19
|
# File 'lib/payment_gateway/mundipagg/subscription.rb', line 16
def create(subscription_data)
validate_credit_card_data(subscription_data)
request(:post, mount_url, body: subscription_data)
end
|
#create_from_plan(subscription_data) ⇒ Object
plan_id and payment_method are required
22
23
24
25
26
|
# File 'lib/payment_gateway/mundipagg/subscription.rb', line 22
def create_from_plan(subscription_data)
validate_plan_data(subscription_data)
validate_credit_card_data(subscription_data)
request(:post, mount_url, body: subscription_data)
end
|
#list(query_parameters = {}) ⇒ Object
6
7
8
|
# File 'lib/payment_gateway/mundipagg/subscription.rb', line 6
def list(query_parameters={})
request(:get, mount_url, params: query_parameters)
end
|
#list_customer(customer_id, query_parameters = {}) ⇒ Object
10
11
12
13
14
|
# File 'lib/payment_gateway/mundipagg/subscription.rb', line 10
def list_customer(customer_id, query_parameters={})
raise "Customer id cannot be blank" if customer_id.blank?
url = mount_url("?customer_id=#{customer_id}")
request(:get, url, params: query_parameters)
end
|