alphaSDK 0.2.4 → 0.2.5
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.
- checksums.yaml +4 -4
- data/.gitignore +11 -11
- data/.rspec +3 -3
- data/.travis.yml +6 -6
- data/CODE_OF_CONDUCT.md +74 -74
- data/Gemfile +7 -7
- data/Gemfile.lock +34 -34
- data/LICENSE.txt +21 -21
- data/README.md +202 -44
- data/Rakefile +6 -6
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/examples.rb +139 -0
- data/gameball.gemspec +29 -29
- data/lib/gameball.rb +8 -0
- data/lib/gameball/models/action.rb +17 -0
- data/lib/gameball/models/coupon.rb +14 -0
- data/lib/gameball/models/player.rb +4 -0
- data/lib/gameball/models/transaction.rb +25 -0
- data/lib/gameball/utils/helper.rb +4 -0
- data/lib/gameball/version.rb +1 -1
- data/lib/testFile.rb +101 -0
- data/sdk.gemspec +13 -0
- data/unitTests.rb +398 -0
- metadata +6 -2
data/Rakefile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require "bundler/gem_tasks"
|
|
2
|
-
require "rspec/core/rake_task"
|
|
3
|
-
|
|
4
|
-
RSpec::Core::RakeTask.new(:spec)
|
|
5
|
-
|
|
6
|
-
task :default => :spec
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
require "rspec/core/rake_task"
|
|
3
|
+
|
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
5
|
+
|
|
6
|
+
task :default => :spec
|
data/bin/console
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require "bundler/setup"
|
|
4
|
-
require "gameball"
|
|
5
|
-
|
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
-
|
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
-
# require "pry"
|
|
11
|
-
# Pry.start
|
|
12
|
-
|
|
13
|
-
require "irb"
|
|
14
|
-
IRB.start(__FILE__)
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "gameball"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
IFS=$'\n\t'
|
|
4
|
-
set -vx
|
|
5
|
-
|
|
6
|
-
bundle install
|
|
7
|
-
|
|
8
|
-
# Do any other automated setup that you need to do here
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
IFS=$'\n\t'
|
|
4
|
+
set -vx
|
|
5
|
+
|
|
6
|
+
bundle install
|
|
7
|
+
|
|
8
|
+
# Do any other automated setup that you need to do here
|
data/examples.rb
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
require "gameball"
|
|
2
|
+
Gameball.api_key = "7c7636658209418c9a82306a421f76a5"
|
|
3
|
+
Gameball.api_version = "v2.0"
|
|
4
|
+
Gameball::transaction_key = "26e1967d89114388bdd1772587c336c8"
|
|
5
|
+
# Events
|
|
6
|
+
# Example 1
|
|
7
|
+
Gameball::Event.send_event({
|
|
8
|
+
events: {
|
|
9
|
+
place_order: {
|
|
10
|
+
total_amount: "100",
|
|
11
|
+
category: [
|
|
12
|
+
"electronics",
|
|
13
|
+
"cosmetics",
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
review: {},
|
|
17
|
+
},
|
|
18
|
+
playerUniqueId: "player123",
|
|
19
|
+
})
|
|
20
|
+
# Example 2
|
|
21
|
+
Gameball::Event.send_event({
|
|
22
|
+
events: {
|
|
23
|
+
reserve: {
|
|
24
|
+
rooms: 2,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
playerUniqueId: " player123",
|
|
28
|
+
playerAttributes: {
|
|
29
|
+
displayName: " Jon Snow",
|
|
30
|
+
email: "jon.snow@example.com",
|
|
31
|
+
dateOfBirth: "1980-09-19T00:00:00.000Z",
|
|
32
|
+
joinDate: "2019-09-19T21:06:29.158Z",
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
# Example 3
|
|
36
|
+
Gameball::Event.send_event({
|
|
37
|
+
events: {
|
|
38
|
+
reserve: {
|
|
39
|
+
rooms: 2,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
playerUniqueId: " player123",
|
|
43
|
+
playerAttributes: {
|
|
44
|
+
displayName: " Jon Snow",
|
|
45
|
+
email: "jon.snow@example.com",
|
|
46
|
+
dateOfBirth: "1980-09-19T00:00:00.000Z",
|
|
47
|
+
joinDate: "2019-09-19T21:06:29.158Z",
|
|
48
|
+
custom: {
|
|
49
|
+
location: "Miami",
|
|
50
|
+
graduationDate: "2018-07-04T21:06:29.158Z",
|
|
51
|
+
isMarried: false,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
# Referrals
|
|
56
|
+
# Example 1
|
|
57
|
+
Gameball::Referral.create_referral({
|
|
58
|
+
playerCode: "CODE11",
|
|
59
|
+
playerUniqueId: "player456",
|
|
60
|
+
})
|
|
61
|
+
# Example 2
|
|
62
|
+
Gameball::Referral.create_referral({
|
|
63
|
+
playerCode: "CODE11",
|
|
64
|
+
playerUniqueId: "player456",
|
|
65
|
+
playerAttributes: {
|
|
66
|
+
displayName: " Tyrion Lannister",
|
|
67
|
+
firstName: "Tyrion",
|
|
68
|
+
lastName: "Lannister",
|
|
69
|
+
email: "tyrion@example.com",
|
|
70
|
+
gender: "M",
|
|
71
|
+
dateOfBirth: "1978-01-11T00:00:00.000Z",
|
|
72
|
+
joinDate: "2019-09-19T21:06:29.158Z",
|
|
73
|
+
custom: {
|
|
74
|
+
location: "Miami",
|
|
75
|
+
graduationDate: "2018-07-04T21:06:29.158Z",
|
|
76
|
+
isMarried: false,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
# Reward
|
|
81
|
+
# Example 1
|
|
82
|
+
Gameball::Transaction.reward_points({
|
|
83
|
+
playerUniqueId: "player123",
|
|
84
|
+
amount: 99.98,
|
|
85
|
+
transactionId: "tra_123456789",
|
|
86
|
+
transactionTime: "2019-09-19T16:14:09.895Z",
|
|
87
|
+
})
|
|
88
|
+
# Example 2
|
|
89
|
+
Gameball::Transaction.reward_points({
|
|
90
|
+
playerUniqueId: "player456",
|
|
91
|
+
amount: 2500,
|
|
92
|
+
transactionId: "tra_123456789",
|
|
93
|
+
playerAttributes: {
|
|
94
|
+
displayName: " Tyrion Lannister",
|
|
95
|
+
firstName: "Tyrion",
|
|
96
|
+
lastName: "Lannister",
|
|
97
|
+
email: "tyrion@example.com",
|
|
98
|
+
gender: "M",
|
|
99
|
+
dateOfBirth: "1978-01-11T00:00:00.000Z",
|
|
100
|
+
joinDate: "2019-09-19T21:06:29.158Z",
|
|
101
|
+
custom: {
|
|
102
|
+
location: "Miami",
|
|
103
|
+
graduationDate: "2018-07-04T21:06:29.158Z",
|
|
104
|
+
isMarried: false,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
transactionTime: "2019-09-19T16:14:09.895Z",
|
|
108
|
+
})
|
|
109
|
+
# Get Player Balance
|
|
110
|
+
Gameball::Transaction.get_player_balance("player456")
|
|
111
|
+
# Hold
|
|
112
|
+
# Example 1
|
|
113
|
+
Gameball::Transaction.hold_points({
|
|
114
|
+
playerUniqueId: "player456",
|
|
115
|
+
amount: 98.89,
|
|
116
|
+
transactionTime: "2019-09-21T16:53:28.190Z",
|
|
117
|
+
})
|
|
118
|
+
# Redeem
|
|
119
|
+
# Example 1
|
|
120
|
+
Gameball::Transaction.redeem_points({
|
|
121
|
+
playerUniqueId: "player456",
|
|
122
|
+
amount: 10,
|
|
123
|
+
transactionId: "tra_123456789",
|
|
124
|
+
holdReference: "2342452352435234",
|
|
125
|
+
transactionTime: "2019-09-19T16:14:09.895Z",
|
|
126
|
+
})
|
|
127
|
+
# Reverse Transaction
|
|
128
|
+
# Example 1
|
|
129
|
+
Gameball::Transaction.reverse_transaction({
|
|
130
|
+
playerUniqueId: "player456",
|
|
131
|
+
transactionId: "1234567890",
|
|
132
|
+
reversedTransactionId: "234567891",
|
|
133
|
+
transactionTime: "2019-09-19T11:14:09.895Z",
|
|
134
|
+
})
|
|
135
|
+
Gameball::Transaction.reverse_hold({
|
|
136
|
+
playerUniqueId: " player456",
|
|
137
|
+
holdReference: "9245fe4a-d402-451c-b9ed-9c1a04247482",
|
|
138
|
+
transactionTime: "2019-09-21T16:53:28.190Z",
|
|
139
|
+
})
|
data/gameball.gemspec
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
require_relative 'lib/gameball/version'
|
|
2
|
-
|
|
3
|
-
Gem::Specification.new do |spec|
|
|
4
|
-
spec.name = "alphaSDK"
|
|
5
|
-
spec.version = Gameball::VERSION
|
|
6
|
-
spec.authors = ["Alsouidan"]
|
|
7
|
-
spec.email = ["alsouidan@gmail.com"]
|
|
8
|
-
|
|
9
|
-
spec.summary = "Ruby gem"
|
|
10
|
-
spec.homepage = "http://mygemserver.com"
|
|
11
|
-
spec.license = "MIT"
|
|
12
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
|
13
|
-
spec.add_dependency 'rake','= 12.0'
|
|
14
|
-
spec.add_dependency 'rspec','= 3.0'
|
|
15
|
-
# spec.metadata["allowed_push_host"] = "https://github.com/Alsouidan/alphasdk"
|
|
16
|
-
|
|
17
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
|
-
spec.metadata["source_code_uri"] = "http://mygemserver.com"
|
|
19
|
-
spec.metadata["changelog_uri"] = "http://mygemserver.com"
|
|
20
|
-
|
|
21
|
-
# Specify which files should be added to the gem when it is released.
|
|
22
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
23
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
24
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
25
|
-
end
|
|
26
|
-
spec.bindir = "exe"
|
|
27
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
28
|
-
spec.require_paths = ["lib"]
|
|
29
|
-
end
|
|
1
|
+
require_relative 'lib/gameball/version'
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |spec|
|
|
4
|
+
spec.name = "alphaSDK"
|
|
5
|
+
spec.version = Gameball::VERSION
|
|
6
|
+
spec.authors = ["Alsouidan"]
|
|
7
|
+
spec.email = ["alsouidan@gmail.com"]
|
|
8
|
+
|
|
9
|
+
spec.summary = "Ruby gem"
|
|
10
|
+
spec.homepage = "http://mygemserver.com"
|
|
11
|
+
spec.license = "MIT"
|
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
|
13
|
+
spec.add_dependency 'rake','= 12.0'
|
|
14
|
+
spec.add_dependency 'rspec','= 3.0'
|
|
15
|
+
# spec.metadata["allowed_push_host"] = "https://github.com/Alsouidan/alphasdk"
|
|
16
|
+
|
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
|
+
spec.metadata["source_code_uri"] = "http://mygemserver.com"
|
|
19
|
+
spec.metadata["changelog_uri"] = "http://mygemserver.com"
|
|
20
|
+
|
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
23
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
25
|
+
end
|
|
26
|
+
spec.bindir = "exe"
|
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
28
|
+
spec.require_paths = ["lib"]
|
|
29
|
+
end
|
data/lib/gameball.rb
CHANGED
|
@@ -5,6 +5,10 @@ require "uri"
|
|
|
5
5
|
require "Time"
|
|
6
6
|
require "digest/sha1"
|
|
7
7
|
require "json"
|
|
8
|
+
<<<<<<< HEAD
|
|
9
|
+
require "async"
|
|
10
|
+
=======
|
|
11
|
+
>>>>>>> aece124df52cb5113b88b74b8e8eb5c68bec89ef
|
|
8
12
|
require_relative "./gameball/utils/request"
|
|
9
13
|
require_relative "./gameball/utils/helper"
|
|
10
14
|
require_relative "./gameball/utils/validation"
|
|
@@ -21,7 +25,11 @@ module Gameball
|
|
|
21
25
|
@max_retries = 1
|
|
22
26
|
@read_timeout = 60
|
|
23
27
|
@keep_alive_timeout = 30
|
|
28
|
+
<<<<<<< HEAD
|
|
24
29
|
@api_version = "v1.0"
|
|
30
|
+
=======
|
|
31
|
+
@api_version = "v2.0"
|
|
32
|
+
>>>>>>> aece124df52cb5113b88b74b8e8eb5c68bec89ef
|
|
25
33
|
class << self
|
|
26
34
|
attr_accessor :api_key
|
|
27
35
|
attr_accessor :api_version
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
module Gameball
|
|
2
2
|
class Action
|
|
3
|
+
<<<<<<< HEAD
|
|
4
|
+
def send_action(body)
|
|
5
|
+
Gameball::Utils.validate(body, ["playerUniqueId"], ["playerAttributes", "events", "pointsTransaction"])
|
|
6
|
+
=======
|
|
3
7
|
def self.send_action(body)
|
|
4
8
|
Gameball::Utils.validate(body, ["playerUniqueId"], ["playerAttributes", "events", "pointsTransaction"])
|
|
9
|
+
if body.has_key? (:pointsTransaction)
|
|
10
|
+
Gameball::Utils.validate(body[:pointsTransaction], ['transactionId'],['rewardAmount','holdReference'])
|
|
11
|
+
body[:pointsTransaction][:transactionTime]=Time.now.utc
|
|
12
|
+
amount=''
|
|
13
|
+
if body[:pointsTransaction].has_key?(:rewardAmount)
|
|
14
|
+
amount=body[:pointsTransaction][:rewardAmount]
|
|
15
|
+
end
|
|
16
|
+
body[:pointsTransaction]['hash']=Gameball::Utils.hashBody(playerUniqueId:body[:playerUniqueId],transactionTime:body[:pointsTransaction][:transactionTime],amount:amount)
|
|
17
|
+
end
|
|
18
|
+
body[:pointsTransaction][:transactionTime]=Time.now.utc.iso8601
|
|
19
|
+
|
|
20
|
+
p body.to_json
|
|
21
|
+
>>>>>>> aece124df52cb5113b88b74b8e8eb5c68bec89ef
|
|
5
22
|
res = Gameball::Utils::request("post", "/Integrations/Action", body)
|
|
6
23
|
unless res.kind_of? Net::HTTPSuccess
|
|
7
24
|
if res.kind_of? Net::HTTPInternalServerError
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
module Gameball
|
|
2
2
|
class Coupon
|
|
3
3
|
def self.create_discount_coupon(body)
|
|
4
|
+
<<<<<<< HEAD
|
|
5
|
+
Gameball::Utils.validate(body, ["playerUniqueId", "transactionTime"], ["startAt", "endsAt", "entitledCollectionIds", "entitledProductIds",
|
|
6
|
+
"oncePerCustomer", "prerequisiteQuantityRange", "prerequisiteShippingPriceRange", "prerequisiteSubtotalRange",
|
|
7
|
+
"prerequisiteCollectionIds", "prerequisiteProductIds", "code", "usageLimit", "value", "valueType", "cap"])
|
|
8
|
+
=======
|
|
4
9
|
Gameball::Utils.validate(body, ["playerUniqueId"], ["startAt", "endsAt", "entitledCollectionIds", "entitledProductIds",
|
|
5
10
|
"oncePerCustomer", "prerequisiteQuantityRange", "prerequisiteShippingPriceRange", "prerequisiteSubtotalRange",
|
|
6
11
|
"prerequisiteCollectionIds", "prerequisiteProductIds", "code", "usageLimit", "value", "valueType", "cap"])
|
|
7
12
|
|
|
8
13
|
body[:transactionTime] = Time.now.utc
|
|
14
|
+
>>>>>>> aece124df52cb5113b88b74b8e8eb5c68bec89ef
|
|
9
15
|
body["hash"] = Gameball::Utils::hashBody(playerUniqueId: body[:playerUniqueId])
|
|
10
16
|
res = Gameball::Utils::request("post", "/Integrations/Coupon", body)
|
|
11
17
|
unless res.kind_of? Net::HTTPSuccess
|
|
@@ -19,9 +25,13 @@ module Gameball
|
|
|
19
25
|
end
|
|
20
26
|
end
|
|
21
27
|
def self.validate_discount_coupon(body)
|
|
28
|
+
<<<<<<< HEAD
|
|
29
|
+
Gameball::Utils.validate(body, ["playerUniqueId", "code", "transactionTime"])
|
|
30
|
+
=======
|
|
22
31
|
Gameball::Utils.validate(body, ["playerUniqueId", "code"])
|
|
23
32
|
body[:transactionTime] = Time.now.utc
|
|
24
33
|
|
|
34
|
+
>>>>>>> aece124df52cb5113b88b74b8e8eb5c68bec89ef
|
|
25
35
|
body["hash"] = Gameball::Utils::hashBody(playerUniqueId: body[:playerUniqueId])
|
|
26
36
|
res = Gameball::Utils::request("post", "/Integrations/Coupon/Validate", body)
|
|
27
37
|
unless res.kind_of? Net::HTTPSuccess
|
|
@@ -35,8 +45,12 @@ module Gameball
|
|
|
35
45
|
end
|
|
36
46
|
end
|
|
37
47
|
def self.redeem_discount_coupon(body)
|
|
48
|
+
<<<<<<< HEAD
|
|
49
|
+
Gameball::Utils.validate(body, ["playerUniqueId", "code", "transactionTime"])
|
|
50
|
+
=======
|
|
38
51
|
Gameball::Utils.validate(body, ["playerUniqueId", "code"])
|
|
39
52
|
body[:transactionTime] = Time.now.utc
|
|
53
|
+
>>>>>>> aece124df52cb5113b88b74b8e8eb5c68bec89ef
|
|
40
54
|
body["hash"] = Gameball::Utils::hashBody(playerUniqueId: body[:playerUniqueId])
|
|
41
55
|
res = Gameball::Utils::request("post", "/Integrations/Coupon/Redeem", body)
|
|
42
56
|
unless res.kind_of? Net::HTTPSuccess
|
|
@@ -24,7 +24,11 @@ module Gameball
|
|
|
24
24
|
end
|
|
25
25
|
def self.get_player_info(playerUniqueId)
|
|
26
26
|
body = { playerUniqueId: playerUniqueId }
|
|
27
|
+
<<<<<<< HEAD
|
|
28
|
+
body["bodyHashed"] = Gameball::Utils::hashBody(playerUniqueId: playerUniqueId)
|
|
29
|
+
=======
|
|
27
30
|
body["hash"] = Gameball::Utils::hashBody(playerUniqueId: playerUniqueId)
|
|
31
|
+
>>>>>>> aece124df52cb5113b88b74b8e8eb5c68bec89ef
|
|
28
32
|
res = Gameball::Utils::request("post", "/integrations/Player/Info", body)
|
|
29
33
|
unless res.kind_of? Net::HTTPSuccess
|
|
30
34
|
if res.kind_of? Net::HTTPInternalServerError
|
|
@@ -4,7 +4,11 @@ module Gameball
|
|
|
4
4
|
def self.get_player_balance(playerId)
|
|
5
5
|
hashedBody = Gameball::Utils::hashBody(playerUniqueId: playerId)
|
|
6
6
|
body = { playerUniqueId: playerId,
|
|
7
|
+
<<<<<<< HEAD
|
|
8
|
+
bodyHashed: hashedBody }
|
|
9
|
+
=======
|
|
7
10
|
hash: hashedBody }
|
|
11
|
+
>>>>>>> aece124df52cb5113b88b74b8e8eb5c68bec89ef
|
|
8
12
|
res = Gameball::Utils::request("post", "/integrations/transaction/balance", body)
|
|
9
13
|
unless res.kind_of? Net::HTTPSuccess
|
|
10
14
|
raise Gameball::GameballError.new(res.body) # use custom message
|
|
@@ -15,9 +19,14 @@ module Gameball
|
|
|
15
19
|
def self.hold_points(body)
|
|
16
20
|
# puts body
|
|
17
21
|
# check if attributes are available
|
|
22
|
+
<<<<<<< HEAD
|
|
23
|
+
Gameball::Utils.validate(body, ["playerUniqueId", "amount", "transactionTime"], ["otp"])
|
|
24
|
+
|
|
25
|
+
=======
|
|
18
26
|
|
|
19
27
|
Gameball::Utils.validate(body, ["playerUniqueId", "amount"], ["otp"])
|
|
20
28
|
body[:transactionTime] = Time.now.utc
|
|
29
|
+
>>>>>>> aece124df52cb5113b88b74b8e8eb5c68bec89ef
|
|
21
30
|
body = Gameball::Utils::extractAttributesToHash(body)
|
|
22
31
|
res = Gameball::Utils::request("post", "/integrations/transaction/hold", body)
|
|
23
32
|
unless res.kind_of? Net::HTTPSuccess
|
|
@@ -32,8 +41,12 @@ module Gameball
|
|
|
32
41
|
end
|
|
33
42
|
def self.redeem_points(body)
|
|
34
43
|
# check if attributes are available
|
|
44
|
+
<<<<<<< HEAD
|
|
45
|
+
Gameball::Utils.validate(body, ["holdReference", "playerUniqueId", "amount", "transactionOnClientSystemId", "transactionTime"], [])
|
|
46
|
+
=======
|
|
35
47
|
Gameball::Utils.validate(body, ["holdReference", "playerUniqueId", "transactionId"], [])
|
|
36
48
|
body[:transactionTime] = Time.now.utc
|
|
49
|
+
>>>>>>> aece124df52cb5113b88b74b8e8eb5c68bec89ef
|
|
37
50
|
body = Gameball::Utils::extractAttributesToHash(body)
|
|
38
51
|
res = Gameball::Utils::request("post", "/integrations/transaction/redeem", body)
|
|
39
52
|
unless res.kind_of? Net::HTTPSuccess
|
|
@@ -47,9 +60,13 @@ module Gameball
|
|
|
47
60
|
end
|
|
48
61
|
end
|
|
49
62
|
def self.reverse_transaction(body)
|
|
63
|
+
<<<<<<< HEAD
|
|
64
|
+
Gameball::Utils.validate(body, ["reversedTransactionOnClientSystemId", "playerUniqueId", "transactionOnClientSystemId", "transactionTime"], [])
|
|
65
|
+
=======
|
|
50
66
|
Gameball::Utils.validate(body, ["reversedTransactionId", "playerUniqueId", "transactionId"], [])
|
|
51
67
|
body[:transactionTime] = Time.now.utc
|
|
52
68
|
|
|
69
|
+
>>>>>>> aece124df52cb5113b88b74b8e8eb5c68bec89ef
|
|
53
70
|
body = Gameball::Utils::extractAttributesToHash(body)
|
|
54
71
|
res = Gameball::Utils::request("post", "/integrations/transaction/cancel", body)
|
|
55
72
|
unless res.kind_of? Net::HTTPSuccess
|
|
@@ -63,9 +80,13 @@ module Gameball
|
|
|
63
80
|
end
|
|
64
81
|
end
|
|
65
82
|
def self.reward_points(body)
|
|
83
|
+
<<<<<<< HEAD
|
|
84
|
+
Gameball::Utils.validate(body, ["playerUniqueId", "amount", "transactionOnClientSystemId", "transactionTime"], ["playerAttributes"])
|
|
85
|
+
=======
|
|
66
86
|
Gameball::Utils.validate(body, ["playerUniqueId", "amount", "transactionId"], ["playerAttributes"])
|
|
67
87
|
body[:transactionTime] = Time.now.utc
|
|
68
88
|
|
|
89
|
+
>>>>>>> aece124df52cb5113b88b74b8e8eb5c68bec89ef
|
|
69
90
|
body = Gameball::Utils::extractAttributesToHash(body)
|
|
70
91
|
res = Gameball::Utils::request("post", "/integrations/transaction/reward", body)
|
|
71
92
|
unless res.kind_of? Net::HTTPSuccess
|
|
@@ -80,8 +101,12 @@ module Gameball
|
|
|
80
101
|
end
|
|
81
102
|
def self.reverse_hold(body)
|
|
82
103
|
# check if holdReference is in body else throw error
|
|
104
|
+
<<<<<<< HEAD
|
|
105
|
+
Gameball::Utils.validate(body, ["holdReference", "playerUniqueId", "transactionTime"], [])
|
|
106
|
+
=======
|
|
83
107
|
Gameball::Utils.validate(body, ["holdReference", "playerUniqueId"], [])
|
|
84
108
|
body[:transactionTime] = Time.now.utc
|
|
109
|
+
>>>>>>> aece124df52cb5113b88b74b8e8eb5c68bec89ef
|
|
85
110
|
|
|
86
111
|
body = Gameball::Utils::extractAttributesToHash(body)
|
|
87
112
|
res = Gameball::Utils::request("post", "/integrations/transaction/hold", body)
|
|
@@ -31,7 +31,11 @@ module Gameball
|
|
|
31
31
|
rescue NoMethodError => exception
|
|
32
32
|
raise Gameball::GameballError.new("Invalid Date Formate, Please use Date and Time objects")
|
|
33
33
|
end
|
|
34
|
+
<<<<<<< HEAD
|
|
35
|
+
body["bodyHashed"] = Gameball::Utils::hashBody(playerUniqueId: playerUniqueId, amount: (amount || ""), transactionTime: (transactionTime || ""))
|
|
36
|
+
=======
|
|
34
37
|
body["hash"] = Gameball::Utils::hashBody(playerUniqueId: playerUniqueId, amount: (amount || ""), transactionTime: (transactionTime || ""))
|
|
38
|
+
>>>>>>> aece124df52cb5113b88b74b8e8eb5c68bec89ef
|
|
35
39
|
body
|
|
36
40
|
end
|
|
37
41
|
end
|