docdata 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +24 -1
- data/lib/docdata/payment.rb +8 -3
- data/lib/docdata/version.rb +1 -1
- data/lib/docdata/xml/create.xml.erb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef05a139ce6a958d733c7bcdaf83dcb4317178da
|
4
|
+
data.tar.gz: 8c3d95b00beda7d7878d2312db9c6976a12877e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ccabadfe830fe56ce0289502fd06c948dca7b3b4d8407ef6fb7f093592139d652d9c2275b1197bb0f36513b7e901cea899cb551b27dca244ace33da4996237c
|
7
|
+
data.tar.gz: 80695ac4230942023a94a911fd0c5bc43f9e6d19a83c0d109156dd9933cbc7aa5efc3dea9e4722f0f11d04499c7e0418648f2b71eb7b738c680074f5d98737c1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## v0.1.0
|
2
|
+
* truncated description down to 50 characters in create xml
|
3
|
+
|
4
|
+
## v0.0.9
|
5
|
+
* added configuration settings
|
6
|
+
* updated documentation
|
7
|
+
|
8
|
+
## v0.0.6
|
9
|
+
|
10
|
+
* minor bug fixes
|
11
|
+
* added default_pm option
|
12
|
+
* set key and Docdata::Payment object in status response object
|
13
|
+
|
1
14
|
## v0.0.2 - v0.0.5
|
2
15
|
|
3
16
|
Version 0.0.5 is used in production environmints and works.
|
data/README.md
CHANGED
@@ -64,7 +64,7 @@ All the payment details that Docdata Payments requires, are - obviously - also r
|
|
64
64
|
| amount | Integer (amount in cents) | Yes |
|
65
65
|
| currency | String (ISO currency code) | Yes |
|
66
66
|
| order_reference | String (your own unique reference) | Yes |
|
67
|
-
| description | String | No |
|
67
|
+
| description | String (max. 50 char.)| No |
|
68
68
|
| profile | String (name of your Docdata Payment profile)| Yes |
|
69
69
|
| shopper | Docdata::Shopper | Yes |
|
70
70
|
| line_items | Array (of Docdata::LineItem objects) | No |
|
@@ -80,6 +80,16 @@ A quick warning about the default values for the Shopper object: **For some paym
|
|
80
80
|
|
81
81
|
If you use `GIROPAY`, `SEPA` and `AFTERPAY` this is the case. (Maybe also in other payment methods, please let me know!)
|
82
82
|
|
83
|
+
|
84
|
+
## Configuration in Rails application
|
85
|
+
Example usage. Use appropriate settings in `development.rb`, `production.rb` etc.
|
86
|
+
```ruby
|
87
|
+
config.docdata.username = "my_app_com"
|
88
|
+
config.docdata.password = "HeJ35N"
|
89
|
+
config.docdata.return_url = "http://localhost:3000/docdata" # gets appended by '/success', '/error', '/pending' depending on response
|
90
|
+
config.test_mode = true
|
91
|
+
```
|
92
|
+
|
83
93
|
## Example usage in Rails application
|
84
94
|
The example below assumes you have your application set up with a Order model, which contains the information needed for this transaction (amount, name, etc.).
|
85
95
|
|
@@ -198,6 +208,19 @@ When making a new `Docdata::Payment`, use the `default_act` parameter to redirec
|
|
198
208
|
#### Retrieve a list of iDeal banks to show
|
199
209
|
`Docata::Ideal.banks` returns an Array.
|
200
210
|
|
211
|
+
#### Find a payment
|
212
|
+
`Docdata::Payment.find("PAYMENTORDERKEYHERE")` returns either a `Docdata::Payment` object or a 'not found' error.
|
213
|
+
|
214
|
+
#### Check the status of a payment
|
215
|
+
`payment = Docdata::Payment.find("KEY"); payment.status => <Payment::Status>`
|
216
|
+
|
217
|
+
|
218
|
+
#### Cancel a payment
|
219
|
+
To cancel an existing Payment, you can do one of the following:
|
220
|
+
`payment = Docdata::Payment.find("KEY"); payment.cancel` or `Docdata::Payment.cancel("KEY")`
|
221
|
+
|
222
|
+
|
223
|
+
|
201
224
|
## Contributing
|
202
225
|
Want to contribute? Greate!
|
203
226
|
|
data/lib/docdata/payment.rb
CHANGED
@@ -147,8 +147,12 @@ module Docdata
|
|
147
147
|
response = Docdata.client.call(:status, xml: xml)
|
148
148
|
response_object = Docdata::Response.parse(:status, response)
|
149
149
|
|
150
|
+
response_object.key = key
|
151
|
+
response_object.payment = self
|
152
|
+
|
150
153
|
return response_object # Docdata::Response
|
151
154
|
end
|
155
|
+
alias_method :check, :status
|
152
156
|
|
153
157
|
# @return [String] The URI where the consumer can be redirected to in order to pay
|
154
158
|
def redirect_url
|
@@ -180,15 +184,15 @@ module Docdata
|
|
180
184
|
url[:ideal_issuer_id] = bank_id
|
181
185
|
url[:default_pm] = "IDEAL"
|
182
186
|
end
|
187
|
+
if prefered_payment_method.present?
|
188
|
+
url[:default_pm] = prefered_payment_method
|
189
|
+
end
|
183
190
|
params = URI.encode_www_form(url)
|
184
191
|
uri = "#{redirect_base_url}?#{params}"
|
185
192
|
end
|
186
193
|
alias_method :url, :redirect_url
|
187
194
|
|
188
195
|
|
189
|
-
private
|
190
|
-
|
191
|
-
|
192
196
|
# @return [String] the xml to send in the SOAP API
|
193
197
|
def create_xml
|
194
198
|
xml_file = "#{File.dirname(__FILE__)}/xml/create.xml.erb"
|
@@ -206,6 +210,7 @@ module Docdata
|
|
206
210
|
xml = ERB.new(template).result(namespace.instance_eval { binding })
|
207
211
|
end
|
208
212
|
|
213
|
+
private
|
209
214
|
|
210
215
|
# In case there are any line_items, validate them all and
|
211
216
|
# raise an error for the first invalid LineItem
|
data/lib/docdata/version.rb
CHANGED
@@ -35,7 +35,7 @@
|
|
35
35
|
</_1:billTo>
|
36
36
|
|
37
37
|
<% if payment.description.present? %>
|
38
|
-
<_1:description><%= payment.description %></_1:description>
|
38
|
+
<_1:description><%= payment.description[0..49] %></_1:description>
|
39
39
|
<% end %>
|
40
40
|
<% if payment.receipt_text.present? %>
|
41
41
|
<_1:receiptText><%= payment.receipt_text %></_1:receiptText>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docdata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henk Meijer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-08-
|
12
|
+
date: 2014-08-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|