allorails 0.4.2 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/Gemfile.lock +26 -0
- data/Manifest +11 -5
- data/README.md +0 -1
- data/Rakefile +4 -4
- data/allorails.gemspec +6 -6
- data/lib/allorails/core.rb +1 -1
- data/lib/allorails/request/request.rb +1 -1
- data/lib/allorails/response/api_mapping_response.rb +93 -0
- data/lib/allorails/response/api_response.rb +27 -0
- data/lib/allorails/response/model.rb +45 -46
- data/lib/allorails/response/onetime_button_response.rb +28 -0
- data/lib/allorails/response/onetime_pricing_response.rb +37 -0
- data/lib/allorails/response/onetime_validate_codes_response.rb +81 -0
- data/lib/allorails/response/product_detail_response.rb +50 -0
- data/lib/allorails/response/transaction_detail_response.rb +94 -0
- data/lib/allorails/response/transaction_prepare_response.rb +36 -0
- data/lib/allorails.rb +15 -14
- metadata +23 -10
- data/lib/allorails/response/response.rb +0 -443
- data/test/allorails_spec.rb +0 -112
- data/test/test-conf-sample.yml +0 -11
- data/test/test-conf.yml +0 -12
@@ -0,0 +1,81 @@
|
|
1
|
+
## Class defining a onetime validate-codes request's response
|
2
|
+
class Allorails::Response::OnetimeValidateCodesResponse < Allorails::Response::ApiMappingResponse
|
3
|
+
## The validation is successful
|
4
|
+
VALIDATESCODES_SUCCESS = 0
|
5
|
+
|
6
|
+
## The validation failed
|
7
|
+
VALIDATESCODES_FAILED = 1
|
8
|
+
|
9
|
+
## Provides the validation status
|
10
|
+
# @return (int) validation status
|
11
|
+
node_reader :status, Integer
|
12
|
+
|
13
|
+
## Provides the validation status description
|
14
|
+
# @return (string) validation status description
|
15
|
+
node_reader :status_description
|
16
|
+
|
17
|
+
## Provides access type
|
18
|
+
# @return (string) access type
|
19
|
+
node_reader :access_type
|
20
|
+
|
21
|
+
## Provides the transaction id
|
22
|
+
# @return (string) transaction id
|
23
|
+
node_reader :transaction_id
|
24
|
+
|
25
|
+
## Provides price information
|
26
|
+
# @return (Price) price information
|
27
|
+
node_reader :price, Allorails::Price
|
28
|
+
|
29
|
+
## Provides paid price information
|
30
|
+
# @return (Price) paid price information
|
31
|
+
node_reader :paid, Allorails::Price
|
32
|
+
|
33
|
+
## Provides the validation date
|
34
|
+
# @return (datetime.datetime) validation date
|
35
|
+
node_reader :validation_date, DateTime
|
36
|
+
|
37
|
+
## Provides the product name
|
38
|
+
# @return (string) product name
|
39
|
+
node_reader :product_name
|
40
|
+
|
41
|
+
## Provides the website
|
42
|
+
# @return (Website) website
|
43
|
+
node_reader :website, Allorails::Website
|
44
|
+
|
45
|
+
## Provides the customer ip
|
46
|
+
# @return (string) customer ip
|
47
|
+
node_reader :customer_ip
|
48
|
+
|
49
|
+
## Provides the customer country
|
50
|
+
# @return (string) customer country
|
51
|
+
node_reader :customer_country
|
52
|
+
|
53
|
+
## Provides the expected number of codes
|
54
|
+
# @return (int) expected number of codes
|
55
|
+
node_reader :expected_number_of_codes, Integer
|
56
|
+
|
57
|
+
## Provides the codes you tried to validate
|
58
|
+
# @return (Array) list of Code objects
|
59
|
+
def codes
|
60
|
+
xml.css('codes code').map{|c| Allorails::Code.new(c)}
|
61
|
+
end
|
62
|
+
|
63
|
+
## Provides the merchant transaction id
|
64
|
+
# @return (string) merchant transaction id
|
65
|
+
node_reader :merchant_transaction_id
|
66
|
+
|
67
|
+
## Provides the client data
|
68
|
+
# @return (string) client data
|
69
|
+
node_reader :data
|
70
|
+
|
71
|
+
## Provides the affiliation code
|
72
|
+
# @return (string) affiliation code
|
73
|
+
node_reader :affiliate
|
74
|
+
|
75
|
+
## Provides information about the associated partners
|
76
|
+
# @return (list) partners information (list of Partner objects)
|
77
|
+
def partners
|
78
|
+
xml.css('partners partner').map{|c| Allorails::Partner.new(c)}
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
## Class defining a product detail request's response
|
2
|
+
class Allorails::Response::ProductDetailResponse < Allorails::Response::ApiMappingResponse
|
3
|
+
|
4
|
+
## Provides the product id
|
5
|
+
# @return (int) product id
|
6
|
+
node_reader :id, Integer
|
7
|
+
|
8
|
+
## Provides the product key
|
9
|
+
# @return (string) product key
|
10
|
+
node_reader :key
|
11
|
+
|
12
|
+
## Provides access type
|
13
|
+
# @return (string) access type
|
14
|
+
node_reader :access_type
|
15
|
+
|
16
|
+
## Provides the creation date
|
17
|
+
# @return (datetime.datetime) Creation date
|
18
|
+
node_reader :creation_date, DateTime
|
19
|
+
|
20
|
+
## Provides the product name
|
21
|
+
# @return (string) product name
|
22
|
+
node_reader :name
|
23
|
+
|
24
|
+
## Provides the website
|
25
|
+
# @return (Website) website
|
26
|
+
node_reader :website, Website
|
27
|
+
|
28
|
+
## Provides the expected number of codes
|
29
|
+
# @return (int) expected number of codes
|
30
|
+
node_reader :expected_number_of_codes, Integer
|
31
|
+
|
32
|
+
## Provides the purchase url
|
33
|
+
# @return (string) purchase url
|
34
|
+
node_reader :purchase_url
|
35
|
+
|
36
|
+
## Provides the forward url
|
37
|
+
# @return (string) forward url
|
38
|
+
node_reader :forward_url
|
39
|
+
|
40
|
+
## Provides the error url
|
41
|
+
# @return (string) error url
|
42
|
+
node_reader :error_url
|
43
|
+
|
44
|
+
## Provides the notification url
|
45
|
+
# @return (string) notification url
|
46
|
+
node_reader :notification_url
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
|
@@ -0,0 +1,94 @@
|
|
1
|
+
## Class defining a transaction detail request's response
|
2
|
+
class Allorails::Response::TransactionDetailResponse < Allorails::Response::ApiMappingResponse
|
3
|
+
|
4
|
+
## The transaction is at first step : initialization
|
5
|
+
INIT = -1
|
6
|
+
|
7
|
+
## The transaction is successful
|
8
|
+
SUCCESS = 0
|
9
|
+
|
10
|
+
## The transaction failed due to insufficient funds
|
11
|
+
INSUFFICIENT_FUNDS = 1
|
12
|
+
|
13
|
+
## The transaction timeouted
|
14
|
+
TIMEOUT = 2
|
15
|
+
|
16
|
+
## The transaction has been cancelled by user
|
17
|
+
CANCELLED = 3
|
18
|
+
|
19
|
+
## The transaction has been blocked due to fraud suspicions
|
20
|
+
ANTI_FRAUD = 4
|
21
|
+
|
22
|
+
## Provides the transaction status
|
23
|
+
# @return (int) transaction status
|
24
|
+
node_reader :status, Integer
|
25
|
+
|
26
|
+
## Provides the validation status description
|
27
|
+
# @return (string) validation status description
|
28
|
+
node_reader :status_description
|
29
|
+
|
30
|
+
## Provides access type
|
31
|
+
# @return (string) access type
|
32
|
+
node_reader :access_type
|
33
|
+
|
34
|
+
## Provides the tansaction id
|
35
|
+
# @return (string) transaction id
|
36
|
+
node_reader :transaction_id
|
37
|
+
|
38
|
+
## Provides price information
|
39
|
+
# @return (Price) price information
|
40
|
+
node_reader :price, Allorails::Price
|
41
|
+
|
42
|
+
## Provides paid price information
|
43
|
+
# @return (Price) paid price information
|
44
|
+
node_reader :paid, Allorails::Price
|
45
|
+
|
46
|
+
## Provides the creation date
|
47
|
+
# @return (datetime.datetime) Creation date
|
48
|
+
node_reader :creation_date, DateTime
|
49
|
+
|
50
|
+
## Provides the end date
|
51
|
+
# @return (datetime.datetime) end date
|
52
|
+
node_reader :end_date, DateTime
|
53
|
+
|
54
|
+
## Provides the product name
|
55
|
+
# @return (string) product name
|
56
|
+
node_reader :product_name
|
57
|
+
|
58
|
+
## Provides the customer ip
|
59
|
+
# @return (string) customer ip
|
60
|
+
node_reader :customer_ip
|
61
|
+
|
62
|
+
## Provides the customer country
|
63
|
+
# @return (string) customer country
|
64
|
+
node_reader :customer_country
|
65
|
+
|
66
|
+
## Provides the expected number of codes
|
67
|
+
# @return (int) expected number of codes
|
68
|
+
node_reader :expected_number_of_codes, Integer
|
69
|
+
|
70
|
+
## Provides the codes associated with the transaction
|
71
|
+
# @return (list) list of codes (list of string)
|
72
|
+
def codes
|
73
|
+
xml.css('codes code').map{|c| Allorails::Code.new(c)}
|
74
|
+
end
|
75
|
+
|
76
|
+
## Provides the merchant transaction id
|
77
|
+
# @return (string) merchant transaction id
|
78
|
+
node_reader :merchant_transaction_id
|
79
|
+
|
80
|
+
## Provides the client data
|
81
|
+
# @return (string) client data
|
82
|
+
node_reader :data
|
83
|
+
|
84
|
+
## Provides the affiliation code
|
85
|
+
# @return (string) affiliation code
|
86
|
+
node_reader :affiliate
|
87
|
+
|
88
|
+
## Provides information about the associated partners
|
89
|
+
# @return (list) partners information (list of Partner objects)
|
90
|
+
def partners
|
91
|
+
xml.css('partners').map{|c| Allorails::Partner.new(c)}
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
## Class defining a transaction prepare request's response
|
2
|
+
class Allorails::Response::TransactionPrepareResponse < Allorails::Response::ApiMappingResponse
|
3
|
+
|
4
|
+
## Provides access type
|
5
|
+
# @return (string) access type
|
6
|
+
node_reader :access_type
|
7
|
+
|
8
|
+
## Provides the transaction id
|
9
|
+
# @return (string) transaction id
|
10
|
+
node_reader :transaction_id
|
11
|
+
|
12
|
+
## Provides the creation date
|
13
|
+
# @return (datetime.datetime) Creation date
|
14
|
+
node_reader :creation_date, DateTime
|
15
|
+
|
16
|
+
## Provides price information
|
17
|
+
# @return (Price) price information
|
18
|
+
node_reader :price, Allorails::Price
|
19
|
+
|
20
|
+
## Provides information about the pricepoint
|
21
|
+
# @return (Pricepoint) pricepoint information
|
22
|
+
node_reader :pricepoint, Allorails::Pricepoint
|
23
|
+
|
24
|
+
## Provides the website
|
25
|
+
# @return (Website) website
|
26
|
+
node_reader :website, Allorails::Website
|
27
|
+
|
28
|
+
## Provides the buy url
|
29
|
+
# @return (string) buy url
|
30
|
+
node_reader :buy_url
|
31
|
+
|
32
|
+
## Provides the checkout button
|
33
|
+
# @return (string) checkout button (html code)
|
34
|
+
node_reader :checkout_button
|
35
|
+
|
36
|
+
end
|
data/lib/allorails.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'allorails/errors/errors'
|
4
|
-
|
5
|
-
module Allorails
|
1
|
+
module Allorails
|
6
2
|
|
7
3
|
#autoload :Conf, 'allorails/conf'
|
8
4
|
autoload :Api, 'allorails/api/api'
|
@@ -22,7 +18,7 @@ module Allorails
|
|
22
18
|
autoload :Keyword, 'allorails/response/model'
|
23
19
|
autoload :Partner, 'allorails/response/model'
|
24
20
|
autoload :Code, 'allorails/response/model'
|
25
|
-
|
21
|
+
|
26
22
|
module Request
|
27
23
|
autoload :ApiRequest, 'allorails/request/request'
|
28
24
|
autoload :OnetimePricingRequest, 'allorails/request/request'
|
@@ -37,15 +33,20 @@ module Allorails
|
|
37
33
|
end
|
38
34
|
|
39
35
|
module Response
|
40
|
-
autoload :ApiResponse,
|
41
|
-
autoload :
|
42
|
-
autoload :
|
43
|
-
autoload :
|
44
|
-
autoload :
|
45
|
-
autoload :
|
46
|
-
autoload :
|
36
|
+
autoload :ApiResponse, 'allorails/response/api_response'
|
37
|
+
autoload :ApiMappingResponse, 'allorails/response/api_mapping_response'
|
38
|
+
autoload :OnetimePricingResponse, 'allorails/response/onetime_pricing_response'
|
39
|
+
autoload :OnetimeValidateCodesResponse, 'allorails/response/onetime_validate_codes_response'
|
40
|
+
autoload :ProductDetailResponse, 'allorails/response/product_detail_response'
|
41
|
+
autoload :TransactionPrepareResponse, 'allorails/response/transaction_prepare_response'
|
42
|
+
autoload :TransactionDetailResponse, 'allorails/response/transaction_detail_response'
|
43
|
+
autoload :OnetimeButtonResponse, 'allorails/response/onetime_button_response'
|
47
44
|
end
|
48
|
-
|
45
|
+
|
49
46
|
end
|
50
47
|
|
48
|
+
require 'allorails/core'
|
49
|
+
|
50
|
+
require 'allorails/errors/errors'
|
51
|
+
|
51
52
|
require 'allorails/rails'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allorails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,9 +9,9 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-15 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description: Ruby client for the Allopass online payment
|
14
|
+
description: Ruby/Rails client for the Allopass online payment API
|
15
15
|
email: davide@feeligo.com
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
@@ -23,9 +23,19 @@ extra_rdoc_files:
|
|
23
23
|
- lib/allorails/errors/errors.rb
|
24
24
|
- lib/allorails/rails.rb
|
25
25
|
- lib/allorails/request/request.rb
|
26
|
+
- lib/allorails/response/api_mapping_response.rb
|
27
|
+
- lib/allorails/response/api_response.rb
|
26
28
|
- lib/allorails/response/model.rb
|
27
|
-
- lib/allorails/response/
|
29
|
+
- lib/allorails/response/onetime_button_response.rb
|
30
|
+
- lib/allorails/response/onetime_pricing_response.rb
|
31
|
+
- lib/allorails/response/onetime_validate_codes_response.rb
|
32
|
+
- lib/allorails/response/product_detail_response.rb
|
33
|
+
- lib/allorails/response/transaction_detail_response.rb
|
34
|
+
- lib/allorails/response/transaction_prepare_response.rb
|
28
35
|
files:
|
36
|
+
- Gemfile
|
37
|
+
- Gemfile.lock
|
38
|
+
- Manifest
|
29
39
|
- README.md
|
30
40
|
- Rakefile
|
31
41
|
- allorails.gemspec
|
@@ -36,12 +46,15 @@ files:
|
|
36
46
|
- lib/allorails/errors/errors.rb
|
37
47
|
- lib/allorails/rails.rb
|
38
48
|
- lib/allorails/request/request.rb
|
49
|
+
- lib/allorails/response/api_mapping_response.rb
|
50
|
+
- lib/allorails/response/api_response.rb
|
39
51
|
- lib/allorails/response/model.rb
|
40
|
-
- lib/allorails/response/
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
44
|
-
-
|
52
|
+
- lib/allorails/response/onetime_button_response.rb
|
53
|
+
- lib/allorails/response/onetime_pricing_response.rb
|
54
|
+
- lib/allorails/response/onetime_validate_codes_response.rb
|
55
|
+
- lib/allorails/response/product_detail_response.rb
|
56
|
+
- lib/allorails/response/transaction_detail_response.rb
|
57
|
+
- lib/allorails/response/transaction_prepare_response.rb
|
45
58
|
homepage: http://github.com/davb/allorails
|
46
59
|
licenses: []
|
47
60
|
post_install_message:
|
@@ -71,5 +84,5 @@ rubyforge_project: allorails
|
|
71
84
|
rubygems_version: 1.8.21
|
72
85
|
signing_key:
|
73
86
|
specification_version: 3
|
74
|
-
summary: Ruby client for the Allopass online payment
|
87
|
+
summary: Ruby/Rails client for the Allopass online payment API
|
75
88
|
test_files: []
|