paze-apimatic-sdk 1.0.0

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.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +147 -0
  4. data/bin/console +15 -0
  5. data/lib/paze_checkout_api/api_helper.rb +10 -0
  6. data/lib/paze_checkout_api/client.rb +97 -0
  7. data/lib/paze_checkout_api/configuration.rb +221 -0
  8. data/lib/paze_checkout_api/controllers/base_controller.rb +60 -0
  9. data/lib/paze_checkout_api/controllers/checkout_session_controller.rb +108 -0
  10. data/lib/paze_checkout_api/controllers/identity_controller.rb +43 -0
  11. data/lib/paze_checkout_api/controllers/merchant_onboarding_controller.rb +39 -0
  12. data/lib/paze_checkout_api/controllers/o_auth_authorization_controller.rb +42 -0
  13. data/lib/paze_checkout_api/exceptions/api_error_response_exception.rb +67 -0
  14. data/lib/paze_checkout_api/exceptions/api_exception.rb +21 -0
  15. data/lib/paze_checkout_api/exceptions/base_response_exception.rb +75 -0
  16. data/lib/paze_checkout_api/exceptions/o_auth_provider_exception.rb +64 -0
  17. data/lib/paze_checkout_api/exceptions/simple_error_exception.rb +46 -0
  18. data/lib/paze_checkout_api/http/auth/o_auth2.rb +149 -0
  19. data/lib/paze_checkout_api/http/http_call_back.rb +10 -0
  20. data/lib/paze_checkout_api/http/http_method_enum.rb +10 -0
  21. data/lib/paze_checkout_api/http/http_request.rb +10 -0
  22. data/lib/paze_checkout_api/http/http_response.rb +10 -0
  23. data/lib/paze_checkout_api/http/proxy_settings.rb +22 -0
  24. data/lib/paze_checkout_api/models/api_response_metadata.rb +87 -0
  25. data/lib/paze_checkout_api/models/base_model.rb +110 -0
  26. data/lib/paze_checkout_api/models/billing_preference_enum.rb +36 -0
  27. data/lib/paze_checkout_api/models/checkout_session_complete_request.rb +70 -0
  28. data/lib/paze_checkout_api/models/checkout_session_complete_response.rb +97 -0
  29. data/lib/paze_checkout_api/models/checkout_session_create_request.rb +70 -0
  30. data/lib/paze_checkout_api/models/checkout_session_create_response.rb +97 -0
  31. data/lib/paze_checkout_api/models/checkout_session_review_request.rb +70 -0
  32. data/lib/paze_checkout_api/models/checkout_session_review_response.rb +97 -0
  33. data/lib/paze_checkout_api/models/client.rb +80 -0
  34. data/lib/paze_checkout_api/models/client_assertion_type_enum.rb +27 -0
  35. data/lib/paze_checkout_api/models/complete_session_data.rb +131 -0
  36. data/lib/paze_checkout_api/models/complete_session_response_data.rb +71 -0
  37. data/lib/paze_checkout_api/models/consumer.rb +100 -0
  38. data/lib/paze_checkout_api/models/create_session_data.rb +134 -0
  39. data/lib/paze_checkout_api/models/create_session_response_data.rb +71 -0
  40. data/lib/paze_checkout_api/models/data.rb +62 -0
  41. data/lib/paze_checkout_api/models/ecommerce_data.rb +109 -0
  42. data/lib/paze_checkout_api/models/enhanced_transaction_data.rb +71 -0
  43. data/lib/paze_checkout_api/models/error_detail.rb +81 -0
  44. data/lib/paze_checkout_api/models/error_message.rb +88 -0
  45. data/lib/paze_checkout_api/models/grant_type_enum.rb +26 -0
  46. data/lib/paze_checkout_api/models/intent_enum.rb +40 -0
  47. data/lib/paze_checkout_api/models/links.rb +74 -0
  48. data/lib/paze_checkout_api/models/masked_card.rb +107 -0
  49. data/lib/paze_checkout_api/models/merchant_address.rb +97 -0
  50. data/lib/paze_checkout_api/models/merchant_onboard_data.rb +115 -0
  51. data/lib/paze_checkout_api/models/merchant_onboard_request.rb +70 -0
  52. data/lib/paze_checkout_api/models/merchant_profile.rb +83 -0
  53. data/lib/paze_checkout_api/models/merchant_response.rb +122 -0
  54. data/lib/paze_checkout_api/models/o_auth_provider_error_enum.rb +62 -0
  55. data/lib/paze_checkout_api/models/o_auth_token.rb +96 -0
  56. data/lib/paze_checkout_api/models/o_auth_token_request.rb +75 -0
  57. data/lib/paze_checkout_api/models/o_auth_token_response.rb +78 -0
  58. data/lib/paze_checkout_api/models/onboard_merchant_key.rb +112 -0
  59. data/lib/paze_checkout_api/models/payload_type_indicator_enum.rb +36 -0
  60. data/lib/paze_checkout_api/models/payment_card_brand_enum.rb +40 -0
  61. data/lib/paze_checkout_api/models/payment_card_type_enum.rb +36 -0
  62. data/lib/paze_checkout_api/models/phone.rb +72 -0
  63. data/lib/paze_checkout_api/models/processing_network_enum.rb +40 -0
  64. data/lib/paze_checkout_api/models/review_session_data.rb +68 -0
  65. data/lib/paze_checkout_api/models/review_session_response_data.rb +100 -0
  66. data/lib/paze_checkout_api/models/shipping_address.rb +101 -0
  67. data/lib/paze_checkout_api/models/transaction_options.rb +87 -0
  68. data/lib/paze_checkout_api/models/transaction_type_enum.rb +36 -0
  69. data/lib/paze_checkout_api/models/transaction_value.rb +72 -0
  70. data/lib/paze_checkout_api/models/travel_data.rb +110 -0
  71. data/lib/paze_checkout_api/utilities/date_time_helper.rb +11 -0
  72. data/lib/paze_checkout_api/utilities/file_wrapper.rb +28 -0
  73. data/lib/paze_checkout_api.rb +93 -0
  74. metadata +157 -0
@@ -0,0 +1,71 @@
1
+ # paze_checkout_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0
4
+ # ( https://www.apimatic.io ).
5
+
6
+ module PazeCheckoutApi
7
+ # CreateSessionResponseData Model.
8
+ class CreateSessionResponseData < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [TrueClass | FalseClass]
14
+ attr_accessor :can_checkout
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :checkout_url
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['can_checkout'] = 'canCheckout'
24
+ @_hash['checkout_url'] = 'checkoutUrl'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ checkout_url
32
+ ]
33
+ end
34
+
35
+ # An array for nullable fields
36
+ def self.nullables
37
+ []
38
+ end
39
+
40
+ def initialize(can_checkout = nil, checkout_url = SKIP)
41
+ @can_checkout = can_checkout
42
+ @checkout_url = checkout_url unless checkout_url == SKIP
43
+ end
44
+
45
+ # Creates an instance of the object from a hash.
46
+ def self.from_hash(hash)
47
+ return nil unless hash
48
+
49
+ # Extract variables from the hash.
50
+ can_checkout = hash.key?('canCheckout') ? hash['canCheckout'] : nil
51
+ checkout_url = hash.key?('checkoutUrl') ? hash['checkoutUrl'] : SKIP
52
+
53
+ # Create object from extracted values.
54
+ CreateSessionResponseData.new(can_checkout,
55
+ checkout_url)
56
+ end
57
+
58
+ # Provides a human-readable string representation of the object.
59
+ def to_s
60
+ class_name = self.class.name.split('::').last
61
+ "<#{class_name} can_checkout: #{@can_checkout}, checkout_url: #{@checkout_url}>"
62
+ end
63
+
64
+ # Provides a debugging-friendly string with detailed object information.
65
+ def inspect
66
+ class_name = self.class.name.split('::').last
67
+ "<#{class_name} can_checkout: #{@can_checkout.inspect}, checkout_url:"\
68
+ " #{@checkout_url.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,62 @@
1
+ # paze_checkout_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0
4
+ # ( https://www.apimatic.io ).
5
+
6
+ module PazeCheckoutApi
7
+ # Data Model.
8
+ class Data < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :id
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['id'] = 'id'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ id
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(id = SKIP)
36
+ @id = id unless id == SKIP
37
+ end
38
+
39
+ # Creates an instance of the object from a hash.
40
+ def self.from_hash(hash)
41
+ return nil unless hash
42
+
43
+ # Extract variables from the hash.
44
+ id = hash.key?('id') ? hash['id'] : SKIP
45
+
46
+ # Create object from extracted values.
47
+ Data.new(id)
48
+ end
49
+
50
+ # Provides a human-readable string representation of the object.
51
+ def to_s
52
+ class_name = self.class.name.split('::').last
53
+ "<#{class_name} id: #{@id}>"
54
+ end
55
+
56
+ # Provides a debugging-friendly string with detailed object information.
57
+ def inspect
58
+ class_name = self.class.name.split('::').last
59
+ "<#{class_name} id: #{@id.inspect}>"
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,109 @@
1
+ # paze_checkout_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0
4
+ # ( https://www.apimatic.io ).
5
+
6
+ module PazeCheckoutApi
7
+ # EcommerceData Model.
8
+ class EcommerceData < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [TrueClass | FalseClass]
14
+ attr_accessor :cart_contains_gift_card
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [TrueClass | FalseClass]
18
+ attr_accessor :order_for_pickup
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :order_highest_cost
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :order_quantity
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [ShippingAddress]
30
+ attr_accessor :final_shipping_address
31
+
32
+ # A mapping from model property names to API property names.
33
+ def self.names
34
+ @_hash = {} if @_hash.nil?
35
+ @_hash['cart_contains_gift_card'] = 'cartContainsGiftCard'
36
+ @_hash['order_for_pickup'] = 'orderForPickup'
37
+ @_hash['order_highest_cost'] = 'orderHighestCost'
38
+ @_hash['order_quantity'] = 'orderQuantity'
39
+ @_hash['final_shipping_address'] = 'finalShippingAddress'
40
+ @_hash
41
+ end
42
+
43
+ # An array for optional fields
44
+ def self.optionals
45
+ %w[
46
+ cart_contains_gift_card
47
+ order_for_pickup
48
+ order_highest_cost
49
+ order_quantity
50
+ final_shipping_address
51
+ ]
52
+ end
53
+
54
+ # An array for nullable fields
55
+ def self.nullables
56
+ []
57
+ end
58
+
59
+ def initialize(cart_contains_gift_card = SKIP, order_for_pickup = SKIP,
60
+ order_highest_cost = SKIP, order_quantity = SKIP,
61
+ final_shipping_address = SKIP)
62
+ @cart_contains_gift_card = cart_contains_gift_card unless cart_contains_gift_card == SKIP
63
+ @order_for_pickup = order_for_pickup unless order_for_pickup == SKIP
64
+ @order_highest_cost = order_highest_cost unless order_highest_cost == SKIP
65
+ @order_quantity = order_quantity unless order_quantity == SKIP
66
+ @final_shipping_address = final_shipping_address unless final_shipping_address == SKIP
67
+ end
68
+
69
+ # Creates an instance of the object from a hash.
70
+ def self.from_hash(hash)
71
+ return nil unless hash
72
+
73
+ # Extract variables from the hash.
74
+ cart_contains_gift_card =
75
+ hash.key?('cartContainsGiftCard') ? hash['cartContainsGiftCard'] : SKIP
76
+ order_for_pickup =
77
+ hash.key?('orderForPickup') ? hash['orderForPickup'] : SKIP
78
+ order_highest_cost =
79
+ hash.key?('orderHighestCost') ? hash['orderHighestCost'] : SKIP
80
+ order_quantity = hash.key?('orderQuantity') ? hash['orderQuantity'] : SKIP
81
+ final_shipping_address = ShippingAddress.from_hash(hash['finalShippingAddress']) if
82
+ hash['finalShippingAddress']
83
+
84
+ # Create object from extracted values.
85
+ EcommerceData.new(cart_contains_gift_card,
86
+ order_for_pickup,
87
+ order_highest_cost,
88
+ order_quantity,
89
+ final_shipping_address)
90
+ end
91
+
92
+ # Provides a human-readable string representation of the object.
93
+ def to_s
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} cart_contains_gift_card: #{@cart_contains_gift_card}, order_for_pickup:"\
96
+ " #{@order_for_pickup}, order_highest_cost: #{@order_highest_cost}, order_quantity:"\
97
+ " #{@order_quantity}, final_shipping_address: #{@final_shipping_address}>"
98
+ end
99
+
100
+ # Provides a debugging-friendly string with detailed object information.
101
+ def inspect
102
+ class_name = self.class.name.split('::').last
103
+ "<#{class_name} cart_contains_gift_card: #{@cart_contains_gift_card.inspect},"\
104
+ " order_for_pickup: #{@order_for_pickup.inspect}, order_highest_cost:"\
105
+ " #{@order_highest_cost.inspect}, order_quantity: #{@order_quantity.inspect},"\
106
+ " final_shipping_address: #{@final_shipping_address.inspect}>"
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,71 @@
1
+ # paze_checkout_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0
4
+ # ( https://www.apimatic.io ).
5
+
6
+ module PazeCheckoutApi
7
+ # EnhancedTransactionData Model.
8
+ class EnhancedTransactionData < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [EcommerceData]
14
+ attr_accessor :ecom_data
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [TravelData]
18
+ attr_accessor :travel_data
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['ecom_data'] = 'ecomData'
24
+ @_hash['travel_data'] = 'travelData'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ ecom_data
32
+ travel_data
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(ecom_data = SKIP, travel_data = SKIP)
42
+ @ecom_data = ecom_data unless ecom_data == SKIP
43
+ @travel_data = travel_data unless travel_data == SKIP
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ ecom_data = EcommerceData.from_hash(hash['ecomData']) if hash['ecomData']
52
+ travel_data = TravelData.from_hash(hash['travelData']) if hash['travelData']
53
+
54
+ # Create object from extracted values.
55
+ EnhancedTransactionData.new(ecom_data,
56
+ travel_data)
57
+ end
58
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} ecom_data: #{@ecom_data}, travel_data: #{@travel_data}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} ecom_data: #{@ecom_data.inspect}, travel_data: #{@travel_data.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,81 @@
1
+ # paze_checkout_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0
4
+ # ( https://www.apimatic.io ).
5
+
6
+ module PazeCheckoutApi
7
+ # ErrorDetail Model.
8
+ class ErrorDetail < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :reason
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :source
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [String]
22
+ attr_accessor :message
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['reason'] = 'reason'
28
+ @_hash['source'] = 'source'
29
+ @_hash['message'] = 'message'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ reason
37
+ source
38
+ message
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(reason = SKIP, source = SKIP, message = SKIP)
48
+ @reason = reason unless reason == SKIP
49
+ @source = source unless source == SKIP
50
+ @message = message unless message == SKIP
51
+ end
52
+
53
+ # Creates an instance of the object from a hash.
54
+ def self.from_hash(hash)
55
+ return nil unless hash
56
+
57
+ # Extract variables from the hash.
58
+ reason = hash.key?('reason') ? hash['reason'] : SKIP
59
+ source = hash.key?('source') ? hash['source'] : SKIP
60
+ message = hash.key?('message') ? hash['message'] : SKIP
61
+
62
+ # Create object from extracted values.
63
+ ErrorDetail.new(reason,
64
+ source,
65
+ message)
66
+ end
67
+
68
+ # Provides a human-readable string representation of the object.
69
+ def to_s
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} reason: #{@reason}, source: #{@source}, message: #{@message}>"
72
+ end
73
+
74
+ # Provides a debugging-friendly string with detailed object information.
75
+ def inspect
76
+ class_name = self.class.name.split('::').last
77
+ "<#{class_name} reason: #{@reason.inspect}, source: #{@source.inspect}, message:"\
78
+ " #{@message.inspect}>"
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,88 @@
1
+ # paze_checkout_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0
4
+ # ( https://www.apimatic.io ).
5
+
6
+ module PazeCheckoutApi
7
+ # ErrorMessage Model.
8
+ class ErrorMessage < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :reason
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :message
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Array[ErrorDetail]]
22
+ attr_accessor :details
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['reason'] = 'reason'
28
+ @_hash['message'] = 'message'
29
+ @_hash['details'] = 'details'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ details
37
+ ]
38
+ end
39
+
40
+ # An array for nullable fields
41
+ def self.nullables
42
+ []
43
+ end
44
+
45
+ def initialize(reason = nil, message = nil, details = SKIP)
46
+ @reason = reason
47
+ @message = message
48
+ @details = details unless details == SKIP
49
+ end
50
+
51
+ # Creates an instance of the object from a hash.
52
+ def self.from_hash(hash)
53
+ return nil unless hash
54
+
55
+ # Extract variables from the hash.
56
+ reason = hash.key?('reason') ? hash['reason'] : nil
57
+ message = hash.key?('message') ? hash['message'] : nil
58
+ # Parameter is an array, so we need to iterate through it
59
+ details = nil
60
+ unless hash['details'].nil?
61
+ details = []
62
+ hash['details'].each do |structure|
63
+ details << (ErrorDetail.from_hash(structure) if structure)
64
+ end
65
+ end
66
+
67
+ details = SKIP unless hash.key?('details')
68
+
69
+ # Create object from extracted values.
70
+ ErrorMessage.new(reason,
71
+ message,
72
+ details)
73
+ end
74
+
75
+ # Provides a human-readable string representation of the object.
76
+ def to_s
77
+ class_name = self.class.name.split('::').last
78
+ "<#{class_name} reason: #{@reason}, message: #{@message}, details: #{@details}>"
79
+ end
80
+
81
+ # Provides a debugging-friendly string with detailed object information.
82
+ def inspect
83
+ class_name = self.class.name.split('::').last
84
+ "<#{class_name} reason: #{@reason.inspect}, message: #{@message.inspect}, details:"\
85
+ " #{@details.inspect}>"
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,26 @@
1
+ # paze_checkout_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0
4
+ # ( https://www.apimatic.io ).
5
+
6
+ module PazeCheckoutApi
7
+ # GrantType.
8
+ class GrantTypeEnum
9
+ GRANT_TYPE_ENUM = [
10
+ # TODO: Write general description for CLIENT_CREDENTIALS
11
+ CLIENT_CREDENTIALS = 'client_credentials'.freeze
12
+ ].freeze
13
+
14
+ def self.validate(value)
15
+ return false if value.nil?
16
+
17
+ GRANT_TYPE_ENUM.include?(value)
18
+ end
19
+
20
+ def self.from_value(value, default_value = CLIENT_CREDENTIALS)
21
+ return default_value if value.nil?
22
+
23
+ default_value
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,40 @@
1
+ # paze_checkout_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0
4
+ # ( https://www.apimatic.io ).
5
+
6
+ module PazeCheckoutApi
7
+ # Intent.
8
+ class IntentEnum
9
+ INTENT_ENUM = [
10
+ # TODO: Write general description for REVIEW_AND_PAY
11
+ REVIEW_AND_PAY = 'REVIEW_AND_PAY'.freeze,
12
+
13
+ # TODO: Write general description for EXPRESS_CHECKOUT
14
+ EXPRESS_CHECKOUT = 'EXPRESS_CHECKOUT'.freeze,
15
+
16
+ # TODO: Write general description for ADD_CARD
17
+ ADD_CARD = 'ADD_CARD'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ INTENT_ENUM.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = REVIEW_AND_PAY)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'review_and_pay' then REVIEW_AND_PAY
33
+ when 'express_checkout' then EXPRESS_CHECKOUT
34
+ when 'add_card' then ADD_CARD
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,74 @@
1
+ # paze_checkout_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0
4
+ # ( https://www.apimatic.io ).
5
+
6
+ module PazeCheckoutApi
7
+ # Links Model.
8
+ class Links < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :change_card
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :change_shipping_address
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['change_card'] = 'CHANGE_CARD'
24
+ @_hash['change_shipping_address'] = 'CHANGE_SHIPPING_ADDRESS'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ change_card
32
+ change_shipping_address
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(change_card = SKIP, change_shipping_address = SKIP)
42
+ @change_card = change_card unless change_card == SKIP
43
+ @change_shipping_address = change_shipping_address unless change_shipping_address == SKIP
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ change_card = hash.key?('CHANGE_CARD') ? hash['CHANGE_CARD'] : SKIP
52
+ change_shipping_address =
53
+ hash.key?('CHANGE_SHIPPING_ADDRESS') ? hash['CHANGE_SHIPPING_ADDRESS'] : SKIP
54
+
55
+ # Create object from extracted values.
56
+ Links.new(change_card,
57
+ change_shipping_address)
58
+ end
59
+
60
+ # Provides a human-readable string representation of the object.
61
+ def to_s
62
+ class_name = self.class.name.split('::').last
63
+ "<#{class_name} change_card: #{@change_card}, change_shipping_address:"\
64
+ " #{@change_shipping_address}>"
65
+ end
66
+
67
+ # Provides a debugging-friendly string with detailed object information.
68
+ def inspect
69
+ class_name = self.class.name.split('::').last
70
+ "<#{class_name} change_card: #{@change_card.inspect}, change_shipping_address:"\
71
+ " #{@change_shipping_address.inspect}>"
72
+ end
73
+ end
74
+ end