-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from mollie/changelog
Changelog updates
- Loading branch information
Showing
12 changed files
with
153 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
method = Mollie::Method.get('ideal') | ||
|
||
# Include iDEAL issuers | ||
# Include issuers available for the payment method (e.g. for | ||
# iDEAL, KBC/CBC payment button or gift cards). | ||
method = Mollie::Method.get('ideal', include: 'issuers') | ||
|
||
# Include pricing for each payment method | ||
method = Mollie::Method.get('ideal', include: 'pricing') | ||
|
||
# Include both issuers and pricing | ||
method = Mollie::Method.get('ideal', include: 'issuers,pricing') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
payment = Mollie::Payment.update( | ||
'tr_7UhSN1zuXS', | ||
description: 'Order #98765', | ||
metadata: { | ||
order_id: '98765' | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
# List all subscriptions | ||
subscriptions = Mollie::Subscription.all | ||
|
||
# List all subscriptions for a customer | ||
subscriptions = Mollie::Customer::Subscription.all(customer_id: 'cst_5a2pPrwaWy') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,109 +1,6 @@ | ||
module Mollie | ||
class Customer | ||
class Subscription < Base | ||
STATUS_ACTIVE = 'active'.freeze | ||
STATUS_PENDING = 'pending'.freeze # Waiting for a valid mandate. | ||
STATUS_CANCELED = 'canceled'.freeze | ||
STATUS_SUSPENDED = 'suspended'.freeze # Active, but mandate became invalid. | ||
STATUS_COMPLETED = 'completed'.freeze | ||
|
||
attr_accessor :id, | ||
:customer_id, | ||
:mode, | ||
:created_at, | ||
:status, | ||
:amount, | ||
:times, | ||
:times_remaining, | ||
:interval, | ||
:next_payment_date, | ||
:description, | ||
:method, | ||
:mandate_id, | ||
:canceled_at, | ||
:webhook_url, | ||
:metadata, | ||
:application_fee, | ||
:_links | ||
|
||
alias links _links | ||
|
||
def active? | ||
status == STATUS_ACTIVE | ||
end | ||
|
||
def pending? | ||
status == STATUS_PENDING | ||
end | ||
|
||
def suspended? | ||
status == STATUS_SUSPENDED | ||
end | ||
|
||
def canceled? | ||
status == STATUS_CANCELED | ||
end | ||
|
||
def completed? | ||
status == STATUS_COMPLETED | ||
end | ||
|
||
def created_at=(created_at) | ||
@created_at = begin | ||
Time.parse(created_at.to_s) | ||
rescue StandardError | ||
nil | ||
end | ||
end | ||
|
||
def canceled_at=(canceled_at) | ||
@canceled_at = begin | ||
Time.parse(canceled_at.to_s) | ||
rescue StandardError | ||
nil | ||
end | ||
end | ||
|
||
def amount=(amount) | ||
@amount = Mollie::Amount.new(amount) | ||
end | ||
|
||
def times=(times) | ||
@times = times.to_i | ||
end | ||
|
||
def next_payment_date=(next_payment_date) | ||
@next_payment_date = begin | ||
Date.parse(next_payment_date) | ||
rescue StandardError | ||
nil | ||
end | ||
end | ||
|
||
def customer(options = {}) | ||
Customer.get(customer_id, options) | ||
end | ||
|
||
def payments(options = {}) | ||
resource_url = Util.extract_url(links, 'payments') | ||
return if resource_url.nil? | ||
response = Mollie::Client.instance.perform_http_call('GET', resource_url, nil, {}, options) | ||
Mollie::List.new(response, Payment) | ||
end | ||
|
||
def metadata=(metadata) | ||
@metadata = OpenStruct.new(metadata) if metadata.is_a?(Hash) | ||
end | ||
|
||
def application_fee=(application_fee) | ||
amount = Amount.new(application_fee['amount']) | ||
description = application_fee['description'] | ||
|
||
@application_fee = OpenStruct.new( | ||
amount: amount, | ||
description: description | ||
) | ||
end | ||
class Subscription < Mollie::Subscription | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
module Mollie | ||
class Subscription < Base | ||
STATUS_ACTIVE = 'active'.freeze | ||
STATUS_PENDING = 'pending'.freeze # Waiting for a valid mandate. | ||
STATUS_CANCELED = 'canceled'.freeze | ||
STATUS_SUSPENDED = 'suspended'.freeze # Active, but mandate became invalid. | ||
STATUS_COMPLETED = 'completed'.freeze | ||
|
||
attr_accessor :id, | ||
:customer_id, | ||
:mode, | ||
:created_at, | ||
:status, | ||
:amount, | ||
:times, | ||
:times_remaining, | ||
:interval, | ||
:next_payment_date, | ||
:description, | ||
:method, | ||
:mandate_id, | ||
:canceled_at, | ||
:webhook_url, | ||
:metadata, | ||
:application_fee, | ||
:_links | ||
|
||
alias links _links | ||
|
||
def active? | ||
status == STATUS_ACTIVE | ||
end | ||
|
||
def pending? | ||
status == STATUS_PENDING | ||
end | ||
|
||
def suspended? | ||
status == STATUS_SUSPENDED | ||
end | ||
|
||
def canceled? | ||
status == STATUS_CANCELED | ||
end | ||
|
||
def completed? | ||
status == STATUS_COMPLETED | ||
end | ||
|
||
def created_at=(created_at) | ||
@created_at = begin | ||
Time.parse(created_at.to_s) | ||
rescue StandardError | ||
nil | ||
end | ||
end | ||
|
||
def canceled_at=(canceled_at) | ||
@canceled_at = begin | ||
Time.parse(canceled_at.to_s) | ||
rescue StandardError | ||
nil | ||
end | ||
end | ||
|
||
def amount=(amount) | ||
@amount = Mollie::Amount.new(amount) | ||
end | ||
|
||
def times=(times) | ||
@times = times.to_i | ||
end | ||
|
||
def next_payment_date=(next_payment_date) | ||
@next_payment_date = begin | ||
Date.parse(next_payment_date) | ||
rescue StandardError | ||
nil | ||
end | ||
end | ||
|
||
def customer(options = {}) | ||
Customer.get(customer_id, options) | ||
end | ||
|
||
def payments(options = {}) | ||
resource_url = Util.extract_url(links, 'payments') | ||
return if resource_url.nil? | ||
response = Mollie::Client.instance.perform_http_call('GET', resource_url, nil, {}, options) | ||
Mollie::List.new(response, Mollie::Payment) | ||
end | ||
|
||
def metadata=(metadata) | ||
@metadata = OpenStruct.new(metadata) if metadata.is_a?(Hash) | ||
end | ||
|
||
def application_fee=(application_fee) | ||
amount = Amount.new(application_fee['amount']) | ||
description = application_fee['description'] | ||
|
||
@application_fee = OpenStruct.new( | ||
amount: amount, | ||
description: description | ||
) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters