mastercard_p2p 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,153 +27,165 @@
27
27
 
28
28
 
29
29
  require "mastercard/core/model"
30
+ require "mastercard/core/baseobject"
30
31
 
31
32
  module MasterCard
32
- module API
33
- module P2p
34
- class ConsumerGovernmentID < MasterCard::Core::Model::BaseObject
35
- include MasterCard::Core::Model
36
- #
33
+ module API
34
+ module P2p
35
+ class ConsumerGovernmentID < MasterCard::Core::Model::BaseObject
36
+ include MasterCard::Core::Model
37
+ #
37
38
 
38
- @__store = {
39
- 'a1084965-3822-4ff8-bda6-134d4d92ef1d' => OperationConfig.new("/send/v1/partners/{partnerId}/consumers/{consumerId}/government_ids", "query", [], []),
40
- 'a054b04e-9c68-4c33-9b4a-2c8863dac8bc' => OperationConfig.new("/send/v1/partners/{partnerId}/consumers/{consumerId}/government_ids", "create", [], []),
41
- '6f50a437-cea4-4356-b5fe-9ca69a15a16a' => OperationConfig.new("/send/v1/partners/{partnerId}/consumers/{consumerId}/government_ids/{governmentId}", "read", [], []),
42
- 'd80883bb-8151-4036-8ced-9dba84c7f2f8' => OperationConfig.new("/send/v1/partners/{partnerId}/consumers/{consumerId}/government_ids/{governmentId}", "update", [], []),
43
- '7fee36ad-b660-4d0e-84d5-885b5ed07c6f' => OperationConfig.new("/send/v1/partners/{partnerId}/consumers/{consumerId}/government_ids/{governmentId}", "delete", [], []),
44
-
45
- }
39
+ @__store = {
40
+ '1055efc4-6bd6-452c-8ced-75286c70d409' => OperationConfig.new("/send/v1/partners/{partnerId}/consumers/{consumerId}/government_ids", "create", [], []),
41
+ '1b0d922f-ec80-4ed7-857b-dc0f5c1c75b7' => OperationConfig.new("/send/v1/partners/{partnerId}/consumers/{consumerId}/government_ids/{governmentId}", "delete", [], []),
42
+ 'f9d8d117-d933-4176-8adb-8cb3c3a8876a' => OperationConfig.new("/send/v1/partners/{partnerId}/consumers/{consumerId}/government_ids/{governmentId}", "read", [], []),
43
+ '02fcea21-d3bb-4cda-8439-83d7adc0589e' => OperationConfig.new("/send/v1/partners/{partnerId}/consumers/{consumerId}/government_ids", "query", [], []),
44
+ 'a31214a3-8035-4108-9b3b-6e913b11c16a' => OperationConfig.new("/send/v1/partners/{partnerId}/consumers/{consumerId}/government_ids/{governmentId}", "update", [], []),
45
+
46
+ }
46
47
 
47
- protected
48
+ protected
48
49
 
49
- def self.getOperationConfig(uuid)
50
- if @__store.key?(uuid)
51
- return @__store[uuid]
52
- end
53
- raise NotImplementedError.new("Invalid operationUUID supplied:"+ uuid)
54
- end
50
+ def self.getOperationConfig(uuid)
51
+ if @__store.key?(uuid)
52
+ return @__store[uuid]
53
+ end
54
+ raise NotImplementedError.new("Invalid operationUUID supplied:"+ uuid)
55
+ end
55
56
 
56
- def self.getOperationMetadata()
57
- return OperationMetadata.new(SDKConfig.getVersion(), SDKConfig.getHost())
58
- end
57
+ def self.getOperationMetadata()
58
+ return OperationMetadata.new(ResourceConfig.instance.getVersion(), ResourceConfig.instance.getHost(), ResourceConfig.instance.getContext())
59
+ end
59
60
 
60
- public
61
+ public
61
62
 
62
63
 
64
+ def self.create(mapObj)
65
+ #
66
+ #Creates object of type ConsumerGovernmentID
67
+ #
68
+ #@param Dict mapObj, containing the required parameters to create a new object
69
+ #@return [ConsumerGovernmentID] of the response of created instance.
70
+ #@raise [APIException] an exception from the response status
71
+ return self.execute("1055efc4-6bd6-452c-8ced-75286c70d409", ConsumerGovernmentID.new(mapObj))
72
+ end
63
73
 
64
74
 
65
75
 
66
76
 
67
- def self.listAll(criteria)
68
- #
69
- #Query objects of type ConsumerGovernmentID by id and optional criteria
70
- #@param type criteria
71
- #@return ConsumerGovernmentID object representing the response.
72
- #
73
77
 
74
- return self.execute("a1084965-3822-4ff8-bda6-134d4d92ef1d",ConsumerGovernmentID.new(criteria))
75
- end
76
78
 
77
- def self.create(mapObj)
78
- #
79
- #Creates object of type ConsumerGovernmentID
80
- #
81
- #@param Dict mapObj, containing the required parameters to create a new object
82
- #@return ConsumerGovernmentID of the response of created instance.
83
- #
84
- return self.execute("a054b04e-9c68-4c33-9b4a-2c8863dac8bc", ConsumerGovernmentID.new(mapObj))
85
- end
86
79
 
87
80
 
88
81
 
89
82
 
83
+ def self.deleteById(id, map = nil)
84
+ #Delete object of type ConsumerGovernmentID by id
90
85
 
86
+ #@param [String] id
87
+ #@param [Dict] map, containing additional parameters
88
+ #@return [ConsumerGovernmentID] of the response of the deleted instance.
89
+ #@raise [APIException] an exception from the response status
91
90
 
92
91
 
92
+ mapObj = ConsumerGovernmentID.new
93
+ if !(id.nil? || id.to_s.empty?)
94
+ mapObj.set("id", id)
95
+ end
96
+ if !map.nil?
97
+ if map.instance_of? RequestMap
98
+ mapObj.setAll(map.getObject())
99
+ else
100
+ mapObj.setAll(map)
101
+ end
102
+ end
93
103
 
104
+ return self.execute("1b0d922f-ec80-4ed7-857b-dc0f5c1c75b7", mapObj)
105
+ end
94
106
 
95
107
 
96
- def self.read(id, criteria = nil)
97
- #
98
- #Returns objects of type ConsumerGovernmentID by id and optional criteria
99
- #@param str id
100
- #@param dict criteria
101
- #@return instance of ConsumerGovernmentID
108
+ def delete
109
+ #
110
+ #Delete object of type ConsumerGovernmentID
102
111
 
103
- mapObj = ConsumerGovernmentID.new
104
- if !(id.nil? || id.to_s.empty?)
105
- mapObj.set("id", id)
106
- end
107
- if !criteria.nil?
108
- if criteria.instance_of? RequestMap
109
- mapObj.setAll(criteria.getObject())
110
- else
111
- mapObj.setAll(criteria)
112
- end
113
- end
112
+ #@param [String] id
113
+ #@return [ConsumerGovernmentID] of the response of the deleted instance.
114
+ #@raise [APIException] an exception from the response status
115
+ #
114
116
 
115
- return self.execute("6f50a437-cea4-4356-b5fe-9ca69a15a16a",ConsumerGovernmentID.new(mapObj))
116
- end
117
+ return self.class.execute("1b0d922f-ec80-4ed7-857b-dc0f5c1c75b7", self)
118
+ end
117
119
 
118
120
 
119
121
 
120
- def update
121
- #
122
- #Updates an object of type ConsumerGovernmentID
123
- #
124
- #@return ConsumerGovernmentID object representing the response.
125
- #
126
- return self.class.execute("d80883bb-8151-4036-8ced-9dba84c7f2f8",self)
127
- end
128
122
 
129
123
 
130
124
 
131
125
 
132
126
 
127
+ def self.read(id, criteria = nil)
128
+ #
129
+ #Returns objects of type ConsumerGovernmentID by id and optional criteria
130
+ #@param [String] id
131
+ #@param [Dict] criteria
132
+ #@return [ConsumerGovernmentID] object representing the response
133
+ #@raise [APIException] an exception from the response status
133
134
 
135
+ mapObj = ConsumerGovernmentID.new
136
+ if !(id.nil? || id.to_s.empty?)
137
+ mapObj.set("id", id)
138
+ end
139
+ if !criteria.nil?
140
+ if criteria.instance_of? RequestMap
141
+ mapObj.setAll(criteria.getObject())
142
+ else
143
+ mapObj.setAll(criteria)
144
+ end
145
+ end
134
146
 
147
+ return self.execute("f9d8d117-d933-4176-8adb-8cb3c3a8876a",ConsumerGovernmentID.new(mapObj))
148
+ end
135
149
 
136
150
 
137
- def self.deleteById(id, map = nil)
138
- #Delete object of type ConsumerGovernmentID by id
139
151
 
140
- #@param str id
141
- #@param Dict map, containing additional parameters
142
- #@return ConsumerGovernmentID of the response of the deleted instance.
143
152
 
144
153
 
145
- mapObj = ConsumerGovernmentID.new
146
- if !(id.nil? || id.to_s.empty?)
147
- mapObj.set("id", id)
148
- end
149
- if !map.nil?
150
- if map.instance_of? RequestMap
151
- mapObj.setAll(map.getObject())
152
- else
153
- mapObj.setAll(map)
154
- end
155
- end
156
154
 
157
- return self.execute("7fee36ad-b660-4d0e-84d5-885b5ed07c6f", mapObj)
158
- end
159
155
 
160
156
 
161
- def delete
162
- #
163
- #Delete object of type ConsumerGovernmentID
157
+ def self.listAll(criteria)
158
+ #
159
+ #Query objects of type ConsumerGovernmentID by id and optional criteria
160
+ #@param [Dict] criteria
161
+ #@return [ConsumerGovernmentID] object representing the response.
162
+ #@raise [APIException] an exception from the response status
163
+ #
164
164
 
165
- #@param str id
166
- #@return ConsumerGovernmentID of the response of the deleted instance.
167
- #
165
+ return self.execute("02fcea21-d3bb-4cda-8439-83d7adc0589e",ConsumerGovernmentID.new(criteria))
166
+ end
168
167
 
169
- return self.class.execute("7fee36ad-b660-4d0e-84d5-885b5ed07c6f", self)
170
- end
171
168
 
172
169
 
170
+ def update
171
+ #
172
+ #Updates an object of type ConsumerGovernmentID
173
+ #
174
+ #@return [ConsumerGovernmentID] object representing the response.
175
+ #@raise [APIException] an exception from the response status
176
+ #
177
+ return self.class.execute("a31214a3-8035-4108-9b3b-6e913b11c16a",self)
178
+ end
173
179
 
174
- end
175
- end
176
- end
180
+
181
+
182
+
183
+
184
+
185
+
186
+ end
187
+ end
188
+ end
177
189
  end
178
190
 
179
191
 
@@ -27,96 +27,103 @@
27
27
 
28
28
 
29
29
  require "mastercard/core/model"
30
+ require "mastercard/core/baseobject"
30
31
 
31
32
  module MasterCard
32
- module API
33
- module P2p
34
- class PaymentTransfer < MasterCard::Core::Model::BaseObject
35
- include MasterCard::Core::Model
36
- #
33
+ module API
34
+ module P2p
35
+ class PaymentTransfer < MasterCard::Core::Model::BaseObject
36
+ include MasterCard::Core::Model
37
+ #
37
38
 
38
- @__store = {
39
- 'ef527a93-05a8-424c-a515-d71923463c86' => OperationConfig.new("/send/v1/partners/{partnerId}/transfers", "query", [], ["ref"]),
40
- 'a478f31c-b345-46a9-89d0-fb62e2410bfe' => OperationConfig.new("/send/v1/partners/{partnerId}/transfers/payment", "create", [], []),
41
- 'f29279cd-348f-4234-8e84-63b85be78631' => OperationConfig.new("/send/v1/partners/{partnerId}/transfers/{transferId}", "read", [], []),
42
-
43
- }
39
+ @__store = {
40
+ 'd5f2ea17-e2f7-413a-9161-65980a8d6c2c' => OperationConfig.new("/send/v1/partners/{partnerId}/transfers/payment", "create", [], []),
41
+ '849c0215-a9c0-474b-9265-d853c6b425a2' => OperationConfig.new("/send/v1/partners/{partnerId}/transfers/{transferId}", "read", [], []),
42
+ '5fcef3bb-170a-4aaa-af4a-928a9ce857e6' => OperationConfig.new("/send/v1/partners/{partnerId}/transfers", "query", [], ["ref"]),
43
+
44
+ }
44
45
 
45
- protected
46
+ protected
46
47
 
47
- def self.getOperationConfig(uuid)
48
- if @__store.key?(uuid)
49
- return @__store[uuid]
50
- end
51
- raise NotImplementedError.new("Invalid operationUUID supplied:"+ uuid)
52
- end
48
+ def self.getOperationConfig(uuid)
49
+ if @__store.key?(uuid)
50
+ return @__store[uuid]
51
+ end
52
+ raise NotImplementedError.new("Invalid operationUUID supplied:"+ uuid)
53
+ end
53
54
 
54
- def self.getOperationMetadata()
55
- return OperationMetadata.new(SDKConfig.getVersion(), SDKConfig.getHost())
56
- end
55
+ def self.getOperationMetadata()
56
+ return OperationMetadata.new(ResourceConfig.instance.getVersion(), ResourceConfig.instance.getHost(), ResourceConfig.instance.getContext())
57
+ end
57
58
 
58
- public
59
+ public
59
60
 
60
61
 
62
+ def self.create(mapObj)
63
+ #
64
+ #Creates object of type PaymentTransfer
65
+ #
66
+ #@param Dict mapObj, containing the required parameters to create a new object
67
+ #@return [PaymentTransfer] of the response of created instance.
68
+ #@raise [APIException] an exception from the response status
69
+ return self.execute("d5f2ea17-e2f7-413a-9161-65980a8d6c2c", PaymentTransfer.new(mapObj))
70
+ end
61
71
 
62
72
 
63
73
 
64
74
 
65
- def self.readByReference(criteria)
66
- #
67
- #Query objects of type PaymentTransfer by id and optional criteria
68
- #@param type criteria
69
- #@return PaymentTransfer object representing the response.
70
- #
71
75
 
72
- return self.execute("ef527a93-05a8-424c-a515-d71923463c86",PaymentTransfer.new(criteria))
73
- end
74
76
 
75
- def self.create(mapObj)
76
- #
77
- #Creates object of type PaymentTransfer
78
- #
79
- #@param Dict mapObj, containing the required parameters to create a new object
80
- #@return PaymentTransfer of the response of created instance.
81
- #
82
- return self.execute("a478f31c-b345-46a9-89d0-fb62e2410bfe", PaymentTransfer.new(mapObj))
83
- end
84
77
 
85
78
 
86
79
 
87
80
 
88
81
 
82
+ def self.readByID(id, criteria = nil)
83
+ #
84
+ #Returns objects of type PaymentTransfer by id and optional criteria
85
+ #@param [String] id
86
+ #@param [Dict] criteria
87
+ #@return [PaymentTransfer] object representing the response
88
+ #@raise [APIException] an exception from the response status
89
89
 
90
+ mapObj = PaymentTransfer.new
91
+ if !(id.nil? || id.to_s.empty?)
92
+ mapObj.set("id", id)
93
+ end
94
+ if !criteria.nil?
95
+ if criteria.instance_of? RequestMap
96
+ mapObj.setAll(criteria.getObject())
97
+ else
98
+ mapObj.setAll(criteria)
99
+ end
100
+ end
90
101
 
102
+ return self.execute("849c0215-a9c0-474b-9265-d853c6b425a2",PaymentTransfer.new(mapObj))
103
+ end
91
104
 
92
105
 
93
106
 
94
- def self.readByID(id, criteria = nil)
95
- #
96
- #Returns objects of type PaymentTransfer by id and optional criteria
97
- #@param str id
98
- #@param dict criteria
99
- #@return instance of PaymentTransfer
100
107
 
101
- mapObj = PaymentTransfer.new
102
- if !(id.nil? || id.to_s.empty?)
103
- mapObj.set("id", id)
104
- end
105
- if !criteria.nil?
106
- if criteria.instance_of? RequestMap
107
- mapObj.setAll(criteria.getObject())
108
- else
109
- mapObj.setAll(criteria)
110
- end
111
- end
112
108
 
113
- return self.execute("f29279cd-348f-4234-8e84-63b85be78631",PaymentTransfer.new(mapObj))
114
- end
115
109
 
116
110
 
117
- end
118
- end
119
- end
111
+
112
+ def self.readByReference(criteria)
113
+ #
114
+ #Query objects of type PaymentTransfer by id and optional criteria
115
+ #@param [Dict] criteria
116
+ #@return [PaymentTransfer] object representing the response.
117
+ #@raise [APIException] an exception from the response status
118
+ #
119
+
120
+ return self.execute("5fcef3bb-170a-4aaa-af4a-928a9ce857e6",PaymentTransfer.new(criteria))
121
+ end
122
+
123
+
124
+ end
125
+ end
126
+ end
120
127
  end
121
128
 
122
129
 
@@ -24,27 +24,75 @@
24
24
  # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
25
  # SUCH DAMAGE.
26
26
  #
27
+
28
+ require "mastercard/core/constants"
29
+ require "mastercard/core/config"
30
+
27
31
  module MasterCard
28
- module API
29
- module P2p
30
- class SDKConfig
31
-
32
- private
33
- @@host = nil
34
-
35
- public
36
- def self.setHost(host)
37
- @@host = host
38
- end
39
-
40
- def self.getHost()
41
- return @@host
42
- end
43
-
44
- def self.getVersion()
45
- return "1.0.1"
46
- end
47
- end
48
- end
49
- end
32
+ module API
33
+ module P2p
34
+ class ResourceConfig
35
+ include MasterCard::Core
36
+
37
+ @@instance = nil
38
+
39
+ def initialize
40
+ @name = "p2p"
41
+ @override = nil
42
+ @host = nil
43
+ @context = nil
44
+ @version = "1.0.2"
45
+
46
+ Config.registerResourceConfig(self)
47
+ currentEnvironment = Config.getEnvironment()
48
+ self.setEnvironment(currentEnvironment)
49
+
50
+ end
51
+
52
+
53
+ def self.instance
54
+ return @@instance
55
+ end
56
+
57
+
58
+ def getName
59
+ return @name
60
+ end
61
+
62
+
63
+ def getHost
64
+ unless @override.nil? || @override == 0
65
+ return @override
66
+ else
67
+ return @host
68
+ end
69
+ end
70
+
71
+ def getContext
72
+ return @context
73
+ end
74
+
75
+ def getVersion
76
+ return @version
77
+ end
78
+
79
+ def setEnvironment(environmet)
80
+ if Environment::MAPPING.key?(environmet)
81
+ tuple = Environment::MAPPING[environmet]
82
+ @host = tuple[0]
83
+ @context = tuple[1]
84
+ end
85
+ end
86
+
87
+ def setCustomEnvironment(host,context)
88
+ @host = host
89
+ @context = context
90
+ end
91
+
92
+ @@instance = ResourceConfig.new
93
+
94
+ private_class_method :new
95
+ end
96
+ end
97
+ end
50
98
  end