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/acceptance_option'
4
+
5
+
6
+ module MastercardMasterpassMerchant
7
+ # This class contains methods to set payment acceptance options.
8
+ class PaymentAcceptance
9
+ include ROXML
10
+
11
+ xml_name "PaymentAcceptance"
12
+
13
+ # @!attribute acceptance_option
14
+ # @return [AcceptanceOption] the acceptance option.
15
+ xml_accessor :acceptance_option, :from =>"AcceptanceOption",:as => AcceptanceOption
16
+
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :acceptance_option => :AcceptanceOption
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?(:AcceptanceOption) || attributes.has_key?(:acceptance_option)
34
+ self.acceptance_option = attributes[:AcceptanceOption] || attributes[:acceptance_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
+ acceptance_option == o.acceptance_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
+ [acceptance_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
+ :acceptance_option => 'AcceptanceOption'
160
+
161
+ }
162
+ end
163
+ end
164
+
165
+
166
+ end
@@ -0,0 +1,166 @@
1
+ require 'date'
2
+ require 'roxml'
3
+ require_relative '../../mastercard_masterpass_merchant/models/card_types'
4
+
5
+
6
+ module MastercardMasterpassMerchant
7
+ # This class contains types of payment extension.
8
+ class PaymentAcceptanceTypesExtension
9
+ include ROXML
10
+
11
+ xml_name "PaymentAcceptanceTypesExtension"
12
+
13
+ # @!attribute card_types
14
+ # @return [CardTypes] the card types for payment.
15
+ xml_accessor :card_types, :from =>"CardTypes",:as => CardTypes
16
+
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :card_types => :CardTypes
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?(:CardTypes) || attributes.has_key?(:card_types)
34
+ self.card_types = attributes[:CardTypes] || attributes[:card_types]
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
+ card_types == o.card_types
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
+ [card_types].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
+ :card_types => 'CardTypes'
160
+
161
+ }
162
+ end
163
+ end
164
+
165
+
166
+ end
@@ -0,0 +1,178 @@
1
+ require 'date'
2
+ require 'roxml'
3
+ require_relative '../../mastercard_masterpass_merchant/models/installments'
4
+ require_relative '../../mastercard_masterpass_merchant/models/payment_acceptance'
5
+
6
+
7
+ module MastercardMasterpassMerchant
8
+ # This class contains methods to set extensions such as installments, payment acceptance.
9
+ class PaymentOptionsExtensions
10
+ include ROXML
11
+
12
+ xml_name "PaymentOptionsExtensions"
13
+
14
+ # @!attribute installments
15
+ # @return [Installments] the installments.
16
+ xml_accessor :installments, :from =>"Installments",:as => Installments
17
+
18
+ # @!attribute payment_acceptance
19
+ # @return [PaymentAcceptance] the payment acceptance.
20
+ xml_accessor :payment_acceptance, :from =>"PaymentAcceptance",:as => PaymentAcceptance
21
+
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :installments => :Installments ,
27
+ :payment_acceptance => :PaymentAcceptance
28
+
29
+ }
30
+ end
31
+
32
+ def initialize(attributes = {})
33
+ return unless attributes.is_a?(Hash)
34
+
35
+ # convert string to symbol for hash key
36
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
37
+
38
+
39
+ if attributes.has_key?(:Installments) || attributes.has_key?(:installments)
40
+ self.installments = attributes[:Installments] || attributes[:installments]
41
+ end
42
+
43
+ if attributes.has_key?(:PaymentAcceptance) || attributes.has_key?(:payment_acceptance)
44
+ self.payment_acceptance = attributes[:PaymentAcceptance] || attributes[:payment_acceptance]
45
+ end
46
+
47
+ end
48
+
49
+
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
+ installments == o.installments &&
57
+ payment_acceptance == o.payment_acceptance
58
+ end
59
+
60
+ # @see the `==` method
61
+ def eql?(o)
62
+ self == o
63
+ end
64
+
65
+ # Calculate hash code according to all attributes.
66
+ def hash
67
+ [installments, payment_acceptance].hash
68
+ end
69
+
70
+ # build the object from hash
71
+ def build_from_hash(attributes)
72
+ return nil unless attributes.is_a?(Hash)
73
+ self.class.datatype_map.each_pair do |key, type|
74
+ if type =~ /^Array<(.*)>/i
75
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
76
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
77
+ else
78
+ #TODO show warning in debug mode
79
+ end
80
+ elsif !attributes[self.class.attribute_map[key]].nil?
81
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
82
+ else
83
+ # data not found in attributes(hash), not an issue as the data can be optional
84
+ end
85
+ end
86
+
87
+ self
88
+ end
89
+
90
+ def _deserialize(type, value)
91
+ case type.to_sym
92
+ when :DateTime
93
+ DateTime.parse(value)
94
+ when :Date
95
+ Date.parse(value)
96
+ when :String
97
+ value.to_s
98
+ when :Integer
99
+ value.to_i
100
+ when :Float
101
+ value.to_f
102
+ when :BOOLEAN
103
+ if value =~ /^(true|t|yes|y|1)$/i
104
+ true
105
+ else
106
+ false
107
+ end
108
+ when /\AArray<(?<inner_type>.+)>\z/
109
+ inner_type = Regexp.last_match[:inner_type]
110
+ value.map { |v| _deserialize(inner_type, v) }
111
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
112
+ k_type = Regexp.last_match[:k_type]
113
+ v_type = Regexp.last_match[:v_type]
114
+ {}.tap do |hash|
115
+ value.each do |k, v|
116
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
117
+ end
118
+ end
119
+ else # model
120
+ _model = MastercardMasterpassMerchant.const_get(type).new
121
+ _model.build_from_hash(value)
122
+ end
123
+ end
124
+
125
+ def to_s
126
+ to_hash.to_s
127
+ end
128
+
129
+ # to_body is an alias to to_body (backward compatibility))
130
+ def to_body
131
+ to_hash
132
+ end
133
+
134
+ # return the object in the form of hash
135
+ def to_hash
136
+ hash = {}
137
+ self.class.attribute_map.each_pair do |attr, param|
138
+ value = self.send(attr)
139
+ next if value.nil?
140
+ hash[param] = _to_hash(value)
141
+ end
142
+ hash
143
+ end
144
+
145
+ # Method to output non-array value in the form of hash
146
+ # For object, use to_hash. Otherwise, just return the value
147
+ def _to_hash(value)
148
+ if value.is_a?(Array)
149
+ value.compact.map{ |v| _to_hash(v) }
150
+ elsif value.is_a?(Hash)
151
+ {}.tap do |hash|
152
+ value.each { |k, v| hash[k] = _to_hash(v) }
153
+ end
154
+ elsif value.respond_to? :to_hash
155
+ value.to_hash
156
+ else
157
+ value
158
+ end
159
+ end
160
+
161
+
162
+ private
163
+ def after_parse
164
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
165
+ end
166
+
167
+ # Attribute datatype mapping.
168
+ def self.datatype_map
169
+ {
170
+ :installments => 'Installments',
171
+ :payment_acceptance => 'PaymentAcceptance'
172
+
173
+ }
174
+ end
175
+ end
176
+
177
+
178
+ end