polirb 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -5
- data/lib/polirb/client/transactions.rb +27 -3
- data/lib/polirb/request.rb +0 -1
- data/lib/polirb/static.rb +2 -1
- data/lib/polirb/version.rb +1 -1
- data/polirb.gemspec +1 -0
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32b720fb822753c160b1635a1ea3e9d231a7884d
|
4
|
+
data.tar.gz: 2f43f959736f53d9aab24ca6d194eb295bd96873
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a19c9f3ee9b9da8ca5b005bccc8b312f95e04e61acc95dc6b7720c4ea8d19c7e86c09faaa32040fdc9dcec76d3e792ae7dae19dbef88f4096fc04112a84f40b4
|
7
|
+
data.tar.gz: 00888c567fd9d3bea5db5ada3e57e144397072fdd4b33b951e5238bf157f498e657a02293e47df34a421bcd855077ca48f8c2dc4b9b7809ad9b0cb36548ed6ae
|
data/README.md
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# POLIrb
|
2
|
-
|
3
|
-
|
4
|
-
## Description
|
5
|
-
Unofficial Poli Gem for Ruby
|
2
|
+
Unofficial Poli Gem for Ruby. This is VERY MUCH a pre-release; in its current iteration - I've not yet even tested it with an API key from POLi.
|
6
3
|
|
7
4
|
## Installation
|
8
5
|
### Install the gem
|
@@ -33,7 +30,7 @@ Polirb.configure(
|
|
33
30
|
)
|
34
31
|
|
35
32
|
# Get the configuration
|
36
|
-
Polirb.configuration # => {
|
33
|
+
Polirb.configuration # => { ... }
|
37
34
|
|
38
35
|
# Reset the configuration
|
39
36
|
Polirb.reset_configuration
|
@@ -24,14 +24,18 @@ module Polirb
|
|
24
24
|
|
25
25
|
end
|
26
26
|
|
27
|
+
def get_transaction(transaction_token)
|
28
|
+
get_transaction_response(request(:get, Polirb::Static::GET_TRANSACTION, { "token" => transaction_token } ))
|
29
|
+
end
|
30
|
+
|
27
31
|
private
|
28
32
|
|
29
33
|
def initiate_transaction_response(response)
|
30
|
-
if response
|
34
|
+
if response["Success"] == true
|
31
35
|
{
|
32
36
|
:success => true,
|
33
|
-
:transaction_ref_no => response
|
34
|
-
:navigate_url => response
|
37
|
+
:transaction_ref_no => response["TransactionRefNo"],
|
38
|
+
:navigate_url => response["NavigateURL"],
|
35
39
|
}
|
36
40
|
else
|
37
41
|
{
|
@@ -42,5 +46,25 @@ module Polirb
|
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
49
|
+
def get_transaction_response(response)
|
50
|
+
if response
|
51
|
+
{
|
52
|
+
:success => true,
|
53
|
+
:currency_code => response["CurrencyCode"],
|
54
|
+
:payment_amount => response["PaymentAmount"],
|
55
|
+
:amount_paid => response["AmountPaid"],
|
56
|
+
:end_date_time => response["EndDateTime"],
|
57
|
+
:transaction_status_code => response["TransactionStatusCode"],
|
58
|
+
:error_code => response["ErrorCode"],
|
59
|
+
:merchant_reference => response["MerchantReference"],
|
60
|
+
:merchant_data => response["MerchantData"],
|
61
|
+
}
|
62
|
+
else
|
63
|
+
{
|
64
|
+
:success => false,
|
65
|
+
}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
45
69
|
end
|
46
70
|
end
|
data/lib/polirb/request.rb
CHANGED
data/lib/polirb/static.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Polirb
|
2
2
|
module Static
|
3
|
-
INITIATE_TRANSACTION
|
3
|
+
INITIATE_TRANSACTION = "https://poliapi.apac.paywithpoli.com/api/v2/Transaction/Initiate"
|
4
|
+
GET_TRANSACTION = "https://poliapi.apac.paywithpoli.com/api/v2/Transaction/GetTransaction"
|
4
5
|
end
|
5
6
|
end
|
data/lib/polirb/version.rb
CHANGED
data/polirb.gemspec
CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.add_development_dependency 'rspec', '~> 3.4'
|
14
14
|
s.add_development_dependency 'webmock', '~> 2.1'
|
15
|
+
s.add_development_dependency 'pry-byebug', '~> 3.1', '>= 3.1.0'
|
15
16
|
|
16
17
|
s.add_runtime_dependency 'json', '~> 2.0'
|
17
18
|
s.add_runtime_dependency 'rest-client', '~> 2.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polirb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Tennant
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -38,6 +38,26 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry-byebug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.1'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 3.1.0
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '3.1'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 3.1.0
|
41
61
|
- !ruby/object:Gem::Dependency
|
42
62
|
name: json
|
43
63
|
requirement: !ruby/object:Gem::Requirement
|