proxypay 0.2.2 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.DS_Store +0 -0
- data/.proxypay.gemspec.swp +0 -0
- data/README.md +37 -30
- data/_config.yml +1 -0
- data/lib/.proxypay.rb.swp +0 -0
- data/lib/proxypay/version.rb +1 -1
- data/lib/proxypay.rb +40 -23
- data/proxypay.gemspec +4 -4
- metadata +17 -15
- data/proxypay-0.2.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2c9bdc70835b0dd0bf3662093e8e061400bcadf65857f2b015eb86107e96d6ae
|
4
|
+
data.tar.gz: e67304f184ae90aeb2764a1f8f60a590457ee565ad96a0e2dc5b50ac8ee3e686
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb7f2ac55295604899d351ed6058b48d220f2bdd123fc172faecf0732fe4cd71dd2dace9a5513b15798484dbdd81dfe91a8901703f15fcb221962eaa77b9d646
|
7
|
+
data.tar.gz: e003557c74666778d5b1ae9171736dd61549d6f67273644541bba38eccb88cd65685574d60db00948e8b04619c76cbe974d15871d500bc6da2786f91b60499fc
|
data/.DS_Store
ADDED
Binary file
|
Binary file
|
data/README.md
CHANGED
@@ -26,6 +26,21 @@ PROXYPAY_USER=api
|
|
26
26
|
PROXYPAY_API_KEY=your_api_key_obtained_from_proxypay_folks
|
27
27
|
```
|
28
28
|
|
29
|
+
to make requests with another api_key use this on every method call.
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
options = {api_key: your_api_key_obtained_from_proxypay_folks}
|
33
|
+
```
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
to make the request proxypay's test server use
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
options = {is_test: true}
|
41
|
+
```
|
42
|
+
|
43
|
+
|
29
44
|
## Usage
|
30
45
|
|
31
46
|
### Use the class methods to get it going
|
@@ -33,31 +48,33 @@ PROXYPAY_API_KEY=your_api_key_obtained_from_proxypay_folks
|
|
33
48
|
## References
|
34
49
|
### Fetch all available references
|
35
50
|
```ruby
|
36
|
-
Proxypay.get_references
|
51
|
+
Proxypay.get_references # Fetch all references
|
52
|
+
Proxypay.get_references(api_key: some_api_key) # fetch using this key
|
53
|
+
Proxypay.get_references(is_test: true) # fetch from the test server
|
54
|
+
|
37
55
|
```
|
38
56
|
### Fetch references by using query's
|
39
57
|
or you can pass one or several query's parameters and even use the custom_fields defined at proxypay.
|
40
58
|
```ruby
|
41
|
-
options = {status:"paid", offset:15, limit:13, q:{custom_fields:{your_fild:"some_data", some_other_filed:{that_takes:"an_hash"}}}}
|
42
|
-
Proxypay.
|
59
|
+
options = {query: {status:"paid", offset:15, limit:13, q:{custom_fields:{your_fild:"some_data", some_other_filed:{that_takes:"an_hash"}}}}}
|
60
|
+
Proxypay.get_references(options)
|
43
61
|
```
|
44
62
|
|
45
|
-
###
|
63
|
+
### Fetch a reference by using id
|
46
64
|
```ruby
|
47
|
-
|
65
|
+
options = {}
|
66
|
+
Proxypay.get_reference(id, options)
|
48
67
|
```
|
49
68
|
|
50
|
-
### Request a reference
|
69
|
+
### Request a new reference - amount and expiration_date for the reference are mandatory
|
51
70
|
```ruby
|
52
|
-
|
53
|
-
Proxypay.new_reference("2000.00", "2015-10-10", other_data)
|
71
|
+
Proxypay.new_reference("2000.00", "2015-10-10")
|
54
72
|
```
|
55
73
|
|
56
|
-
### Request a reference and add custom fields to your reference for your identification
|
74
|
+
### Request a reference and add custom fields to your reference for your identification.
|
57
75
|
```ruby
|
58
|
-
|
59
|
-
|
60
|
-
Proxypay.other_new_reference("2000.00", "2015-10-10", other_data, api_key)
|
76
|
+
options = {custom_fields: {invoice:"001-2015", description:"Client #{client_number} - monthly payment"}}
|
77
|
+
Proxypay.new_reference("2000.00", "2015-10-10", options)
|
61
78
|
```
|
62
79
|
|
63
80
|
## Payments
|
@@ -67,41 +84,32 @@ Proxypay.get_payments
|
|
67
84
|
```
|
68
85
|
### Fetch all the payments with limitation by the specified number(quantity)
|
69
86
|
```ruby
|
70
|
-
options = {n:48}
|
87
|
+
options = {query: {n:48}}
|
71
88
|
Proxypay.get_payments(options)
|
72
89
|
```
|
73
90
|
|
74
|
-
### Fetch all payments that haven't been acknowledged for an specific API KEY
|
75
|
-
```ruby
|
76
|
-
api_key = "OcSLBANU4tjRi9gfW5VUcMqkvzLOcSLBANU4tjRi9gfW5VUcMqkvzL"
|
77
|
-
Proxypay.other_get_payments(api_key)
|
78
|
-
```
|
79
|
-
|
80
91
|
### Fetch a specific payment by passing his ID
|
81
92
|
```ruby
|
82
|
-
|
93
|
+
options = {}
|
94
|
+
Proxypay.get_payment("OcSLBANU4tjRi9gfW5VUcMqkvzL", options)
|
83
95
|
```
|
84
96
|
|
85
97
|
### Acknowledge a payment by passing his ID
|
86
98
|
```ruby
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
### Acknowledge a payment by passing his ID for an specific API KEY
|
91
|
-
```ruby
|
92
|
-
api_key = "OcSLBANU4tjRi9gfW5VUcMqkvzLOcSLBANU4tjRi9gfW5VUcMqkvzL"
|
93
|
-
Proxypay.other_new_payment("OcSLBANU4tjRi9gfW5VUcMqkvzL", api_key)
|
99
|
+
options = {}
|
100
|
+
Proxypay.new_payment("OcSLBANU4tjRi9gfW5VUcMqkvzL", options)
|
94
101
|
```
|
95
102
|
|
96
103
|
### Acknowledge multiple payments by passing and array of ID's
|
97
104
|
```ruby
|
98
105
|
ids = ["OcSLBANU4tjRi9gfW5VUcMqkvzL", "EcJLBANU4trUi8gfM6MOcMqkvzH","VxELBANU4tjRi9gfW5VUcMqkvzZ"]
|
99
|
-
|
106
|
+
options = {}
|
107
|
+
Proxypay.new_payments(ids, options)
|
100
108
|
```
|
101
109
|
|
102
110
|
## Help and Docs
|
103
111
|
- [ProxyPay API](https://developer.proxypay.co.ao)
|
104
|
-
- [RDOC](http://www.rubydoc.info/gems/proxypay/0.2.
|
112
|
+
- [RDOC](http://www.rubydoc.info/gems/proxypay/0.2.3)
|
105
113
|
|
106
114
|
## Development
|
107
115
|
- You can fork the project
|
@@ -119,4 +127,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/smazia
|
|
119
127
|
## License
|
120
128
|
|
121
129
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
122
|
-
|
data/_config.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
theme: jekyll-theme-slate
|
Binary file
|
data/lib/proxypay/version.rb
CHANGED
data/lib/proxypay.rb
CHANGED
@@ -1,19 +1,15 @@
|
|
1
|
-
#require "./lib/proxypay/version.rb"
|
2
1
|
require "proxypay/version"
|
3
2
|
require "httparty"
|
4
3
|
|
5
4
|
module Proxypay
|
6
5
|
include HTTParty
|
6
|
+
debug_output $stdout
|
7
7
|
base_uri "https://api.proxypay.co.ao"
|
8
8
|
|
9
9
|
# Fetch all available references
|
10
10
|
def self.get_references(options = {})
|
11
|
-
# Proxypay.get_references(query: {limit: 20}, is_test: true, api_key: '0djwano5yth94ihrtw34ot9cehn9emo')
|
12
11
|
set_base_url(options.delete(:is_test))
|
13
|
-
|
14
|
-
content = {}
|
15
|
-
content[:basic_auth] = authenticate(options.delete(:api_key))
|
16
|
-
content[:headers] = {'Content-Type' => 'application/json'}
|
12
|
+
content = set_headers(options)
|
17
13
|
content[:query] = options.delete(:query) || {}
|
18
14
|
get("/references", content).parsed_response
|
19
15
|
end
|
@@ -21,29 +17,22 @@ module Proxypay
|
|
21
17
|
# Fetch a specific reference by his ID string
|
22
18
|
def self.get_reference(id, options = {})
|
23
19
|
set_base_url(options.delete(:is_test))
|
24
|
-
|
25
|
-
get("/references/#{id}",
|
20
|
+
content = set_headers(options)
|
21
|
+
get("/references/#{id}", content).parsed_response
|
26
22
|
end
|
27
23
|
|
28
24
|
# Submit a request to create a new reference
|
29
25
|
def self.new_reference(amount, expiry_date, options={})
|
30
|
-
# new_reference(78654.90, '12-12-2012', custom_fields: {foo: 'F0000-45', bar: 'MMM'}, api_key: 'ctsrxte56v8bgfyv7fuf676t7o89099y85ce6f', is_test: true)
|
31
26
|
set_base_url(options.delete(:is_test))
|
32
|
-
content =
|
33
|
-
content[:
|
34
|
-
content[:body] = {:reference => {:amount => amount, :expiry_date => expiry_date, custom_fields: (options.delete(:custom_fields) || {})}}.to_json
|
35
|
-
content[:headers] = {'Content-Type' => 'application/json'}
|
27
|
+
content = set_headers(options)
|
28
|
+
content[:body] = {:reference => {:amount => amount.to_s, :expiry_date => expiry_date.to_s, custom_fields: (options.delete(:custom_fields) || {})}}.to_json
|
36
29
|
post("/references", content).parsed_response
|
37
30
|
end
|
38
31
|
|
39
32
|
# Fetch all availables payments that have not been acknowledged.
|
40
33
|
def self.get_payments(options={})
|
41
|
-
# Proxypay.get_payments(query: {limit: 20}, is_test: true, api_key: '0djwano5yth94ihrtw34ot9cehn9emo')
|
42
34
|
set_base_url(options.delete(:is_test))
|
43
|
-
|
44
|
-
content = {}
|
45
|
-
content[:basic_auth] = authenticate(options.delete(:api_key))
|
46
|
-
content[:headers] = {'Content-Type' => 'application/json'}
|
35
|
+
content = set_headers(options)
|
47
36
|
content[:query] = options.delete(:query) || {}
|
48
37
|
get("/events/payments", content).parsed_response
|
49
38
|
end
|
@@ -51,25 +40,53 @@ module Proxypay
|
|
51
40
|
# Acknowledge a payment by submitting his ID
|
52
41
|
def self.new_payment(id, options = {})
|
53
42
|
set_base_url(options.delete(:is_test))
|
54
|
-
content =
|
43
|
+
content = set_headers(options)
|
55
44
|
delete("/events/payments/#{id}", content).parsed_response
|
56
45
|
end
|
57
46
|
|
58
47
|
# Acknowledge multiple payments by submitting an array of ids
|
59
48
|
def self.new_payments(ids, options = {})
|
60
49
|
set_base_url(options.delete(:is_test))
|
61
|
-
content =
|
50
|
+
content = set_headers(options)
|
62
51
|
content[:body] = { :ids => ids }.to_json
|
63
|
-
content[:basic_auth] = authenticate(options.delete(:api_key))
|
64
|
-
content[:headers] = {'Content-Type' => 'application/json'}
|
65
52
|
delete("/events/payments", content).parsed_response
|
66
53
|
end
|
67
54
|
|
55
|
+
# Get a list of customers
|
56
|
+
def self.get_customers(options = {})
|
57
|
+
set_base_url(options.delete(:is_test))
|
58
|
+
content = set_headers(options)
|
59
|
+
content[:query] = options.delete(:query) || {}
|
60
|
+
get("/customers", content).parsed_response
|
61
|
+
end
|
62
|
+
|
63
|
+
# get a customer by id
|
64
|
+
def self.get_customer(id, options = {})
|
65
|
+
set_base_url(options.delete(:is_test))
|
66
|
+
content = set_headers(options)
|
67
|
+
get("/customers/#{id}", content).parsed_response
|
68
|
+
end
|
69
|
+
|
70
|
+
# Store a new customer or update one
|
71
|
+
def self.new_customer(id, nome, telemovel, email, options = {})
|
72
|
+
set_base_url(options.delete(:is_test))
|
73
|
+
content = set_headers(options)
|
74
|
+
content[:body] = {:customer => {:name => nome.to_s, :mobile => telemovel.to_s, :email => email.to_s}}.to_json
|
75
|
+
put("/customers/#{id}", content).parsed_response
|
76
|
+
end
|
77
|
+
|
68
78
|
def self.set_base_url(is_test = false)
|
69
|
-
self.base_uri is_test == true ? "https://api.proxypay.co.ao
|
79
|
+
self.base_uri is_test == true ? "https://api.sandbox.proxypay.co.ao" : "https://api.proxypay.co.ao"
|
70
80
|
end
|
71
81
|
|
72
82
|
private
|
83
|
+
def self.set_headers(options)
|
84
|
+
content = {}
|
85
|
+
content[:basic_auth] = authenticate(options.delete(:api_key))
|
86
|
+
content[:headers] = {'Content-Type' => 'application/json', 'Accept' => 'application/vnd.proxypay.v1+json'}
|
87
|
+
return content
|
88
|
+
end
|
89
|
+
|
73
90
|
def self.authenticate(api_key = nil)
|
74
91
|
auth = {
|
75
92
|
username: api_key.nil? ? ENV["PROXYPAY_USER"] : 'api',
|
data/proxypay.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Sergio Maziano"]
|
10
10
|
spec.email = ["sergio.maziano@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{A Ruby gem for ProxyPay API(https://proxypay.co.ao) made by
|
12
|
+
spec.summary = %q{A Ruby gem for ProxyPay API(https://proxypay.co.ao) made by Sergio Maziano(https://github.com/smaziano) }
|
13
13
|
spec.description = %q{A ruby gem to connect your application with ProxyPay(https://www.proxypay.co.ao) API that allows your application to interact with the Angolan ATM system knows as Multicaixa for online payments by reference.}
|
14
14
|
|
15
15
|
spec.homepage = "https://github.com/smaziano/proxypay"
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
|
-
spec.add_development_dependency "bundler", "~>
|
32
|
-
spec.add_development_dependency "rake", "~>
|
33
|
-
spec.add_dependency "httparty", "~> 0.
|
31
|
+
spec.add_development_dependency "bundler", "~> 2.3.11"
|
32
|
+
spec.add_development_dependency "rake", "~> 13.0.6"
|
33
|
+
spec.add_dependency "httparty", "~> 0.20.0"
|
34
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proxypay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Maziano
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.3.11
|
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
|
-
version:
|
26
|
+
version: 2.3.11
|
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
|
-
version:
|
33
|
+
version: 13.0.6
|
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
|
-
version:
|
40
|
+
version: 13.0.6
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: httparty
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.20.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.20.0
|
55
55
|
description: A ruby gem to connect your application with ProxyPay(https://www.proxypay.co.ao)
|
56
56
|
API that allows your application to interact with the Angolan ATM system knows as
|
57
57
|
Multicaixa for online payments by reference.
|
@@ -61,23 +61,26 @@ executables: []
|
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
+
- ".DS_Store"
|
64
65
|
- ".gitignore"
|
66
|
+
- ".proxypay.gemspec.swp"
|
65
67
|
- CODE_OF_CONDUCT.md
|
66
68
|
- Gemfile
|
67
69
|
- LICENSE.txt
|
68
70
|
- README.md
|
69
71
|
- Rakefile
|
72
|
+
- _config.yml
|
70
73
|
- bin/console
|
71
74
|
- bin/setup
|
75
|
+
- lib/.proxypay.rb.swp
|
72
76
|
- lib/proxypay.rb
|
73
77
|
- lib/proxypay/version.rb
|
74
|
-
- proxypay-0.2.1.gem
|
75
78
|
- proxypay.gemspec
|
76
79
|
homepage: https://github.com/smaziano/proxypay
|
77
80
|
licenses:
|
78
81
|
- MIT
|
79
82
|
metadata: {}
|
80
|
-
post_install_message:
|
83
|
+
post_install_message:
|
81
84
|
rdoc_options: []
|
82
85
|
require_paths:
|
83
86
|
- lib
|
@@ -92,9 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
95
|
- !ruby/object:Gem::Version
|
93
96
|
version: '0'
|
94
97
|
requirements: []
|
95
|
-
|
96
|
-
|
97
|
-
signing_key:
|
98
|
+
rubygems_version: 3.1.4
|
99
|
+
signing_key:
|
98
100
|
specification_version: 4
|
99
|
-
summary: A Ruby gem for ProxyPay API(https://proxypay.co.ao) made by
|
101
|
+
summary: A Ruby gem for ProxyPay API(https://proxypay.co.ao) made by Sergio Maziano(https://github.com/smaziano)
|
100
102
|
test_files: []
|
data/proxypay-0.2.1.gem
DELETED
Binary file
|