assist-ruby-sdk 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +26 -5
- data/lib/assist/api_methods.rb +7 -2
- data/lib/assist/payment_interface.rb +4 -2
- data/lib/assist/version.rb +1 -1
- data/lib/assist/web_services/base.rb +5 -0
- data/lib/assist/web_services/confirm_order.rb +25 -0
- metadata +18 -16
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NDFjNGNkMGNjY2FhNzZkOWNkZTc3Zjk1NmZmYjZjNmIzYWRlYjMwZg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6af43a889ea408444610358d9ad2cf24444fcabd
|
4
|
+
data.tar.gz: 50e7f7db96d1c542a780f308ed41f0e7392404a7
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
OTM4YjMxMWY4ZDgxYWYxMjY2MzE5NDg2OTU4NTg4NWMyNWJhYTQzN2RmMGI3
|
11
|
-
NTQxMjNhODdiNDU5MDIxOTc1ZjliNThmYTM2NDEzYTI5MGQ1YWU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MjM2NjVlNWJiMDA1N2U4Njg4MmMxY2I5ZTI2YmU3ZmVkNDFjMjM3MDBhM2M0
|
14
|
-
NzkyMzgzYjVlNDg5ZDkxN2FkYWIyY2IxNDViM2E3OWE1Y2FlZDg0YTgwYjA2
|
15
|
-
MDdlYjY0ZGMxZTIyMzEyODU5YzUyZWE5NzExNGQyMjY0NzU0MGM=
|
6
|
+
metadata.gz: 0d5c68068aa5a46d7ff0372c36fd73ccf115c68c1bf479b9a35616670acf41d2d50aa8f31086a3d8be7ebbca2a3ef5dc5d66b6212f73a302c5fdecd397500721
|
7
|
+
data.tar.gz: c75bc7f1e4fb0da329dcc9674a9159f8202e170500a01958c9c19cac6821f66253ac0886b6953fe8adc827f496cb61372e493ff0b10da7638639f120d1d7e761
|
data/README.md
CHANGED
@@ -120,8 +120,7 @@ See "Receiving status by order number" and "OrderState field values" in the docu
|
|
120
120
|
### Canceling payment
|
121
121
|
|
122
122
|
```ruby
|
123
|
-
|
124
|
-
billnumber = "5775486652369300"
|
123
|
+
billnumber = "5775486652369300" # number of payment in Assist
|
125
124
|
result = Assist.cancel_order(billnumber)
|
126
125
|
|
127
126
|
# with additional parameters
|
@@ -132,15 +131,37 @@ result = Assist.cancel_order(billnumber, extra_params)
|
|
132
131
|
result.request_params # => {merchant_id: '111111', login: 'login',
|
133
132
|
# password: 'password', ...}
|
134
133
|
|
135
|
-
# response
|
134
|
+
# response parameters
|
136
135
|
result.result # => {:ordernumber=>"999", :responsecode=>"AS000",
|
137
|
-
# :
|
136
|
+
# :orderstate=>"Canceled", :orderdate=>"28.09.2016 23:31:00",
|
138
137
|
# :amount=>"111.00", :currency=>"RUB", :billnumber=>"5775486652369300",
|
139
138
|
# ...
|
140
139
|
# }
|
141
140
|
|
142
141
|
# raw http response returned from Assist server (in XML format)
|
143
|
-
|
142
|
+
result.original_response # => #<Net::HTTPOK 200 OK readbody=true>
|
143
|
+
```
|
144
|
+
|
145
|
+
### Delayed (double-stage) payment
|
146
|
+
|
147
|
+
When the double-stage operation mode is used the customer's account is withdrawn
|
148
|
+
only after the payment has been confirmed by the merchant. In order to use this mode you need to send the parameter Delay=1 in the authorization request.
|
149
|
+
|
150
|
+
```ruby
|
151
|
+
# authorization url
|
152
|
+
url = Assist.payment_url(order_number, order_amount, delay: 1)
|
153
|
+
|
154
|
+
# Confirm order
|
155
|
+
billnumber = "5775486652369300" # number of payment in Assist
|
156
|
+
extra_params = {} # additional parameters
|
157
|
+
result = Assist.confirm_order(billnumber, extra_params)
|
158
|
+
|
159
|
+
# response parameters
|
160
|
+
result.result # => {:ordernumber=>"999", :responsecode=>"AS000",
|
161
|
+
# :orderstate=>"Approved", :orderdate=>"28.09.2016 23:31:00",
|
162
|
+
# :amount=>"111.00", :currency=>"RUB", :billnumber=>"5775486652369300",
|
163
|
+
# ...
|
164
|
+
# }
|
144
165
|
```
|
145
166
|
|
146
167
|
## API Errors
|
data/lib/assist/api_methods.rb
CHANGED
@@ -1,14 +1,19 @@
|
|
1
1
|
require 'assist/web_services/order_status'
|
2
2
|
require 'assist/web_services/cancel_order'
|
3
|
+
require 'assist/web_services/confirm_order'
|
3
4
|
|
4
5
|
module Assist
|
5
6
|
module ApiMethods
|
6
7
|
def order_status(*args)
|
7
|
-
WebServices::OrderStatus.new(*args)
|
8
|
+
WebServices::OrderStatus.new(*args).perform
|
8
9
|
end
|
9
10
|
|
10
11
|
def cancel_order(*args)
|
11
|
-
WebServices::CancelOrder.new(*args)
|
12
|
+
WebServices::CancelOrder.new(*args).perform
|
13
|
+
end
|
14
|
+
|
15
|
+
def confirm_order(*args)
|
16
|
+
WebServices::ConfirmOrder.new(*args).perform
|
12
17
|
end
|
13
18
|
end
|
14
19
|
end
|
@@ -12,7 +12,7 @@ module Assist
|
|
12
12
|
PERMITTED_EXTRA_PARAMS = %w(
|
13
13
|
OrderCurrency Language OrderComment Lastname Firstname Middlename
|
14
14
|
Email Address HomePhone WorkPhone MobilePhone Fax Country State City
|
15
|
-
Zip MobileDevice URL_RETURN URL_RETURN_OK URL_RETURN_NO
|
15
|
+
Zip MobileDevice Delay URL_RETURN URL_RETURN_OK URL_RETURN_NO
|
16
16
|
CardPayment YMPayment WMPayment QIWIPayment
|
17
17
|
QIWIMtsPayment QIWIMegafonPayment QIWIBeelinePayment QIWITele2Payment
|
18
18
|
).map(&normalize_block).freeze
|
@@ -50,11 +50,13 @@ module Assist
|
|
50
50
|
|
51
51
|
def default_params
|
52
52
|
attrs = {merchant_id: Assist.config.merchant_id}
|
53
|
+
|
53
54
|
{
|
54
55
|
return_url: :url_return,
|
55
56
|
success_url: :url_return_ok,
|
56
57
|
fail_url: :url_return_no
|
57
|
-
}
|
58
|
+
}
|
59
|
+
.each do |key, value|
|
58
60
|
attrs[value] = Assist.config[key] if Assist.config[key]
|
59
61
|
end
|
60
62
|
|
data/lib/assist/version.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'assist/web_services/base'
|
2
|
+
|
3
|
+
module Assist
|
4
|
+
module WebServices
|
5
|
+
class ConfirmOrder < Base
|
6
|
+
SERVICE_PATH = "/charge/charge.cfm".freeze
|
7
|
+
|
8
|
+
PERMITTED_EXTRA_PARAMS = %w(
|
9
|
+
Amount Currency Language ClientIP
|
10
|
+
).map(&normalize_block).freeze
|
11
|
+
|
12
|
+
def initialize(billnumber, extra_params = {})
|
13
|
+
super(extra_params)
|
14
|
+
@params[:billnumber] = billnumber
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def parse_result
|
20
|
+
last_result = response_xml.elements.each("result/orders/order") {}.last
|
21
|
+
Hash[last_result.elements.map { |e| [normalize(e.name), e.text] }]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assist-ruby-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Chumakov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-18 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.12'
|
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.12'
|
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: '3.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: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: webmock
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2.1'
|
62
62
|
type: :development
|
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: '2.1'
|
69
69
|
description: The Assist Ruby SDK provides Ruby APIs to create, process and manage
|
@@ -76,9 +76,9 @@ executables:
|
|
76
76
|
extensions: []
|
77
77
|
extra_rdoc_files: []
|
78
78
|
files:
|
79
|
-
- .gitignore
|
80
|
-
- .rspec
|
81
|
-
- .travis.yml
|
79
|
+
- ".gitignore"
|
80
|
+
- ".rspec"
|
81
|
+
- ".travis.yml"
|
82
82
|
- CODE_OF_CONDUCT.md
|
83
83
|
- Gemfile
|
84
84
|
- LICENSE.txt
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- lib/assist/version.rb
|
100
100
|
- lib/assist/web_services/base.rb
|
101
101
|
- lib/assist/web_services/cancel_order.rb
|
102
|
+
- lib/assist/web_services/confirm_order.rb
|
102
103
|
- lib/assist/web_services/order_status.rb
|
103
104
|
homepage: https://github.com/chumakoff/assist-ecommerce-sdk-ruby
|
104
105
|
licenses:
|
@@ -110,18 +111,19 @@ require_paths:
|
|
110
111
|
- lib
|
111
112
|
required_ruby_version: !ruby/object:Gem::Requirement
|
112
113
|
requirements:
|
113
|
-
- -
|
114
|
+
- - ">="
|
114
115
|
- !ruby/object:Gem::Version
|
115
116
|
version: '0'
|
116
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
118
|
requirements:
|
118
|
-
- -
|
119
|
+
- - ">="
|
119
120
|
- !ruby/object:Gem::Version
|
120
121
|
version: '0'
|
121
122
|
requirements: []
|
122
123
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.4.
|
124
|
+
rubygems_version: 2.4.6
|
124
125
|
signing_key:
|
125
126
|
specification_version: 4
|
126
127
|
summary: Assist Online Payment System SDK for Ruby.
|
127
128
|
test_files: []
|
129
|
+
has_rdoc:
|