paysimple-ruby 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +188 -106
- data/lib/paysimple.rb +9 -5
- data/lib/paysimple/config.rb +5 -0
- data/lib/paysimple/endpoint.rb +7 -7
- data/lib/paysimple/enumerations/execution_frequency_type.rb +16 -16
- data/lib/paysimple/enumerations/issuer.rb +9 -9
- data/lib/paysimple/enumerations/payment_status.rb +18 -18
- data/lib/paysimple/enumerations/payment_sub_type.rb +14 -14
- data/lib/paysimple/enumerations/payment_type.rb +7 -7
- data/lib/paysimple/enumerations/schedule_status.rb +10 -10
- data/lib/paysimple/errors/api_connection_error.rb +5 -5
- data/lib/paysimple/errors/api_error.rb +4 -4
- data/lib/paysimple/errors/authentication_error.rb +5 -5
- data/lib/paysimple/errors/invalid_request_error.rb +5 -5
- data/lib/paysimple/errors/paysimple_error.rb +21 -21
- data/lib/paysimple/resources/ach.rb +22 -22
- data/lib/paysimple/resources/payment.rb +30 -30
- data/lib/paysimple/resources/payment_plan.rb +38 -38
- data/lib/paysimple/resources/recurring_payment.rb +38 -38
- data/lib/paysimple/version.rb +1 -1
- metadata +19 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d72934d9ab7c9be941454512b7674d7bce62d091
|
4
|
+
data.tar.gz: 55e90ef74d5848c4fad29650c03a0d986cc0013b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba40c77177d2d04417bfcbc4216d79318b8589089cb0f71e463100d79d447dd5bd9d42779b7bdd3064a1fee3f105cd007fc488741183ffb45c1cbccdd90491f7
|
7
|
+
data.tar.gz: 85ff5b42ea3b1bf49b3b125328c838f494668628e95ebfec79b0af585261daf1e263cd54b0ebc73a22f12471e0dbb62c9b53d48c7d0adae945436c748969bacd
|
data/README.md
CHANGED
@@ -1,106 +1,188 @@
|
|
1
|
-
# Ruby client library for Paysimple API v4.0
|
2
|
-
|
3
|
-
Ruby client to interact with [PaySimple] API. Detailed API documentation can be found here: [documentation]
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Execute this command:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem install 'paysimple-ruby'
|
11
|
-
```
|
12
|
-
|
13
|
-
If you're using Rails, simply add this to your `Gemfile` :
|
14
|
-
|
15
|
-
```ruby
|
16
|
-
gem 'paysimple-ruby'
|
17
|
-
```
|
18
|
-
|
19
|
-
## Configuration
|
20
|
-
|
21
|
-
Initialize Paysimple client with user id and access token:
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
require 'paysimple'
|
25
|
-
Paysimple.api_user = '<your api username>'
|
26
|
-
Paysimple.api_key = '<your api key>
|
27
|
-
```
|
28
|
-
|
29
|
-
By default the library will try to connect to the production endpoint. You can customize this behavior by specifying API endpoint explicitly:
|
30
|
-
|
31
|
-
```ruby
|
32
|
-
Paysimple.api_endpoint = Paysimple::Endpoint::PRODUCTION
|
33
|
-
```
|
34
|
-
|
35
|
-
or
|
36
|
-
|
37
|
-
```ruby
|
38
|
-
Paysimple.api_endpoint = Paysimple::Endpoint::SANDBOX
|
39
|
-
```
|
40
|
-
|
41
|
-
## Usage examples
|
42
|
-
|
43
|
-
###Customer
|
44
|
-
|
45
|
-
```ruby
|
46
|
-
# create new customer
|
47
|
-
customer = Paysimple::Customer.create({ first_name: 'John', last_name: 'Doe' })
|
48
|
-
|
49
|
-
# update customer
|
50
|
-
updated_customer = Paysimple::Customer.update({ id: customer[:id], first_name: 'John', last_name: 'Smith' })
|
51
|
-
|
52
|
-
# get customer by ID
|
53
|
-
customer = Paysimple::Customer.get(customer[:id])
|
54
|
-
|
55
|
-
# find customers
|
56
|
-
customers = Paysimple::Customer.find({ page: 1, page_size: 10, company: 'ABC company' })
|
57
|
-
|
58
|
-
# get customer's payments and payment schedules
|
59
|
-
payments = Paysimple::Customer.payments(customer[:id], { page_size: 5 })
|
60
|
-
payment_schedules = Paysimple::Customer.payment_schedules(customer[:id], { page_size: 5 })
|
61
|
-
|
62
|
-
# delete customer
|
63
|
-
Paysimple::Customer.delete(customer[:id])
|
64
|
-
```
|
65
|
-
|
66
|
-
### CreditCard
|
67
|
-
|
68
|
-
```ruby
|
69
|
-
# create credit card
|
70
|
-
credit_card = Paysimple::CreditCard.create({
|
71
|
-
customer_id: customer[:id],
|
72
|
-
credit_card_number: '4111111111111111',
|
73
|
-
expiration_date: '12/2021',
|
74
|
-
billing_zip_code: '80202',
|
75
|
-
issuer: Issuer::VISA,
|
76
|
-
is_default: true
|
77
|
-
})
|
78
|
-
|
79
|
-
# update credit card
|
80
|
-
updated_credit_card = Paysimple::CreditCard.update({ id: credit_card[:id], ... })
|
81
|
-
|
82
|
-
# delete credit card
|
83
|
-
Paysimple::CreditCard.delete(credit_card[:id])
|
84
|
-
```
|
85
|
-
|
86
|
-
###
|
87
|
-
|
88
|
-
```ruby
|
89
|
-
# create
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
1
|
+
# Ruby client library for Paysimple API v4.0
|
2
|
+
|
3
|
+
Ruby client to interact with [PaySimple] API. Detailed API documentation can be found here: [documentation]
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Execute this command:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem install 'paysimple-ruby'
|
11
|
+
```
|
12
|
+
|
13
|
+
If you're using Rails, simply add this to your `Gemfile` :
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'paysimple-ruby'
|
17
|
+
```
|
18
|
+
|
19
|
+
## Configuration
|
20
|
+
|
21
|
+
Initialize Paysimple client with user id and access token:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'paysimple'
|
25
|
+
Paysimple.api_user = '<your api username>'
|
26
|
+
Paysimple.api_key = '<your api key>
|
27
|
+
```
|
28
|
+
|
29
|
+
By default the library will try to connect to the production endpoint. You can customize this behavior by specifying API endpoint explicitly:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
Paysimple.api_endpoint = Paysimple::Endpoint::PRODUCTION
|
33
|
+
```
|
34
|
+
|
35
|
+
or
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
Paysimple.api_endpoint = Paysimple::Endpoint::SANDBOX
|
39
|
+
```
|
40
|
+
|
41
|
+
## Usage examples
|
42
|
+
|
43
|
+
###Customer
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
# create new customer
|
47
|
+
customer = Paysimple::Customer.create({ first_name: 'John', last_name: 'Doe' })
|
48
|
+
|
49
|
+
# update customer
|
50
|
+
updated_customer = Paysimple::Customer.update({ id: customer[:id], first_name: 'John', last_name: 'Smith' })
|
51
|
+
|
52
|
+
# get customer by ID
|
53
|
+
customer = Paysimple::Customer.get(customer[:id])
|
54
|
+
|
55
|
+
# find customers
|
56
|
+
customers = Paysimple::Customer.find({ page: 1, page_size: 10, company: 'ABC company' })
|
57
|
+
|
58
|
+
# get customer's payments and payment schedules
|
59
|
+
payments = Paysimple::Customer.payments(customer[:id], { page_size: 5 })
|
60
|
+
payment_schedules = Paysimple::Customer.payment_schedules(customer[:id], { page_size: 5 })
|
61
|
+
|
62
|
+
# delete customer
|
63
|
+
Paysimple::Customer.delete(customer[:id])
|
64
|
+
```
|
65
|
+
|
66
|
+
### CreditCard
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
# create credit card
|
70
|
+
credit_card = Paysimple::CreditCard.create({
|
71
|
+
customer_id: customer[:id],
|
72
|
+
credit_card_number: '4111111111111111',
|
73
|
+
expiration_date: '12/2021',
|
74
|
+
billing_zip_code: '80202',
|
75
|
+
issuer: Paysimple::Issuer::VISA,
|
76
|
+
is_default: true
|
77
|
+
})
|
78
|
+
|
79
|
+
# update credit card
|
80
|
+
updated_credit_card = Paysimple::CreditCard.update({ id: credit_card[:id], ... })
|
81
|
+
|
82
|
+
# delete credit card
|
83
|
+
Paysimple::CreditCard.delete(credit_card[:id])
|
84
|
+
```
|
85
|
+
|
86
|
+
###ACH
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
# create ACH
|
90
|
+
ach = Paysimple::ACH.create({
|
91
|
+
customer_id: customer[:id],
|
92
|
+
account_number: '751111111',
|
93
|
+
routing_number: '131111114',
|
94
|
+
bank_name: 'PaySimple Bank',
|
95
|
+
is_checking_account: true,
|
96
|
+
is_default: true
|
97
|
+
})
|
98
|
+
|
99
|
+
# update ACH
|
100
|
+
updated_ach = Paysimple::ACH.update({ id: ach[:id], ... })
|
101
|
+
|
102
|
+
# delete ACH
|
103
|
+
Paysimple::ACH.delete(ach[:id])
|
104
|
+
```
|
105
|
+
|
106
|
+
###Payment
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
# create payment
|
110
|
+
payment = Paysimple::Payment.create({ amount: 100, account_id: credit_card[:id] })
|
111
|
+
|
112
|
+
# get payment
|
113
|
+
payment = Paysimple::Payment.get(payment[:id])
|
114
|
+
|
115
|
+
# void payment
|
116
|
+
Paysimple::Payment.void(payment[:id])
|
117
|
+
|
118
|
+
# refund payment
|
119
|
+
Paysimple::Payment.refund(payment[:id])
|
120
|
+
|
121
|
+
# find payments
|
122
|
+
payments = Paysimple::Payment.find({ status: 'authorized', page_size: 10 })
|
123
|
+
```
|
124
|
+
|
125
|
+
### RecurringPayment
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
# create recurring payment
|
129
|
+
recurring_payment = Paysimple::RecurringPayment.create({
|
130
|
+
account_id: credit_card[:id],
|
131
|
+
payment_amount: 10,
|
132
|
+
start_date: Date.today,
|
133
|
+
execution_frequency_type: Paysimple::ExecutionFrequencyType::DAILY
|
134
|
+
})
|
135
|
+
|
136
|
+
# get recurring payment
|
137
|
+
recurring_payment = Paysimple::RecurringPayment.get(recurring_payment[:id])
|
138
|
+
|
139
|
+
# suspend recurring payment
|
140
|
+
Paysimple::RecurringPayment.suspend(recurring_payment[:id])
|
141
|
+
|
142
|
+
# resume recurring payment
|
143
|
+
Paysimple::RecurringPayment.resume(recurring_payment[:id])
|
144
|
+
|
145
|
+
# get payments connected with recurring payment
|
146
|
+
payments = Paysimple::RecurringPayment.payments(recurring_payment[:id])
|
147
|
+
|
148
|
+
# find recurring payments
|
149
|
+
recurring_payments = Paysimple::RecurringPayment.find({ page_size: 10 })
|
150
|
+
|
151
|
+
# delete recurring payment
|
152
|
+
Paysimple::RecurringPayment.delete(payment[:id])
|
153
|
+
```
|
154
|
+
|
155
|
+
###PaymentPlan
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
# create payment plan
|
159
|
+
payment_plan = Paysimple::PaymentPlan.create({
|
160
|
+
account_id: credit_card[:id],
|
161
|
+
total_due_amount: 10,
|
162
|
+
total_number_of_payments: 3,
|
163
|
+
start_date: Date.today,
|
164
|
+
execution_frequency_type: Paysimple::ExecutionFrequencyType::DAILY
|
165
|
+
})
|
166
|
+
|
167
|
+
# get payment plan
|
168
|
+
payment_plan = Paysimple::PaymentPlan.get(payment_plan[:id])
|
169
|
+
|
170
|
+
# suspend payment plan
|
171
|
+
Paysimple::PaymentPlan.suspend(payment_plan[:id])
|
172
|
+
|
173
|
+
# resume payment plan
|
174
|
+
Paysimple::PaymentPlan.resume(payment_plan[:id])
|
175
|
+
|
176
|
+
# get payments connected with payment plan
|
177
|
+
payments = Paysimple::PaymentPlan.payments(payment_plan[:id])
|
178
|
+
|
179
|
+
# find payment plan
|
180
|
+
payment_plans = Paysimple::PaymentPlan.find({ page_size: 10 })
|
181
|
+
|
182
|
+
# delete payment plan
|
183
|
+
Paysimple::PaymentPlan.delete(payment_plan[:id])
|
184
|
+
```
|
185
|
+
|
186
|
+
[PaySimple]:http://www.paysimple.com
|
187
|
+
[documentation]:http://developer.paysimple.com/documentation/
|
188
|
+
|
data/lib/paysimple.rb
CHANGED
@@ -9,6 +9,7 @@ require 'json'
|
|
9
9
|
require 'paysimple/version'
|
10
10
|
require 'paysimple/endpoint'
|
11
11
|
require 'paysimple/util'
|
12
|
+
require 'paysimple/config'
|
12
13
|
|
13
14
|
# Enumerations
|
14
15
|
require 'paysimple/enumerations/issuer'
|
@@ -36,9 +37,10 @@ require 'paysimple/errors/authentication_error'
|
|
36
37
|
module Paysimple
|
37
38
|
|
38
39
|
@api_endpoint = Endpoint::PRODUCTION
|
40
|
+
@ssl_version = Config::DEFAULT_SSL_VERSION
|
39
41
|
|
40
42
|
class << self
|
41
|
-
attr_accessor :api_key, :api_user, :api_endpoint
|
43
|
+
attr_accessor :api_key, :api_user, :api_endpoint, :ssl_version
|
42
44
|
end
|
43
45
|
|
44
46
|
def self.request(method, url, params={})
|
@@ -58,7 +60,7 @@ module Paysimple
|
|
58
60
|
end
|
59
61
|
|
60
62
|
request_opts = { headers: request_headers, method: method, open_timeout: 30,
|
61
|
-
payload: payload, url: url, timeout: 80 }
|
63
|
+
payload: payload, url: url, timeout: 80, ssl_version: ssl_version }
|
62
64
|
|
63
65
|
begin
|
64
66
|
response = execute_request(request_opts)
|
@@ -116,7 +118,7 @@ module Paysimple
|
|
116
118
|
def self.authorization_header
|
117
119
|
utc_timestamp = Time.now.getutc.iso8601.encode(Encoding::UTF_8)
|
118
120
|
secret_key = @api_key.encode(Encoding::UTF_8)
|
119
|
-
hash = OpenSSL::HMAC.digest(OpenSSL::Digest
|
121
|
+
hash = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), secret_key, utc_timestamp)
|
120
122
|
signature = Base64.encode64(hash)
|
121
123
|
|
122
124
|
"PSSERVER accessid=#{@api_user}; timestamp=#{utc_timestamp}; signature=#{signature}"
|
@@ -134,8 +136,10 @@ module Paysimple
|
|
134
136
|
errors = error_obj[:meta][:errors][:error_messages].collect { |e| e[:message]}
|
135
137
|
raise InvalidRequestError.new(errors, rcode, rbody, error_obj)
|
136
138
|
when 401
|
137
|
-
|
139
|
+
error = "Error getting an API token. Check your authentication credentials and resubmit."
|
140
|
+
raise AuthenticationError.new(error, rcode, rbody, error_obj)
|
138
141
|
else
|
142
|
+
error = "There was an error processing the request."
|
139
143
|
raise APIError.new(error, rcode, rbody, error_obj)
|
140
144
|
end
|
141
145
|
end
|
@@ -159,4 +163,4 @@ module Paysimple
|
|
159
163
|
raise APIConnectionError.new(message + "\n\n(Network error: #{e.message})")
|
160
164
|
end
|
161
165
|
|
162
|
-
end
|
166
|
+
end
|
data/lib/paysimple/endpoint.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
module Paysimple
|
2
|
-
|
3
|
-
class Endpoint
|
4
|
-
PRODUCTION = 'https://api.paysimple.com'
|
5
|
-
SANDBOX = 'https://sandbox-api.paysimple.com'
|
6
|
-
end
|
7
|
-
|
1
|
+
module Paysimple
|
2
|
+
|
3
|
+
class Endpoint
|
4
|
+
PRODUCTION = 'https://api.paysimple.com'
|
5
|
+
SANDBOX = 'https://sandbox-api.paysimple.com'
|
6
|
+
end
|
7
|
+
|
8
8
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
module Paysimple
|
2
|
-
class ExecutionFrequencyType
|
3
|
-
|
4
|
-
DAILY = 1
|
5
|
-
WEEKLY = 2
|
6
|
-
BIWEEKLY = 3
|
7
|
-
FIRST_OF_MONTH = 4
|
8
|
-
SPECIFIC_DAY_OF_MONTH = 5
|
9
|
-
LAST_OF_MONTH = 6
|
10
|
-
QUARTERLY = 7
|
11
|
-
SEMI_ANNUALLY = 8
|
12
|
-
ANNUALLY = 9
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
1
|
+
module Paysimple
|
2
|
+
class ExecutionFrequencyType
|
3
|
+
|
4
|
+
DAILY = 1
|
5
|
+
WEEKLY = 2
|
6
|
+
BIWEEKLY = 3
|
7
|
+
FIRST_OF_MONTH = 4
|
8
|
+
SPECIFIC_DAY_OF_MONTH = 5
|
9
|
+
LAST_OF_MONTH = 6
|
10
|
+
QUARTERLY = 7
|
11
|
+
SEMI_ANNUALLY = 8
|
12
|
+
ANNUALLY = 9
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -1,10 +1,10 @@
|
|
1
|
-
module Paysimple
|
2
|
-
class Issuer
|
3
|
-
|
4
|
-
VISA = 12
|
5
|
-
MASTER_CARD = 13
|
6
|
-
AMERICAN_EXPRESS = 14
|
7
|
-
DISCOVER = 15
|
8
|
-
|
9
|
-
end
|
1
|
+
module Paysimple
|
2
|
+
class Issuer
|
3
|
+
|
4
|
+
VISA = 12
|
5
|
+
MASTER_CARD = 13
|
6
|
+
AMERICAN_EXPRESS = 14
|
7
|
+
DISCOVER = 15
|
8
|
+
|
9
|
+
end
|
10
10
|
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
module Paysimple
|
2
|
-
class PaymentStatus
|
3
|
-
|
4
|
-
PENDING = 0
|
5
|
-
POSTED = 1
|
6
|
-
SETTLED = 2
|
7
|
-
FAILED = 3
|
8
|
-
VOIDED = 5
|
9
|
-
REVERSED = 6
|
10
|
-
REVERSE_POSTED = 9
|
11
|
-
CHARGEBACK = 10
|
12
|
-
AUTHORIZED = 12
|
13
|
-
RETURNED = 13
|
14
|
-
REVERSE_NSF = 15
|
15
|
-
REFUND_SETTLED = 17
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
1
|
+
module Paysimple
|
2
|
+
class PaymentStatus
|
3
|
+
|
4
|
+
PENDING = 0
|
5
|
+
POSTED = 1
|
6
|
+
SETTLED = 2
|
7
|
+
FAILED = 3
|
8
|
+
VOIDED = 5
|
9
|
+
REVERSED = 6
|
10
|
+
REVERSE_POSTED = 9
|
11
|
+
CHARGEBACK = 10
|
12
|
+
AUTHORIZED = 12
|
13
|
+
RETURNED = 13
|
14
|
+
REVERSE_NSF = 15
|
15
|
+
REFUND_SETTLED = 17
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
module Paysimple
|
2
|
-
class PaymentSubType
|
3
|
-
|
4
|
-
# ACH
|
5
|
-
WEB = 4
|
6
|
-
TEL = 5
|
7
|
-
PPD = 6
|
8
|
-
CCD = 7
|
9
|
-
|
10
|
-
# CC
|
11
|
-
SWIPE = 10
|
12
|
-
MOTO = 11
|
13
|
-
|
14
|
-
end
|
1
|
+
module Paysimple
|
2
|
+
class PaymentSubType
|
3
|
+
|
4
|
+
# ACH
|
5
|
+
WEB = 4
|
6
|
+
TEL = 5
|
7
|
+
PPD = 6
|
8
|
+
CCD = 7
|
9
|
+
|
10
|
+
# CC
|
11
|
+
SWIPE = 10
|
12
|
+
MOTO = 11
|
13
|
+
|
14
|
+
end
|
15
15
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
module Paysimple
|
2
|
-
class PaymentType
|
3
|
-
|
4
|
-
CREDIT_CARD = 1
|
5
|
-
ACH = 2
|
6
|
-
|
7
|
-
end
|
1
|
+
module Paysimple
|
2
|
+
class PaymentType
|
3
|
+
|
4
|
+
CREDIT_CARD = 1
|
5
|
+
ACH = 2
|
6
|
+
|
7
|
+
end
|
8
8
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
module Paysimple
|
2
|
-
class ScheduleStatus
|
3
|
-
|
4
|
-
ACTIVE = 1
|
5
|
-
PAUSE_UNTIL = 2
|
6
|
-
EXPIRED = 3
|
7
|
-
SUSPENDED = 4
|
8
|
-
|
9
|
-
end
|
10
|
-
end
|
1
|
+
module Paysimple
|
2
|
+
class ScheduleStatus
|
3
|
+
|
4
|
+
ACTIVE = 1
|
5
|
+
PAUSE_UNTIL = 2
|
6
|
+
EXPIRED = 3
|
7
|
+
SUSPENDED = 4
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module Paysimple
|
2
|
-
|
3
|
-
class APIConnectionError < PaysimpleError
|
4
|
-
end
|
5
|
-
|
1
|
+
module Paysimple
|
2
|
+
|
3
|
+
class APIConnectionError < PaysimpleError
|
4
|
+
end
|
5
|
+
|
6
6
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
module Paysimple
|
2
|
-
class APIError < PaysimpleError
|
3
|
-
|
4
|
-
end
|
1
|
+
module Paysimple
|
2
|
+
class APIError < PaysimpleError
|
3
|
+
|
4
|
+
end
|
5
5
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module Paysimple
|
2
|
-
|
3
|
-
class AuthenticationError < PaysimpleError
|
4
|
-
end
|
5
|
-
|
1
|
+
module Paysimple
|
2
|
+
|
3
|
+
class AuthenticationError < PaysimpleError
|
4
|
+
end
|
5
|
+
|
6
6
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module Paysimple
|
2
|
-
|
3
|
-
class InvalidRequestError < PaysimpleError
|
4
|
-
end
|
5
|
-
|
1
|
+
module Paysimple
|
2
|
+
|
3
|
+
class InvalidRequestError < PaysimpleError
|
4
|
+
end
|
5
|
+
|
6
6
|
end
|
@@ -1,22 +1,22 @@
|
|
1
|
-
module Paysimple
|
2
|
-
|
3
|
-
class PaysimpleError < StandardError
|
4
|
-
attr_reader :message
|
5
|
-
attr_reader :http_status
|
6
|
-
attr_reader :http_body
|
7
|
-
attr_reader :json_body
|
8
|
-
|
9
|
-
def initialize(message=nil, http_status=nil, http_body=nil, json_body=nil)
|
10
|
-
@message = message
|
11
|
-
@http_status = http_status
|
12
|
-
@http_body = http_body
|
13
|
-
@json_body = json_body
|
14
|
-
end
|
15
|
-
|
16
|
-
def to_s
|
17
|
-
status_string = @http_status.nil? ? "" : "(Status #{@http_status}) "
|
18
|
-
"#{status_string}#{@message}"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
1
|
+
module Paysimple
|
2
|
+
|
3
|
+
class PaysimpleError < StandardError
|
4
|
+
attr_reader :message
|
5
|
+
attr_reader :http_status
|
6
|
+
attr_reader :http_body
|
7
|
+
attr_reader :json_body
|
8
|
+
|
9
|
+
def initialize(message=nil, http_status=nil, http_body=nil, json_body=nil)
|
10
|
+
@message = message
|
11
|
+
@http_status = http_status
|
12
|
+
@http_body = http_body
|
13
|
+
@json_body = json_body
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
status_string = @http_status.nil? ? "" : "(Status #{@http_status}) "
|
18
|
+
"#{status_string}#{@message}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
22
|
end
|
@@ -1,23 +1,23 @@
|
|
1
|
-
module Paysimple
|
2
|
-
class ACH
|
3
|
-
|
4
|
-
def self.create(opts)
|
5
|
-
Paysimple.request(:post, url, opts)
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.update(opts)
|
9
|
-
Paysimple.request(:put, url, opts)
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.delete(id)
|
13
|
-
Paysimple.request(:delete, "#{url}/#{id}")
|
14
|
-
end
|
15
|
-
|
16
|
-
protected
|
17
|
-
|
18
|
-
def self.url
|
19
|
-
'/account/ach'
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
1
|
+
module Paysimple
|
2
|
+
class ACH
|
3
|
+
|
4
|
+
def self.create(opts)
|
5
|
+
Paysimple.request(:post, url, opts)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.update(opts)
|
9
|
+
Paysimple.request(:put, url, opts)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.delete(id)
|
13
|
+
Paysimple.request(:delete, "#{url}/#{id}")
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
def self.url
|
19
|
+
'/account/ach'
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
23
|
end
|
@@ -1,31 +1,31 @@
|
|
1
|
-
module Paysimple
|
2
|
-
class Payment
|
3
|
-
|
4
|
-
def self.create(opts)
|
5
|
-
Paysimple.request(:post, url, opts)
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.void(id)
|
9
|
-
Paysimple.request(:put, "#{url}/#{id}/void")
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.get(id)
|
13
|
-
Paysimple.request(:get, "#{url}/#{id}")
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.find(opts)
|
17
|
-
Paysimple.request(:get, url, opts)
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.refund(id)
|
21
|
-
Paysimple.request(:put, "#{url}/#{id}/reverse")
|
22
|
-
end
|
23
|
-
|
24
|
-
protected
|
25
|
-
|
26
|
-
def self.url
|
27
|
-
'/payment'
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
1
|
+
module Paysimple
|
2
|
+
class Payment
|
3
|
+
|
4
|
+
def self.create(opts)
|
5
|
+
Paysimple.request(:post, url, opts)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.void(id)
|
9
|
+
Paysimple.request(:put, "#{url}/#{id}/void")
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.get(id)
|
13
|
+
Paysimple.request(:get, "#{url}/#{id}")
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.find(opts)
|
17
|
+
Paysimple.request(:get, url, opts)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.refund(id)
|
21
|
+
Paysimple.request(:put, "#{url}/#{id}/reverse")
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def self.url
|
27
|
+
'/payment'
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
31
|
end
|
@@ -1,39 +1,39 @@
|
|
1
|
-
module Paysimple
|
2
|
-
class PaymentPlan
|
3
|
-
|
4
|
-
def self.create(opts)
|
5
|
-
Paysimple.request(:post, url, opts)
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.get(id)
|
9
|
-
Paysimple.request(:get, "#{url}/#{id}")
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.suspend(id)
|
13
|
-
Paysimple.request(:put, "#{url}/#{id}/suspend")
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.resume(id)
|
17
|
-
Paysimple.request(:put, "#{url}/#{id}/resume")
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.delete(id)
|
21
|
-
Paysimple.request(:delete, "#{url}/#{id}")
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.payments(id)
|
25
|
-
Paysimple.request(:get, "#{url}/#{id}/payments")
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.find(opts)
|
29
|
-
Paysimple.request(:get, url, opts)
|
30
|
-
end
|
31
|
-
|
32
|
-
protected
|
33
|
-
|
34
|
-
def self.url
|
35
|
-
'/paymentplan'
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
1
|
+
module Paysimple
|
2
|
+
class PaymentPlan
|
3
|
+
|
4
|
+
def self.create(opts)
|
5
|
+
Paysimple.request(:post, url, opts)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.get(id)
|
9
|
+
Paysimple.request(:get, "#{url}/#{id}")
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.suspend(id)
|
13
|
+
Paysimple.request(:put, "#{url}/#{id}/suspend")
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.resume(id)
|
17
|
+
Paysimple.request(:put, "#{url}/#{id}/resume")
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.delete(id)
|
21
|
+
Paysimple.request(:delete, "#{url}/#{id}")
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.payments(id)
|
25
|
+
Paysimple.request(:get, "#{url}/#{id}/payments")
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.find(opts)
|
29
|
+
Paysimple.request(:get, url, opts)
|
30
|
+
end
|
31
|
+
|
32
|
+
protected
|
33
|
+
|
34
|
+
def self.url
|
35
|
+
'/paymentplan'
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
39
|
end
|
@@ -1,39 +1,39 @@
|
|
1
|
-
module Paysimple
|
2
|
-
class RecurringPayment
|
3
|
-
|
4
|
-
def self.create(opts)
|
5
|
-
Paysimple.request(:post, url, opts)
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.get(id)
|
9
|
-
Paysimple.request(:get, "#{url}/#{id}")
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.suspend(id)
|
13
|
-
Paysimple.request(:put, "#{url}/#{id}/suspend")
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.resume(id)
|
17
|
-
Paysimple.request(:put, "#{url}/#{id}/resume")
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.delete(id)
|
21
|
-
Paysimple.request(:delete, "#{url}/#{id}")
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.payments(id)
|
25
|
-
Paysimple.request(:get, "#{url}/#{id}/payments")
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.find(opts)
|
29
|
-
Paysimple.request(:get, url, opts)
|
30
|
-
end
|
31
|
-
|
32
|
-
protected
|
33
|
-
|
34
|
-
def self.url
|
35
|
-
'/recurringpayment'
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
1
|
+
module Paysimple
|
2
|
+
class RecurringPayment
|
3
|
+
|
4
|
+
def self.create(opts)
|
5
|
+
Paysimple.request(:post, url, opts)
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.get(id)
|
9
|
+
Paysimple.request(:get, "#{url}/#{id}")
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.suspend(id)
|
13
|
+
Paysimple.request(:put, "#{url}/#{id}/suspend")
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.resume(id)
|
17
|
+
Paysimple.request(:put, "#{url}/#{id}/resume")
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.delete(id)
|
21
|
+
Paysimple.request(:delete, "#{url}/#{id}")
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.payments(id)
|
25
|
+
Paysimple.request(:get, "#{url}/#{id}/payments")
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.find(opts)
|
29
|
+
Paysimple.request(:get, url, opts)
|
30
|
+
end
|
31
|
+
|
32
|
+
protected
|
33
|
+
|
34
|
+
def self.url
|
35
|
+
'/recurringpayment'
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
39
|
end
|
data/lib/paysimple/version.rb
CHANGED
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paysimple-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Lebedev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.8'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rest-client
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.4'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.4'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: json
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 1.8.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.8.1
|
83
83
|
description: ''
|
@@ -87,9 +87,9 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- .gitignore
|
91
|
-
- .rspec
|
92
|
-
- .travis.yml
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
93
|
- Gemfile
|
94
94
|
- LICENSE.txt
|
95
95
|
- README.md
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- bin/console
|
98
98
|
- bin/setup
|
99
99
|
- lib/paysimple.rb
|
100
|
+
- lib/paysimple/config.rb
|
100
101
|
- lib/paysimple/endpoint.rb
|
101
102
|
- lib/paysimple/enumerations/execution_frequency_type.rb
|
102
103
|
- lib/paysimple/enumerations/issuer.rb
|
@@ -128,17 +129,17 @@ require_paths:
|
|
128
129
|
- lib
|
129
130
|
required_ruby_version: !ruby/object:Gem::Requirement
|
130
131
|
requirements:
|
131
|
-
- -
|
132
|
+
- - ">="
|
132
133
|
- !ruby/object:Gem::Version
|
133
134
|
version: '0'
|
134
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
136
|
requirements:
|
136
|
-
- -
|
137
|
+
- - ">="
|
137
138
|
- !ruby/object:Gem::Version
|
138
139
|
version: '0'
|
139
140
|
requirements: []
|
140
141
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.4.8
|
142
143
|
signing_key:
|
143
144
|
specification_version: 4
|
144
145
|
summary: Ruby bindings for Paysimple API
|