eport 0.0.1 → 0.0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README +30 -0
  2. data/lib/eport.rb +3 -23
  3. metadata +3 -2
data/README CHANGED
@@ -0,0 +1,30 @@
1
+ To work needs a configuration file 'eport.yml'
2
+ Сonfiguration file must be located in the directory 'config'.
3
+
4
+ Example: config/eport.yml
5
+
6
+ :eport:
7
+ :point: "your point number"
8
+ :private_key_path: "path relative RAILS_ROOT"
9
+ :host: "e-port host"
10
+
11
+
12
+ Operations.
13
+
14
+ You can do the following operations:
15
+ 1) CHECK
16
+ 2) OPERATION
17
+ 3) CONFIRM
18
+ 4) CANCEL
19
+
20
+ The first four operations are performed as follows:
21
+
22
+ eport = Eport.new
23
+ eport.refill_operation(operation_name, operation_id, product_id, value, account)
24
+
25
+ where operations_name can take the following values: :confirm, :check, :operation and :cancel
26
+
27
+ Catalog.
28
+
29
+ eport = Eport.new
30
+ eport.get_catalog
data/lib/eport.rb CHANGED
@@ -22,27 +22,7 @@ class Eport
22
22
  cp.new_catalog(data)
23
23
  end
24
24
 
25
- def do_refill_operation(operation_id, product_id, value, account)
26
- req = Request.new do |r|
27
- r.point = @config[:eport][:point]
28
- r.private_key_path = "#{RAILS_ROOT}/#{@config[:eport][:private_key_path]}"
29
-
30
- r.host = @config[:eport][:host]
31
- r.path = "/cp/fe"
32
-
33
- req = EportRequestPlainText.new
34
- req.operation_type = "OPERATION"
35
- req.operation_id = operation_id
36
- req.product_id = product_id
37
- req.value = value
38
- req.account = account
39
- r.body = req.body
40
- end
41
- ic = Iconv.new('UTF-8', 'WINDOWS-1251')
42
- ic.iconv(req.confirm)
43
- end
44
-
45
- def confirm_refill_operation(operation_id, product_id, value, account)
25
+ def refill_operation(operation_name, operation_id, product_id, value, account)
46
26
  req = Request.new do |r|
47
27
  r.point = @config[:eport][:point]
48
28
  r.private_key_path = "#{RAILS_ROOT}/#{@config[:eport][:private_key_path]}"
@@ -51,12 +31,12 @@ class Eport
51
31
  r.path = "/cp/fe"
52
32
 
53
33
  req = EportRequestPlainText.new
54
- req.operation_type = "CONFIRM"
34
+
35
+ req.operation_type = operation_name.to_s.upcase if [:operation, :confirm, :check, :cancel].include?(operation_name)
55
36
  req.operation_id = operation_id
56
37
  req.product_id = product_id
57
38
  req.value = value
58
39
  req.account = account
59
-
60
40
  r.body = req.body
61
41
  end
62
42
  ic = Iconv.new('UTF-8', 'WINDOWS-1251')
metadata CHANGED
@@ -6,7 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 0
8
8
  - 1
9
- version: 0.0.1
9
+ - 1
10
+ version: 0.0.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Alexander Lomakin, Dmitry Andreev
@@ -14,7 +15,7 @@ autorequire: eport
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-04-27 00:00:00 +04:00
18
+ date: 2010-04-28 00:00:00 +04:00
18
19
  default_executable:
19
20
  dependencies: []
20
21