mollie-api-ruby 2.2.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +7 -0
- data/README.md +37 -8
- data/examples/apis/api_docs.rb +1 -1
- data/examples/apis/chargebacks.rb +17 -0
- data/examples/apis/connect.rb +1 -1
- data/examples/apis/customers.rb +7 -6
- data/examples/apis/invoices.rb +2 -2
- data/examples/apis/issuers.rb +2 -2
- data/examples/apis/mandates.rb +5 -5
- data/examples/apis/methods.rb +2 -2
- data/examples/apis/organizations.rb +1 -1
- data/examples/apis/payments.rb +43 -9
- data/examples/apis/permissions.rb +2 -2
- data/examples/apis/profiles.rb +7 -7
- data/examples/apis/refunds.rb +1 -1
- data/examples/apis/settlements.rb +5 -5
- data/examples/apis/subscriptions.rb +7 -7
- data/examples/config.ru +6 -7
- data/lib/{mollie/api/cacert.pem → cacert.pem} +0 -0
- data/lib/mollie-api-ruby.rb +1 -0
- data/lib/mollie.rb +39 -0
- data/lib/mollie/base.rb +91 -0
- data/lib/mollie/chargeback.rb +36 -0
- data/lib/mollie/client.rb +125 -0
- data/lib/mollie/customer.rb +36 -0
- data/lib/mollie/customer/mandate.rb +33 -0
- data/lib/mollie/customer/payment.rb +6 -0
- data/lib/mollie/customer/subscription.rb +65 -0
- data/lib/mollie/exception.rb +8 -0
- data/lib/mollie/invoice.rb +66 -0
- data/lib/mollie/issuer.rb +5 -0
- data/lib/mollie/list.rb +40 -0
- data/lib/mollie/method.rb +38 -0
- data/lib/mollie/organization.rb +24 -0
- data/lib/mollie/payment.rb +142 -0
- data/lib/mollie/payment/chargeback.rb +6 -0
- data/lib/mollie/payment/refund.rb +6 -0
- data/lib/mollie/permission.rb +26 -0
- data/lib/mollie/profile.rb +78 -0
- data/lib/mollie/profile/api_key.rb +19 -0
- data/lib/mollie/refund.rb +42 -0
- data/lib/mollie/relation.rb +36 -0
- data/lib/mollie/settlement.rb +36 -0
- data/lib/mollie/settlement/chargeback.rb +6 -0
- data/lib/mollie/settlement/payment.rb +6 -0
- data/lib/mollie/settlement/refund.rb +6 -0
- data/lib/mollie/util.rb +57 -0
- data/lib/mollie/version.rb +3 -0
- data/mollie.gemspec +2 -2
- data/test/helper.rb +5 -1
- data/test/mollie/base_test.rb +182 -0
- data/test/mollie/chargeback_test.rb +35 -0
- data/test/mollie/client_test.rb +122 -0
- data/test/mollie/customer/mandate_test.rb +43 -0
- data/test/mollie/customer/payment_test.rb +23 -0
- data/test/mollie/customer/subscription_test.rb +66 -0
- data/test/mollie/customer_test.rb +128 -0
- data/test/mollie/invoice_test.rb +55 -0
- data/test/mollie/issuer_test.rb +19 -0
- data/test/mollie/list_test.rb +40 -0
- data/test/mollie/method_test.rb +29 -0
- data/test/mollie/organization_test.rb +41 -0
- data/test/mollie/payment/chargeback_test.rb +22 -0
- data/test/mollie/payment/refund_test.rb +22 -0
- data/test/mollie/payment_test.rb +161 -0
- data/test/mollie/permission_test.rb +21 -0
- data/test/mollie/profile/apikey_test.rb +31 -0
- data/test/mollie/profile_test.rb +98 -0
- data/test/mollie/refund_test.rb +40 -0
- data/test/mollie/settlement/chargeback_test.rb +22 -0
- data/test/mollie/settlement/payment_test.rb +22 -0
- data/test/mollie/settlement/refund_test.rb +22 -0
- data/test/mollie/settlement_test.rb +156 -0
- data/website-docs/chargebacks/list-all.rb +12 -0
- data/website-docs/connect/authorize.rb +15 -0
- data/website-docs/connect/tokens.rb +14 -0
- data/website-docs/customers/create-payment.rb +13 -0
- data/website-docs/customers/create.rb +12 -0
- data/website-docs/customers/delete.rb +10 -0
- data/website-docs/customers/get.rb +10 -0
- data/website-docs/customers/list-payments.rb +10 -0
- data/website-docs/customers/list.rb +12 -0
- data/website-docs/customers/update.rb +11 -0
- data/website-docs/invoices/get.rb +10 -0
- data/website-docs/invoices/list.rb +12 -0
- data/website-docs/issuers/get.rb +10 -0
- data/website-docs/issuers/list.rb +12 -0
- data/website-docs/mandates/create.rb +16 -0
- data/website-docs/mandates/delete.rb +10 -0
- data/website-docs/mandates/get.rb +10 -0
- data/website-docs/mandates/list.rb +12 -0
- data/website-docs/methods/get.rb +10 -0
- data/website-docs/methods/list.rb +12 -0
- data/website-docs/organisations/get.rb +10 -0
- data/website-docs/payments/create-refund.rb +14 -0
- data/website-docs/payments/create.rb +16 -0
- data/website-docs/payments/delete-refund.rb +13 -0
- data/website-docs/payments/delete.rb +12 -0
- data/website-docs/payments/get-chargeback.rb +11 -0
- data/website-docs/payments/get-refund.rb +11 -0
- data/website-docs/payments/get.rb +10 -0
- data/website-docs/payments/list-chargeback.rb +13 -0
- data/website-docs/payments/list-refunds.rb +13 -0
- data/website-docs/payments/list.rb +12 -0
- data/website-docs/payments/payment-webhook.rb +21 -0
- data/website-docs/permissions/get.rb +10 -0
- data/website-docs/permissions/list.rb +12 -0
- data/website-docs/profiles/create.rb +15 -0
- data/website-docs/profiles/delete.rb +10 -0
- data/website-docs/profiles/get-key.rb +11 -0
- data/website-docs/profiles/get.rb +10 -0
- data/website-docs/profiles/list-keys.rb +13 -0
- data/website-docs/profiles/list.rb +12 -0
- data/website-docs/profiles/reset-key.rb +13 -0
- data/website-docs/profiles/update.rb +12 -0
- data/website-docs/refunds/list.rb +12 -0
- data/website-docs/settlements/get.rb +10 -0
- data/website-docs/settlements/list-chargebacks.rb +13 -0
- data/website-docs/settlements/list-payments.rb +13 -0
- data/website-docs/settlements/list-refunds.rb +13 -0
- data/website-docs/settlements/list.rb +12 -0
- data/website-docs/settlements/next.rb +9 -0
- data/website-docs/settlements/open.rb +9 -0
- data/website-docs/subscriptions/create.rb +14 -0
- data/website-docs/subscriptions/delete.rb +10 -0
- data/website-docs/subscriptions/get.rb +10 -0
- data/website-docs/subscriptions/list.rb +12 -0
- metadata +134 -104
- data/lib/mollie/api/client.rb +0 -161
- data/lib/mollie/api/client/version.rb +0 -7
- data/lib/mollie/api/exception.rb +0 -10
- data/lib/mollie/api/object/base.rb +0 -18
- data/lib/mollie/api/object/customer.rb +0 -28
- data/lib/mollie/api/object/customer/mandate.rb +0 -37
- data/lib/mollie/api/object/customer/subscription.rb +0 -69
- data/lib/mollie/api/object/invoice.rb +0 -70
- data/lib/mollie/api/object/issuer.rb +0 -9
- data/lib/mollie/api/object/list.rb +0 -44
- data/lib/mollie/api/object/method.rb +0 -42
- data/lib/mollie/api/object/organization.rb +0 -28
- data/lib/mollie/api/object/payment.rb +0 -137
- data/lib/mollie/api/object/payment/refund.rb +0 -47
- data/lib/mollie/api/object/permission.rb +0 -12
- data/lib/mollie/api/object/profile.rb +0 -78
- data/lib/mollie/api/object/profile/apikey.rb +0 -23
- data/lib/mollie/api/object/settlement.rb +0 -32
- data/lib/mollie/api/resource/base.rb +0 -53
- data/lib/mollie/api/resource/customers.rb +0 -11
- data/lib/mollie/api/resource/customers/mandates.rb +0 -27
- data/lib/mollie/api/resource/customers/payments.rb +0 -27
- data/lib/mollie/api/resource/customers/subscriptions.rb +0 -27
- data/lib/mollie/api/resource/invoices.rb +0 -11
- data/lib/mollie/api/resource/issuers.rb +0 -11
- data/lib/mollie/api/resource/methods.rb +0 -11
- data/lib/mollie/api/resource/organizations.rb +0 -11
- data/lib/mollie/api/resource/payments.rb +0 -11
- data/lib/mollie/api/resource/payments/refunds.rb +0 -27
- data/lib/mollie/api/resource/permissions.rb +0 -31
- data/lib/mollie/api/resource/profiles.rb +0 -11
- data/lib/mollie/api/resource/profiles/apikeys.rb +0 -33
- data/lib/mollie/api/resource/refunds.rb +0 -11
- data/lib/mollie/api/resource/settlements.rb +0 -19
- data/lib/mollie/api/resource/settlements/payments.rb +0 -27
- data/lib/mollie/api/util.rb +0 -53
- data/test/mollie/api/client_test.rb +0 -111
- data/test/mollie/api/object/base_test.rb +0 -21
- data/test/mollie/api/object/customer/mandate_test.rb +0 -47
- data/test/mollie/api/object/customer/subscription_test.rb +0 -70
- data/test/mollie/api/object/customer_test.rb +0 -35
- data/test/mollie/api/object/invoice_test.rb +0 -59
- data/test/mollie/api/object/issuer_test.rb +0 -23
- data/test/mollie/api/object/list_test.rb +0 -44
- data/test/mollie/api/object/method_test.rb +0 -33
- data/test/mollie/api/object/organization_test.rb +0 -45
- data/test/mollie/api/object/payment/refund_test.rb +0 -46
- data/test/mollie/api/object/payment_test.rb +0 -106
- data/test/mollie/api/object/permission_test.rb +0 -25
- data/test/mollie/api/object/profile/apikey_test.rb +0 -35
- data/test/mollie/api/object/profile_test.rb +0 -72
- data/test/mollie/api/object/settlement_test.rb +0 -140
- data/test/mollie/api/resource/base_test.rb +0 -83
- data/test/mollie/api/resource/customers/mandates_test.rb +0 -23
- data/test/mollie/api/resource/customers/payments_test.rb +0 -23
- data/test/mollie/api/resource/customers/subscriptions_test.rb +0 -23
- data/test/mollie/api/resource/customers_test.rb +0 -13
- data/test/mollie/api/resource/invoices_test.rb +0 -13
- data/test/mollie/api/resource/issuers_test.rb +0 -13
- data/test/mollie/api/resource/methods_test.rb +0 -13
- data/test/mollie/api/resource/organizations_test.rb +0 -13
- data/test/mollie/api/resource/payments/refunds_test.rb +0 -23
- data/test/mollie/api/resource/payments_test.rb +0 -13
- data/test/mollie/api/resource/permissions_test.rb +0 -13
- data/test/mollie/api/resource/profiles/apikeys_test.rb +0 -23
- data/test/mollie/api/resource/profiles_test.rb +0 -13
- data/test/mollie/api/resource/settlements_test.rb +0 -13
- data/test/mollie/api/util_test.rb +0 -47
data/lib/mollie/api/exception.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module Mollie
|
2
|
-
module API
|
3
|
-
module Object
|
4
|
-
class Base
|
5
|
-
attr_reader :attributes
|
6
|
-
|
7
|
-
def initialize(attributes)
|
8
|
-
@attributes = attributes
|
9
|
-
attributes.each do |key, value|
|
10
|
-
if self.respond_to?("#{key}=")
|
11
|
-
public_send("#{key}=", value)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Mollie
|
2
|
-
module API
|
3
|
-
module Object
|
4
|
-
class Customer < Base
|
5
|
-
attr_accessor :id,
|
6
|
-
:mode,
|
7
|
-
:name,
|
8
|
-
:email,
|
9
|
-
:locale,
|
10
|
-
:metadata,
|
11
|
-
:recently_used_methods,
|
12
|
-
:created_datetime
|
13
|
-
|
14
|
-
def created_datetime=(created_datetime)
|
15
|
-
@created_datetime = Time.parse(created_datetime.to_s)
|
16
|
-
end
|
17
|
-
|
18
|
-
def recently_used_methods=(methods)
|
19
|
-
@recently_used_methods = Array(methods).map(&:to_s)
|
20
|
-
end
|
21
|
-
|
22
|
-
def metadata=(metadata)
|
23
|
-
@metadata = OpenStruct.new(metadata) if metadata.is_a?(Hash)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Mollie
|
2
|
-
module API
|
3
|
-
module Object
|
4
|
-
class Customer
|
5
|
-
class Mandate < Base
|
6
|
-
STATUS_VALID = "valid"
|
7
|
-
STATUS_INVALID = "invalid"
|
8
|
-
|
9
|
-
attr_accessor :id,
|
10
|
-
:status,
|
11
|
-
:method,
|
12
|
-
:customer_id,
|
13
|
-
:details,
|
14
|
-
:created_datetime,
|
15
|
-
:mandate_reference
|
16
|
-
|
17
|
-
|
18
|
-
def details=(details)
|
19
|
-
@details = OpenStruct.new(details) if details.is_a?(Hash)
|
20
|
-
end
|
21
|
-
|
22
|
-
def created_datetime=(created_datetime)
|
23
|
-
@created_datetime = Time.parse(created_datetime.to_s) rescue nil
|
24
|
-
end
|
25
|
-
|
26
|
-
def valid?
|
27
|
-
status == STATUS_VALID
|
28
|
-
end
|
29
|
-
|
30
|
-
def invalid?
|
31
|
-
status == STATUS_INVALID
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
module Mollie
|
2
|
-
module API
|
3
|
-
module Object
|
4
|
-
class Customer
|
5
|
-
class Subscription < Base
|
6
|
-
STATUS_ACTIVE = "active"
|
7
|
-
STATUS_PENDING = "pending" # Waiting for a valid mandate.
|
8
|
-
STATUS_CANCELLED = "cancelled"
|
9
|
-
STATUS_SUSPENDED = "suspended" # Active, but mandate became invalid.
|
10
|
-
STATUS_COMPLETED = "completed"
|
11
|
-
|
12
|
-
attr_accessor :resource,
|
13
|
-
:id,
|
14
|
-
:customer_id,
|
15
|
-
:mode,
|
16
|
-
:created_datetime,
|
17
|
-
:status,
|
18
|
-
:amount,
|
19
|
-
:times,
|
20
|
-
:interval,
|
21
|
-
:description,
|
22
|
-
:method,
|
23
|
-
:cancelled_datetime,
|
24
|
-
:links
|
25
|
-
|
26
|
-
def active?
|
27
|
-
status == STATUS_ACTIVE
|
28
|
-
end
|
29
|
-
|
30
|
-
def pending?
|
31
|
-
status == STATUS_PENDING
|
32
|
-
end
|
33
|
-
|
34
|
-
def suspended?
|
35
|
-
status == STATUS_SUSPENDED
|
36
|
-
end
|
37
|
-
|
38
|
-
def cancelled?
|
39
|
-
status == STATUS_CANCELLED
|
40
|
-
end
|
41
|
-
|
42
|
-
def completed?
|
43
|
-
status == STATUS_COMPLETED
|
44
|
-
end
|
45
|
-
|
46
|
-
def created_datetime=(created_datetime)
|
47
|
-
@created_datetime = Time.parse(created_datetime.to_s) rescue nil
|
48
|
-
end
|
49
|
-
|
50
|
-
def cancelled_datetime=(cancelled_datetime)
|
51
|
-
@cancelled_datetime = Time.parse(cancelled_datetime.to_s) rescue nil
|
52
|
-
end
|
53
|
-
|
54
|
-
def amount=(amount)
|
55
|
-
@amount = BigDecimal.new(amount.to_s)
|
56
|
-
end
|
57
|
-
|
58
|
-
def times=(times)
|
59
|
-
@times = times.to_i
|
60
|
-
end
|
61
|
-
|
62
|
-
def webhook_url
|
63
|
-
links && links['webhook_url']
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
module Mollie
|
2
|
-
module API
|
3
|
-
module Object
|
4
|
-
class Invoice < Base
|
5
|
-
STATUS_OPEN = "open"
|
6
|
-
STATUS_PAID = "paid"
|
7
|
-
STATUS_OVERDUE = "overdue"
|
8
|
-
|
9
|
-
class Amount < Base
|
10
|
-
attr_accessor :net, :vat, :gross
|
11
|
-
|
12
|
-
def net=(net)
|
13
|
-
@net = BigDecimal.new(net.to_s)
|
14
|
-
end
|
15
|
-
|
16
|
-
def vat=(vat)
|
17
|
-
@vat = BigDecimal.new(vat.to_s, 2)
|
18
|
-
end
|
19
|
-
|
20
|
-
def gross=(gross)
|
21
|
-
@gross = BigDecimal.new(gross.to_s)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class Line < Base
|
26
|
-
attr_accessor :period, :description, :count, :vat_percentage, :amount
|
27
|
-
|
28
|
-
def amount=(amount)
|
29
|
-
@amount = BigDecimal.new(amount.to_s)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
attr_accessor :resource, :id, :reference, :vat_number, :status,
|
34
|
-
:issue_date, :due_date, :amount, :lines, :links
|
35
|
-
|
36
|
-
def open?
|
37
|
-
status == STATUS_OPEN
|
38
|
-
end
|
39
|
-
|
40
|
-
def paid?
|
41
|
-
status == STATUS_PAID
|
42
|
-
end
|
43
|
-
|
44
|
-
def overdue?
|
45
|
-
status == STATUS_OVERDUE
|
46
|
-
end
|
47
|
-
|
48
|
-
def amount=(amount)
|
49
|
-
@amount = Amount.new(amount)
|
50
|
-
end
|
51
|
-
|
52
|
-
def issue_date=(issue_date)
|
53
|
-
@issue_date = Time.parse(issue_date) rescue nil
|
54
|
-
end
|
55
|
-
|
56
|
-
def due_date=(due_date)
|
57
|
-
@due_date = Time.parse(due_date) rescue nil
|
58
|
-
end
|
59
|
-
|
60
|
-
def lines=(lines)
|
61
|
-
@lines = lines.map { |line| Line.new(line) }
|
62
|
-
end
|
63
|
-
|
64
|
-
def pdf
|
65
|
-
links && links['pdf']
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module Mollie
|
2
|
-
module API
|
3
|
-
module Object
|
4
|
-
class List < Base
|
5
|
-
include Enumerable
|
6
|
-
|
7
|
-
attr_accessor :total_count,
|
8
|
-
:offset,
|
9
|
-
:count,
|
10
|
-
:links,
|
11
|
-
:data
|
12
|
-
|
13
|
-
def initialize(list_attributes, klass)
|
14
|
-
list_attributes['data'] ||= []
|
15
|
-
super list_attributes
|
16
|
-
|
17
|
-
@data = self.data.map do |attributes|
|
18
|
-
klass.new attributes
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def each(&block)
|
23
|
-
@data.each(&block)
|
24
|
-
end
|
25
|
-
|
26
|
-
def first_url
|
27
|
-
links && links['first']
|
28
|
-
end
|
29
|
-
|
30
|
-
def previous_url
|
31
|
-
links && links['previous']
|
32
|
-
end
|
33
|
-
|
34
|
-
def next_url
|
35
|
-
links && links['next']
|
36
|
-
end
|
37
|
-
|
38
|
-
def last_url
|
39
|
-
links && links['last']
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module Mollie
|
2
|
-
module API
|
3
|
-
module Object
|
4
|
-
class Method < Base
|
5
|
-
IDEAL = "ideal"
|
6
|
-
CREDITCARD = "creditcard"
|
7
|
-
MISTERCASH = "mistercash"
|
8
|
-
SOFORT = "sofort"
|
9
|
-
BANKTRANSFER = "banktransfer"
|
10
|
-
DIRECTDEBIT = "directdebit"
|
11
|
-
BITCOIN = "bitcoin"
|
12
|
-
PAYPAL = "paypal"
|
13
|
-
KBC = "kbc"
|
14
|
-
BELFIUS = "belfius"
|
15
|
-
PAYSAFECARD = "paysafecard"
|
16
|
-
PODIUMCADEAUKAART = "podiumcadeaukaart"
|
17
|
-
GIFTCARD = "giftcard"
|
18
|
-
|
19
|
-
attr_accessor :id,
|
20
|
-
:description,
|
21
|
-
:amount,
|
22
|
-
:image
|
23
|
-
|
24
|
-
def normal_image
|
25
|
-
image['normal']
|
26
|
-
end
|
27
|
-
|
28
|
-
def bigger_image
|
29
|
-
image['bigger']
|
30
|
-
end
|
31
|
-
|
32
|
-
def minimum_amount
|
33
|
-
BigDecimal.new(amount['minimum'].to_s)
|
34
|
-
end
|
35
|
-
|
36
|
-
def maximum_amount
|
37
|
-
BigDecimal.new(amount['maximum'].to_s)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Mollie
|
2
|
-
module API
|
3
|
-
module Object
|
4
|
-
class Organization < Base
|
5
|
-
attr_accessor :id,
|
6
|
-
:name,
|
7
|
-
:email,
|
8
|
-
:address,
|
9
|
-
:postal_code,
|
10
|
-
:city,
|
11
|
-
:country,
|
12
|
-
:country_code,
|
13
|
-
:registration_type,
|
14
|
-
:registration_number,
|
15
|
-
:registration_datetime,
|
16
|
-
:verified_datetime
|
17
|
-
|
18
|
-
def registration_datetime=(registration_datetime)
|
19
|
-
@registration_datetime = Time.parse(registration_datetime.to_s) rescue nil
|
20
|
-
end
|
21
|
-
|
22
|
-
def verified_datetime=(verified_datetime)
|
23
|
-
@verified_datetime = Time.parse(verified_datetime.to_s) rescue nil
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,137 +0,0 @@
|
|
1
|
-
module Mollie
|
2
|
-
module API
|
3
|
-
module Object
|
4
|
-
class Payment < Base
|
5
|
-
STATUS_OPEN = "open"
|
6
|
-
STATUS_CANCELLED = "cancelled"
|
7
|
-
STATUS_EXPIRED = "expired"
|
8
|
-
STATUS_PAID = "paid"
|
9
|
-
STATUS_PAIDOUT = "paidout"
|
10
|
-
STATUS_FAILED = "failed"
|
11
|
-
STATUS_REFUNDED = "refunded"
|
12
|
-
STATUS_PENDING = "pending"
|
13
|
-
STATUS_CHARGED_BACK = "charged_back"
|
14
|
-
|
15
|
-
RECURRINGTYPE_NONE = nil
|
16
|
-
RECURRINGTYPE_FIRST = "first"
|
17
|
-
RECURRINGTYPE_RECURRING = "recurring"
|
18
|
-
|
19
|
-
attr_accessor :id,
|
20
|
-
:mode,
|
21
|
-
:created_datetime,
|
22
|
-
:status,
|
23
|
-
:paid_datetime,
|
24
|
-
:cancelled_datetime,
|
25
|
-
:expired_datetime,
|
26
|
-
:expiry_period,
|
27
|
-
:amount,
|
28
|
-
:amount_refunded,
|
29
|
-
:amount_remaining,
|
30
|
-
:description,
|
31
|
-
:method,
|
32
|
-
:metadata,
|
33
|
-
:locale,
|
34
|
-
:profile_id,
|
35
|
-
:settlement_id,
|
36
|
-
:customer_id,
|
37
|
-
:recurring_type,
|
38
|
-
:mandate_id,
|
39
|
-
:subscription_id,
|
40
|
-
:links,
|
41
|
-
:details
|
42
|
-
|
43
|
-
def open?
|
44
|
-
status == STATUS_OPEN
|
45
|
-
end
|
46
|
-
|
47
|
-
def cancelled?
|
48
|
-
status == STATUS_CANCELLED
|
49
|
-
end
|
50
|
-
|
51
|
-
def expired?
|
52
|
-
status == STATUS_EXPIRED
|
53
|
-
end
|
54
|
-
|
55
|
-
def paid?
|
56
|
-
!!paid_datetime
|
57
|
-
end
|
58
|
-
|
59
|
-
def paidout?
|
60
|
-
status == STATUS_PAIDOUT
|
61
|
-
end
|
62
|
-
|
63
|
-
def refunded?
|
64
|
-
status == STATUS_REFUNDED
|
65
|
-
end
|
66
|
-
|
67
|
-
def failed?
|
68
|
-
status == STATUS_FAILED
|
69
|
-
end
|
70
|
-
|
71
|
-
def pending?
|
72
|
-
status == STATUS_PENDING
|
73
|
-
end
|
74
|
-
|
75
|
-
def charged_back?
|
76
|
-
status == STATUS_CHARGED_BACK
|
77
|
-
end
|
78
|
-
|
79
|
-
def details=(details)
|
80
|
-
@details = OpenStruct.new(details) if details.is_a?(Hash)
|
81
|
-
end
|
82
|
-
|
83
|
-
def metadata=(metadata)
|
84
|
-
@metadata = OpenStruct.new(metadata) if metadata.is_a?(Hash)
|
85
|
-
end
|
86
|
-
|
87
|
-
def created_datetime=(created_datetime)
|
88
|
-
@created_datetime = Time.parse(created_datetime.to_s) rescue nil
|
89
|
-
end
|
90
|
-
|
91
|
-
def paid_datetime=(paid_datetime)
|
92
|
-
@paid_datetime = Time.parse(paid_datetime.to_s) rescue nil
|
93
|
-
end
|
94
|
-
|
95
|
-
def cancelled_datetime=(cancelled_datetime)
|
96
|
-
@cancelled_datetime = Time.parse(cancelled_datetime.to_s) rescue nil
|
97
|
-
end
|
98
|
-
|
99
|
-
def expired_datetime=(expired_datetime)
|
100
|
-
@expired_datetime = Time.parse(expired_datetime.to_s) rescue nil
|
101
|
-
end
|
102
|
-
|
103
|
-
def amount=(amount)
|
104
|
-
@amount = BigDecimal.new(amount.to_s) if amount
|
105
|
-
end
|
106
|
-
|
107
|
-
def amount_remaining=(amount_remaining)
|
108
|
-
@amount_remaining = BigDecimal.new(amount_remaining.to_s) if amount_remaining
|
109
|
-
end
|
110
|
-
|
111
|
-
def amount_refunded=(amount_refunded)
|
112
|
-
@amount_refunded = BigDecimal.new(amount_refunded.to_s) if amount_refunded
|
113
|
-
end
|
114
|
-
|
115
|
-
def payment_url
|
116
|
-
links && links['payment_url']
|
117
|
-
end
|
118
|
-
|
119
|
-
def webhook_url
|
120
|
-
links && links['webhook_url']
|
121
|
-
end
|
122
|
-
|
123
|
-
def redirect_url
|
124
|
-
links && links['redirect_url']
|
125
|
-
end
|
126
|
-
|
127
|
-
def settlement
|
128
|
-
links && links['settlement']
|
129
|
-
end
|
130
|
-
|
131
|
-
def refunds
|
132
|
-
links && links['refunds']
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|