mastercard_masterpass_merchant 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +24 -0
  3. data/README.md +74 -0
  4. data/lib/mastercard_masterpass_merchant.rb +182 -0
  5. data/lib/mastercard_masterpass_merchant/api/checkout_api.rb +41 -0
  6. data/lib/mastercard_masterpass_merchant/api/decryption_api.rb +40 -0
  7. data/lib/mastercard_masterpass_merchant/api/express_checkout_api.rb +42 -0
  8. data/lib/mastercard_masterpass_merchant/api/merchant_initialization_api.rb +40 -0
  9. data/lib/mastercard_masterpass_merchant/api/postback_api.rb +39 -0
  10. data/lib/mastercard_masterpass_merchant/api/precheckout_data_api.rb +42 -0
  11. data/lib/mastercard_masterpass_merchant/api/session_key_signing_api.rb +40 -0
  12. data/lib/mastercard_masterpass_merchant/api/shopping_cart_api.rb +40 -0
  13. data/lib/mastercard_masterpass_merchant/models/acceptance_option.rb +177 -0
  14. data/lib/mastercard_masterpass_merchant/models/address.rb +243 -0
  15. data/lib/mastercard_masterpass_merchant/models/address_extension_point.rb +176 -0
  16. data/lib/mastercard_masterpass_merchant/models/authentication_options.rb +265 -0
  17. data/lib/mastercard_masterpass_merchant/models/base_card.rb +221 -0
  18. data/lib/mastercard_masterpass_merchant/models/brands.rb +165 -0
  19. data/lib/mastercard_masterpass_merchant/models/card.rb +244 -0
  20. data/lib/mastercard_masterpass_merchant/models/card_extension.rb +189 -0
  21. data/lib/mastercard_masterpass_merchant/models/card_type.rb +174 -0
  22. data/lib/mastercard_masterpass_merchant/models/card_types.rb +166 -0
  23. data/lib/mastercard_masterpass_merchant/models/checkout.rb +259 -0
  24. data/lib/mastercard_masterpass_merchant/models/checkout_dsrp.rb +210 -0
  25. data/lib/mastercard_masterpass_merchant/models/checkout_extension.rb +259 -0
  26. data/lib/mastercard_masterpass_merchant/models/contact.rb +275 -0
  27. data/lib/mastercard_masterpass_merchant/models/date_of_birth.rb +199 -0
  28. data/lib/mastercard_masterpass_merchant/models/decryption_request.rb +199 -0
  29. data/lib/mastercard_masterpass_merchant/models/decryption_response.rb +165 -0
  30. data/lib/mastercard_masterpass_merchant/models/detail.rb +176 -0
  31. data/lib/mastercard_masterpass_merchant/models/details.rb +176 -0
  32. data/lib/mastercard_masterpass_merchant/models/dsrp.rb +199 -0
  33. data/lib/mastercard_masterpass_merchant/models/dsrp_extension.rb +189 -0
  34. data/lib/mastercard_masterpass_merchant/models/dsrp_options.rb +188 -0
  35. data/lib/mastercard_masterpass_merchant/models/error.rb +222 -0
  36. data/lib/mastercard_masterpass_merchant/models/errors.rb +174 -0
  37. data/lib/mastercard_masterpass_merchant/models/express_checkout_request.rb +276 -0
  38. data/lib/mastercard_masterpass_merchant/models/express_checkout_response.rb +201 -0
  39. data/lib/mastercard_masterpass_merchant/models/extension_point.rb +163 -0
  40. data/lib/mastercard_masterpass_merchant/models/installment.rb +221 -0
  41. data/lib/mastercard_masterpass_merchant/models/installment_option.rb +198 -0
  42. data/lib/mastercard_masterpass_merchant/models/installment_options.rb +166 -0
  43. data/lib/mastercard_masterpass_merchant/models/installments.rb +176 -0
  44. data/lib/mastercard_masterpass_merchant/models/issuers.rb +165 -0
  45. data/lib/mastercard_masterpass_merchant/models/merchant_initialization_extension.rb +201 -0
  46. data/lib/mastercard_masterpass_merchant/models/merchant_initialization_request.rb +199 -0
  47. data/lib/mastercard_masterpass_merchant/models/merchant_initialization_response.rb +177 -0
  48. data/lib/mastercard_masterpass_merchant/models/merchant_initialization_response_extension.rb +165 -0
  49. data/lib/mastercard_masterpass_merchant/models/merchant_transaction.rb +274 -0
  50. data/lib/mastercard_masterpass_merchant/models/merchant_transactions.rb +176 -0
  51. data/lib/mastercard_masterpass_merchant/models/option.rb +197 -0
  52. data/lib/mastercard_masterpass_merchant/models/pairing_data_type.rb +186 -0
  53. data/lib/mastercard_masterpass_merchant/models/pairing_data_types.rb +188 -0
  54. data/lib/mastercard_masterpass_merchant/models/payment_acceptance.rb +166 -0
  55. data/lib/mastercard_masterpass_merchant/models/payment_acceptance_types_extension.rb +166 -0
  56. data/lib/mastercard_masterpass_merchant/models/payment_options_extensions.rb +178 -0
  57. data/lib/mastercard_masterpass_merchant/models/precheckout_card.rb +288 -0
  58. data/lib/mastercard_masterpass_merchant/models/precheckout_cards.rb +188 -0
  59. data/lib/mastercard_masterpass_merchant/models/precheckout_data.rb +259 -0
  60. data/lib/mastercard_masterpass_merchant/models/precheckout_data_request.rb +178 -0
  61. data/lib/mastercard_masterpass_merchant/models/precheckout_data_response.rb +211 -0
  62. data/lib/mastercard_masterpass_merchant/models/precheckout_reward_program.rb +243 -0
  63. data/lib/mastercard_masterpass_merchant/models/precheckout_shipping_address.rb +298 -0
  64. data/lib/mastercard_masterpass_merchant/models/precheckout_shipping_addresses.rb +188 -0
  65. data/lib/mastercard_masterpass_merchant/models/private_data.rb +177 -0
  66. data/lib/mastercard_masterpass_merchant/models/private_datas.rb +166 -0
  67. data/lib/mastercard_masterpass_merchant/models/reward_program.rb +221 -0
  68. data/lib/mastercard_masterpass_merchant/models/reward_programs.rb +188 -0
  69. data/lib/mastercard_masterpass_merchant/models/risk_decisioning.rb +178 -0
  70. data/lib/mastercard_masterpass_merchant/models/session_key_signing_request.rb +199 -0
  71. data/lib/mastercard_masterpass_merchant/models/session_key_signing_response.rb +210 -0
  72. data/lib/mastercard_masterpass_merchant/models/shipping_address.rb +265 -0
  73. data/lib/mastercard_masterpass_merchant/models/shopping_cart.rb +210 -0
  74. data/lib/mastercard_masterpass_merchant/models/shopping_cart_item.rb +210 -0
  75. data/lib/mastercard_masterpass_merchant/models/shopping_cart_request.rb +189 -0
  76. data/lib/mastercard_masterpass_merchant/models/shopping_cart_request_extension_point.rb +165 -0
  77. data/lib/mastercard_masterpass_merchant/models/shopping_cart_response.rb +177 -0
  78. data/lib/mastercard_masterpass_merchant/models/tokenization.rb +188 -0
  79. data/lib/mastercard_masterpass_merchant/models/types.rb +174 -0
  80. data/lib/mastercard_masterpass_merchant/models/wallet.rb +177 -0
  81. data/lib/mastercard_masterpass_merchant/tracker/sdk_api_tracker.rb +57 -0
  82. data/lib/mastercard_masterpass_merchant/version.rb +3 -0
  83. metadata +240 -0
@@ -0,0 +1,166 @@
1
+ require 'date'
2
+ require 'roxml'
3
+ require_relative '../../mastercard_masterpass_merchant/models/installment_option'
4
+
5
+
6
+ module MastercardMasterpassMerchant
7
+ # This class contains methods regarding installment options.
8
+ class InstallmentOptions
9
+ include ROXML
10
+
11
+ xml_name "InstallmentOptions"
12
+
13
+ # @!attribute installment_option
14
+ # @return [InstallmentOption] the installment option.
15
+ xml_accessor :installment_option, :from =>"InstallmentOption",:as => InstallmentOption
16
+
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :installment_option => :InstallmentOption
22
+
23
+ }
24
+ end
25
+
26
+ def initialize(attributes = {})
27
+ return unless attributes.is_a?(Hash)
28
+
29
+ # convert string to symbol for hash key
30
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
31
+
32
+
33
+ if attributes.has_key?(:InstallmentOption) || attributes.has_key?(:installment_option)
34
+ self.installment_option = attributes[:InstallmentOption] || attributes[:installment_option]
35
+ end
36
+
37
+ end
38
+
39
+
40
+
41
+
42
+ # Check equality by comparing each attribute.
43
+ def ==(o)
44
+ return true if self.equal?(o)
45
+ self.class == o.class &&
46
+ installment_option == o.installment_option
47
+ end
48
+
49
+ # @see the `==` method
50
+ def eql?(o)
51
+ self == o
52
+ end
53
+
54
+ # Calculate hash code according to all attributes.
55
+ def hash
56
+ [installment_option].hash
57
+ end
58
+
59
+ # build the object from hash
60
+ def build_from_hash(attributes)
61
+ return nil unless attributes.is_a?(Hash)
62
+ self.class.datatype_map.each_pair do |key, type|
63
+ if type =~ /^Array<(.*)>/i
64
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
65
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
66
+ else
67
+ #TODO show warning in debug mode
68
+ end
69
+ elsif !attributes[self.class.attribute_map[key]].nil?
70
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
71
+ else
72
+ # data not found in attributes(hash), not an issue as the data can be optional
73
+ end
74
+ end
75
+
76
+ self
77
+ end
78
+
79
+ def _deserialize(type, value)
80
+ case type.to_sym
81
+ when :DateTime
82
+ DateTime.parse(value)
83
+ when :Date
84
+ Date.parse(value)
85
+ when :String
86
+ value.to_s
87
+ when :Integer
88
+ value.to_i
89
+ when :Float
90
+ value.to_f
91
+ when :BOOLEAN
92
+ if value =~ /^(true|t|yes|y|1)$/i
93
+ true
94
+ else
95
+ false
96
+ end
97
+ when /\AArray<(?<inner_type>.+)>\z/
98
+ inner_type = Regexp.last_match[:inner_type]
99
+ value.map { |v| _deserialize(inner_type, v) }
100
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
101
+ k_type = Regexp.last_match[:k_type]
102
+ v_type = Regexp.last_match[:v_type]
103
+ {}.tap do |hash|
104
+ value.each do |k, v|
105
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
106
+ end
107
+ end
108
+ else # model
109
+ _model = MastercardMasterpassMerchant.const_get(type).new
110
+ _model.build_from_hash(value)
111
+ end
112
+ end
113
+
114
+ def to_s
115
+ to_hash.to_s
116
+ end
117
+
118
+ # to_body is an alias to to_body (backward compatibility))
119
+ def to_body
120
+ to_hash
121
+ end
122
+
123
+ # return the object in the form of hash
124
+ def to_hash
125
+ hash = {}
126
+ self.class.attribute_map.each_pair do |attr, param|
127
+ value = self.send(attr)
128
+ next if value.nil?
129
+ hash[param] = _to_hash(value)
130
+ end
131
+ hash
132
+ end
133
+
134
+ # Method to output non-array value in the form of hash
135
+ # For object, use to_hash. Otherwise, just return the value
136
+ def _to_hash(value)
137
+ if value.is_a?(Array)
138
+ value.compact.map{ |v| _to_hash(v) }
139
+ elsif value.is_a?(Hash)
140
+ {}.tap do |hash|
141
+ value.each { |k, v| hash[k] = _to_hash(v) }
142
+ end
143
+ elsif value.respond_to? :to_hash
144
+ value.to_hash
145
+ else
146
+ value
147
+ end
148
+ end
149
+
150
+
151
+ private
152
+ def after_parse
153
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
154
+ end
155
+
156
+ # Attribute datatype mapping.
157
+ def self.datatype_map
158
+ {
159
+ :installment_option => 'InstallmentOption'
160
+
161
+ }
162
+ end
163
+ end
164
+
165
+
166
+ end
@@ -0,0 +1,176 @@
1
+ require 'date'
2
+ require 'roxml'
3
+ require_relative '../../mastercard_masterpass_merchant/models/installment'
4
+
5
+
6
+ module MastercardMasterpassMerchant
7
+ # This class contains methods for payment installment options.
8
+ class Installments
9
+ include ROXML
10
+
11
+ xml_name "Installments"
12
+
13
+ # @!attribute installment
14
+ # @return [Array<Installment>] the acceptance options.
15
+ xml_accessor :installment, :from =>"Installment", :as =>[Installment]
16
+
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :installment => :Installment
22
+
23
+ }
24
+ end
25
+
26
+ def initialize(attributes = {})
27
+ return unless attributes.is_a?(Hash)
28
+
29
+ # convert string to symbol for hash key
30
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
31
+
32
+
33
+ if attributes.has_key?(:Installment) || attributes.has_key?(:installment)
34
+ self.installment = attributes[:Installment] || attributes[:installment]
35
+ end
36
+
37
+ end
38
+
39
+
40
+ # Overriding setter method installment
41
+ # @param value
42
+ def installment=(value)
43
+ if (value.is_a?(Array))
44
+ @installment = value
45
+ else
46
+ @installment = [] if !@installment
47
+ @installment.push value
48
+ end
49
+ end
50
+
51
+
52
+ # Check equality by comparing each attribute.
53
+ def ==(o)
54
+ return true if self.equal?(o)
55
+ self.class == o.class &&
56
+ installment == o.installment
57
+ end
58
+
59
+ # @see the `==` method
60
+ def eql?(o)
61
+ self == o
62
+ end
63
+
64
+ # Calculate hash code according to all attributes.
65
+ def hash
66
+ [installment].hash
67
+ end
68
+
69
+ # build the object from hash
70
+ def build_from_hash(attributes)
71
+ return nil unless attributes.is_a?(Hash)
72
+ self.class.datatype_map.each_pair do |key, type|
73
+ if type =~ /^Array<(.*)>/i
74
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
75
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
76
+ else
77
+ #TODO show warning in debug mode
78
+ end
79
+ elsif !attributes[self.class.attribute_map[key]].nil?
80
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
81
+ else
82
+ # data not found in attributes(hash), not an issue as the data can be optional
83
+ end
84
+ end
85
+
86
+ self
87
+ end
88
+
89
+ def _deserialize(type, value)
90
+ case type.to_sym
91
+ when :DateTime
92
+ DateTime.parse(value)
93
+ when :Date
94
+ Date.parse(value)
95
+ when :String
96
+ value.to_s
97
+ when :Integer
98
+ value.to_i
99
+ when :Float
100
+ value.to_f
101
+ when :BOOLEAN
102
+ if value =~ /^(true|t|yes|y|1)$/i
103
+ true
104
+ else
105
+ false
106
+ end
107
+ when /\AArray<(?<inner_type>.+)>\z/
108
+ inner_type = Regexp.last_match[:inner_type]
109
+ value.map { |v| _deserialize(inner_type, v) }
110
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
111
+ k_type = Regexp.last_match[:k_type]
112
+ v_type = Regexp.last_match[:v_type]
113
+ {}.tap do |hash|
114
+ value.each do |k, v|
115
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
116
+ end
117
+ end
118
+ else # model
119
+ _model = MastercardMasterpassMerchant.const_get(type).new
120
+ _model.build_from_hash(value)
121
+ end
122
+ end
123
+
124
+ def to_s
125
+ to_hash.to_s
126
+ end
127
+
128
+ # to_body is an alias to to_body (backward compatibility))
129
+ def to_body
130
+ to_hash
131
+ end
132
+
133
+ # return the object in the form of hash
134
+ def to_hash
135
+ hash = {}
136
+ self.class.attribute_map.each_pair do |attr, param|
137
+ value = self.send(attr)
138
+ next if value.nil?
139
+ hash[param] = _to_hash(value)
140
+ end
141
+ hash
142
+ end
143
+
144
+ # Method to output non-array value in the form of hash
145
+ # For object, use to_hash. Otherwise, just return the value
146
+ def _to_hash(value)
147
+ if value.is_a?(Array)
148
+ value.compact.map{ |v| _to_hash(v) }
149
+ elsif value.is_a?(Hash)
150
+ {}.tap do |hash|
151
+ value.each { |k, v| hash[k] = _to_hash(v) }
152
+ end
153
+ elsif value.respond_to? :to_hash
154
+ value.to_hash
155
+ else
156
+ value
157
+ end
158
+ end
159
+
160
+
161
+ private
162
+ def after_parse
163
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
164
+ end
165
+
166
+ # Attribute datatype mapping.
167
+ def self.datatype_map
168
+ {
169
+ :installment => 'Array<Installment>'
170
+
171
+ }
172
+ end
173
+ end
174
+
175
+
176
+ end
@@ -0,0 +1,165 @@
1
+ require 'date'
2
+ require 'roxml'
3
+
4
+
5
+ module MastercardMasterpassMerchant
6
+ # This class contains methods regarding issuers information.
7
+ class Issuers
8
+ include ROXML
9
+
10
+ xml_name "Issuers"
11
+
12
+ # @!attribute issuer
13
+ # @return [String] the issuer detail.
14
+ xml_accessor :issuer, :from =>"Issuer"
15
+
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :issuer => :Issuer
21
+
22
+ }
23
+ end
24
+
25
+ def initialize(attributes = {})
26
+ return unless attributes.is_a?(Hash)
27
+
28
+ # convert string to symbol for hash key
29
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
30
+
31
+
32
+ if attributes.has_key?(:Issuer) || attributes.has_key?(:issuer)
33
+ self.issuer = attributes[:Issuer] || attributes[:issuer]
34
+ end
35
+
36
+ end
37
+
38
+
39
+
40
+
41
+ # Check equality by comparing each attribute.
42
+ def ==(o)
43
+ return true if self.equal?(o)
44
+ self.class == o.class &&
45
+ issuer == o.issuer
46
+ end
47
+
48
+ # @see the `==` method
49
+ def eql?(o)
50
+ self == o
51
+ end
52
+
53
+ # Calculate hash code according to all attributes.
54
+ def hash
55
+ [issuer].hash
56
+ end
57
+
58
+ # build the object from hash
59
+ def build_from_hash(attributes)
60
+ return nil unless attributes.is_a?(Hash)
61
+ self.class.datatype_map.each_pair do |key, type|
62
+ if type =~ /^Array<(.*)>/i
63
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
64
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
65
+ else
66
+ #TODO show warning in debug mode
67
+ end
68
+ elsif !attributes[self.class.attribute_map[key]].nil?
69
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
70
+ else
71
+ # data not found in attributes(hash), not an issue as the data can be optional
72
+ end
73
+ end
74
+
75
+ self
76
+ end
77
+
78
+ def _deserialize(type, value)
79
+ case type.to_sym
80
+ when :DateTime
81
+ DateTime.parse(value)
82
+ when :Date
83
+ Date.parse(value)
84
+ when :String
85
+ value.to_s
86
+ when :Integer
87
+ value.to_i
88
+ when :Float
89
+ value.to_f
90
+ when :BOOLEAN
91
+ if value =~ /^(true|t|yes|y|1)$/i
92
+ true
93
+ else
94
+ false
95
+ end
96
+ when /\AArray<(?<inner_type>.+)>\z/
97
+ inner_type = Regexp.last_match[:inner_type]
98
+ value.map { |v| _deserialize(inner_type, v) }
99
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
100
+ k_type = Regexp.last_match[:k_type]
101
+ v_type = Regexp.last_match[:v_type]
102
+ {}.tap do |hash|
103
+ value.each do |k, v|
104
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
105
+ end
106
+ end
107
+ else # model
108
+ _model = MastercardMasterpassMerchant.const_get(type).new
109
+ _model.build_from_hash(value)
110
+ end
111
+ end
112
+
113
+ def to_s
114
+ to_hash.to_s
115
+ end
116
+
117
+ # to_body is an alias to to_body (backward compatibility))
118
+ def to_body
119
+ to_hash
120
+ end
121
+
122
+ # return the object in the form of hash
123
+ def to_hash
124
+ hash = {}
125
+ self.class.attribute_map.each_pair do |attr, param|
126
+ value = self.send(attr)
127
+ next if value.nil?
128
+ hash[param] = _to_hash(value)
129
+ end
130
+ hash
131
+ end
132
+
133
+ # Method to output non-array value in the form of hash
134
+ # For object, use to_hash. Otherwise, just return the value
135
+ def _to_hash(value)
136
+ if value.is_a?(Array)
137
+ value.compact.map{ |v| _to_hash(v) }
138
+ elsif value.is_a?(Hash)
139
+ {}.tap do |hash|
140
+ value.each { |k, v| hash[k] = _to_hash(v) }
141
+ end
142
+ elsif value.respond_to? :to_hash
143
+ value.to_hash
144
+ else
145
+ value
146
+ end
147
+ end
148
+
149
+
150
+ private
151
+ def after_parse
152
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
153
+ end
154
+
155
+ # Attribute datatype mapping.
156
+ def self.datatype_map
157
+ {
158
+ :issuer => 'String'
159
+
160
+ }
161
+ end
162
+ end
163
+
164
+
165
+ end