apimatic-polpay-sdk 0.0.1

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 (43) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +173 -0
  4. data/bin/console +15 -0
  5. data/lib/poli_ap_is/api_helper.rb +10 -0
  6. data/lib/poli_ap_is/apis/base_api.rb +67 -0
  7. data/lib/poli_ap_is/apis/payments_api.rb +155 -0
  8. data/lib/poli_ap_is/apis/poli_links_api.rb +135 -0
  9. data/lib/poli_ap_is/client.rb +79 -0
  10. data/lib/poli_ap_is/configuration.rb +179 -0
  11. data/lib/poli_ap_is/exceptions/api_exception.rb +21 -0
  12. data/lib/poli_ap_is/http/api_response.rb +19 -0
  13. data/lib/poli_ap_is/http/auth/basic_auth.rb +62 -0
  14. data/lib/poli_ap_is/http/http_call_back.rb +10 -0
  15. data/lib/poli_ap_is/http/http_method_enum.rb +10 -0
  16. data/lib/poli_ap_is/http/http_request.rb +10 -0
  17. data/lib/poli_ap_is/http/http_response.rb +10 -0
  18. data/lib/poli_ap_is/http/proxy_settings.rb +22 -0
  19. data/lib/poli_ap_is/logging/configuration/api_logging_configuration.rb +186 -0
  20. data/lib/poli_ap_is/logging/sdk_logger.rb +17 -0
  21. data/lib/poli_ap_is/models/bank_details.rb +126 -0
  22. data/lib/poli_ap_is/models/base_model.rb +110 -0
  23. data/lib/poli_ap_is/models/create_poli_link_request.rb +170 -0
  24. data/lib/poli_ap_is/models/create_poli_link_request_body_json.rb +170 -0
  25. data/lib/poli_ap_is/models/daily_transaction.rb +245 -0
  26. data/lib/poli_ap_is/models/fetch_statusof_poli_link_response200_text.rb +48 -0
  27. data/lib/poli_ap_is/models/financial_institution.rb +95 -0
  28. data/lib/poli_ap_is/models/get_transaction_response.rb +109 -0
  29. data/lib/poli_ap_is/models/initiate_transaction_request.rb +201 -0
  30. data/lib/poli_ap_is/models/initiate_transaction_response.rb +118 -0
  31. data/lib/poli_ap_is/models/link_payment.rb +137 -0
  32. data/lib/poli_ap_is/models/merchant_details.rb +100 -0
  33. data/lib/poli_ap_is/models/payer_details.rb +100 -0
  34. data/lib/poli_ap_is/models/poli_link_basic_info.rb +116 -0
  35. data/lib/poli_ap_is/models/poli_link_basic_info_status.rb +48 -0
  36. data/lib/poli_ap_is/models/poli_link_payments_response.rb +116 -0
  37. data/lib/poli_ap_is/models/poli_link_payments_response_status.rb +48 -0
  38. data/lib/poli_ap_is/models/poli_link_payments_response_transactions_items.rb +159 -0
  39. data/lib/poli_ap_is/models/transaction_details.rb +148 -0
  40. data/lib/poli_ap_is/utilities/date_time_helper.rb +11 -0
  41. data/lib/poli_ap_is/utilities/file_wrapper.rb +28 -0
  42. data/lib/poli_ap_is.rb +64 -0
  43. metadata +126 -0
@@ -0,0 +1,137 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module PoliApIs
8
+ # LinkPayment Model.
9
+ class LinkPayment < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # The POLi ID associated with the transaction
14
+ # @return [String]
15
+ attr_accessor :transaction_ref_no
16
+
17
+ # The actual amount paid for the transaction
18
+ # @return [Float]
19
+ attr_accessor :amount_paid
20
+
21
+ # Status of the transaction
22
+ # @return [String]
23
+ attr_accessor :transaction_status_code
24
+
25
+ # The date and time the transaction was initiated
26
+ # @return [DateTime]
27
+ attr_accessor :established_date_time
28
+
29
+ # The date and time the transaction was completed
30
+ # @return [DateTime]
31
+ attr_accessor :end_date_time
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ @_hash = {} if @_hash.nil?
36
+ @_hash['transaction_ref_no'] = 'TransactionRefNo'
37
+ @_hash['amount_paid'] = 'AmountPaid'
38
+ @_hash['transaction_status_code'] = 'TransactionStatusCode'
39
+ @_hash['established_date_time'] = 'EstablishedDateTime'
40
+ @_hash['end_date_time'] = 'EndDateTime'
41
+ @_hash
42
+ end
43
+
44
+ # An array for optional fields
45
+ def self.optionals
46
+ %w[
47
+ transaction_ref_no
48
+ amount_paid
49
+ transaction_status_code
50
+ established_date_time
51
+ end_date_time
52
+ ]
53
+ end
54
+
55
+ # An array for nullable fields
56
+ def self.nullables
57
+ []
58
+ end
59
+
60
+ def initialize(transaction_ref_no: SKIP, amount_paid: SKIP,
61
+ transaction_status_code: SKIP, established_date_time: SKIP,
62
+ end_date_time: SKIP, additional_properties: nil)
63
+ # Add additional model properties to the instance
64
+ additional_properties = {} if additional_properties.nil?
65
+
66
+ @transaction_ref_no = transaction_ref_no unless transaction_ref_no == SKIP
67
+ @amount_paid = amount_paid unless amount_paid == SKIP
68
+ @transaction_status_code = transaction_status_code unless transaction_status_code == SKIP
69
+ @established_date_time = established_date_time unless established_date_time == SKIP
70
+ @end_date_time = end_date_time unless end_date_time == SKIP
71
+ @additional_properties = additional_properties
72
+ end
73
+
74
+ # Creates an instance of the object from a hash.
75
+ def self.from_hash(hash)
76
+ return nil unless hash
77
+
78
+ # Extract variables from the hash.
79
+ transaction_ref_no =
80
+ hash.key?('TransactionRefNo') ? hash['TransactionRefNo'] : SKIP
81
+ amount_paid = hash.key?('AmountPaid') ? hash['AmountPaid'] : SKIP
82
+ transaction_status_code =
83
+ hash.key?('TransactionStatusCode') ? hash['TransactionStatusCode'] : SKIP
84
+ established_date_time = if hash.key?('EstablishedDateTime')
85
+ (DateTimeHelper.from_rfc3339(hash['EstablishedDateTime']) if hash['EstablishedDateTime'])
86
+ else
87
+ SKIP
88
+ end
89
+ end_date_time = if hash.key?('EndDateTime')
90
+ (DateTimeHelper.from_rfc3339(hash['EndDateTime']) if hash['EndDateTime'])
91
+ else
92
+ SKIP
93
+ end
94
+
95
+ # Create a new hash for additional properties, removing known properties.
96
+ new_hash = hash.reject { |k, _| names.value?(k) }
97
+
98
+ additional_properties = APIHelper.get_additional_properties(
99
+ new_hash, proc { |value| value }
100
+ )
101
+
102
+ # Create object from extracted values.
103
+ LinkPayment.new(transaction_ref_no: transaction_ref_no,
104
+ amount_paid: amount_paid,
105
+ transaction_status_code: transaction_status_code,
106
+ established_date_time: established_date_time,
107
+ end_date_time: end_date_time,
108
+ additional_properties: additional_properties)
109
+ end
110
+
111
+ def to_custom_established_date_time
112
+ DateTimeHelper.to_rfc3339(established_date_time)
113
+ end
114
+
115
+ def to_custom_end_date_time
116
+ DateTimeHelper.to_rfc3339(end_date_time)
117
+ end
118
+
119
+ # Provides a human-readable string representation of the object.
120
+ def to_s
121
+ class_name = self.class.name.split('::').last
122
+ "<#{class_name} transaction_ref_no: #{@transaction_ref_no}, amount_paid: #{@amount_paid},"\
123
+ " transaction_status_code: #{@transaction_status_code}, established_date_time:"\
124
+ " #{@established_date_time}, end_date_time: #{@end_date_time}, additional_properties:"\
125
+ " #{@additional_properties}>"
126
+ end
127
+
128
+ # Provides a debugging-friendly string with detailed object information.
129
+ def inspect
130
+ class_name = self.class.name.split('::').last
131
+ "<#{class_name} transaction_ref_no: #{@transaction_ref_no.inspect}, amount_paid:"\
132
+ " #{@amount_paid.inspect}, transaction_status_code: #{@transaction_status_code.inspect},"\
133
+ " established_date_time: #{@established_date_time.inspect}, end_date_time:"\
134
+ " #{@end_date_time.inspect}, additional_properties: #{@additional_properties}>"
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,100 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # MerchantDetails Model.
8
+ class MerchantDetails < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The merchant reference passed in the InitiateTransaction request
13
+ # @return [String]
14
+ attr_accessor :merchant_reference
15
+
16
+ # The merchant’s bank account name
17
+ # @return [String]
18
+ attr_accessor :merchant_account_name
19
+
20
+ # The merchant’s account number
21
+ # @return [String]
22
+ attr_accessor :merchant_account_number
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['merchant_reference'] = 'MerchantReference'
28
+ @_hash['merchant_account_name'] = 'MerchantAccountName'
29
+ @_hash['merchant_account_number'] = 'MerchantAccountNumber'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ merchant_reference
37
+ merchant_account_name
38
+ merchant_account_number
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(merchant_reference: SKIP, merchant_account_name: SKIP,
48
+ merchant_account_number: SKIP, additional_properties: nil)
49
+ # Add additional model properties to the instance
50
+ additional_properties = {} if additional_properties.nil?
51
+
52
+ @merchant_reference = merchant_reference unless merchant_reference == SKIP
53
+ @merchant_account_name = merchant_account_name unless merchant_account_name == SKIP
54
+ @merchant_account_number = merchant_account_number unless merchant_account_number == SKIP
55
+ @additional_properties = additional_properties
56
+ end
57
+
58
+ # Creates an instance of the object from a hash.
59
+ def self.from_hash(hash)
60
+ return nil unless hash
61
+
62
+ # Extract variables from the hash.
63
+ merchant_reference =
64
+ hash.key?('MerchantReference') ? hash['MerchantReference'] : SKIP
65
+ merchant_account_name =
66
+ hash.key?('MerchantAccountName') ? hash['MerchantAccountName'] : SKIP
67
+ merchant_account_number =
68
+ hash.key?('MerchantAccountNumber') ? hash['MerchantAccountNumber'] : SKIP
69
+
70
+ # Create a new hash for additional properties, removing known properties.
71
+ new_hash = hash.reject { |k, _| names.value?(k) }
72
+
73
+ additional_properties = APIHelper.get_additional_properties(
74
+ new_hash, proc { |value| value }
75
+ )
76
+
77
+ # Create object from extracted values.
78
+ MerchantDetails.new(merchant_reference: merchant_reference,
79
+ merchant_account_name: merchant_account_name,
80
+ merchant_account_number: merchant_account_number,
81
+ additional_properties: additional_properties)
82
+ end
83
+
84
+ # Provides a human-readable string representation of the object.
85
+ def to_s
86
+ class_name = self.class.name.split('::').last
87
+ "<#{class_name} merchant_reference: #{@merchant_reference}, merchant_account_name:"\
88
+ " #{@merchant_account_name}, merchant_account_number: #{@merchant_account_number},"\
89
+ " additional_properties: #{@additional_properties}>"
90
+ end
91
+
92
+ # Provides a debugging-friendly string with detailed object information.
93
+ def inspect
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} merchant_reference: #{@merchant_reference.inspect}, merchant_account_name:"\
96
+ " #{@merchant_account_name.inspect}, merchant_account_number:"\
97
+ " #{@merchant_account_number.inspect}, additional_properties: #{@additional_properties}>"
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,100 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # PayerDetails Model.
8
+ class PayerDetails < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The first name of the user who paid
13
+ # @return [String]
14
+ attr_accessor :payer_first_name
15
+
16
+ # The last name of the user who paid
17
+ # @return [String]
18
+ attr_accessor :payer_family_name
19
+
20
+ # The account number of the user who paid
21
+ # @return [String]
22
+ attr_accessor :payer_account_number
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['payer_first_name'] = 'PayerFirstName'
28
+ @_hash['payer_family_name'] = 'PayerFamilyName'
29
+ @_hash['payer_account_number'] = 'PayerAccountNumber'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ payer_first_name
37
+ payer_family_name
38
+ payer_account_number
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(payer_first_name: SKIP, payer_family_name: SKIP,
48
+ payer_account_number: SKIP, additional_properties: nil)
49
+ # Add additional model properties to the instance
50
+ additional_properties = {} if additional_properties.nil?
51
+
52
+ @payer_first_name = payer_first_name unless payer_first_name == SKIP
53
+ @payer_family_name = payer_family_name unless payer_family_name == SKIP
54
+ @payer_account_number = payer_account_number unless payer_account_number == SKIP
55
+ @additional_properties = additional_properties
56
+ end
57
+
58
+ # Creates an instance of the object from a hash.
59
+ def self.from_hash(hash)
60
+ return nil unless hash
61
+
62
+ # Extract variables from the hash.
63
+ payer_first_name =
64
+ hash.key?('PayerFirstName') ? hash['PayerFirstName'] : SKIP
65
+ payer_family_name =
66
+ hash.key?('PayerFamilyName') ? hash['PayerFamilyName'] : SKIP
67
+ payer_account_number =
68
+ hash.key?('PayerAccountNumber') ? hash['PayerAccountNumber'] : SKIP
69
+
70
+ # Create a new hash for additional properties, removing known properties.
71
+ new_hash = hash.reject { |k, _| names.value?(k) }
72
+
73
+ additional_properties = APIHelper.get_additional_properties(
74
+ new_hash, proc { |value| value }
75
+ )
76
+
77
+ # Create object from extracted values.
78
+ PayerDetails.new(payer_first_name: payer_first_name,
79
+ payer_family_name: payer_family_name,
80
+ payer_account_number: payer_account_number,
81
+ additional_properties: additional_properties)
82
+ end
83
+
84
+ # Provides a human-readable string representation of the object.
85
+ def to_s
86
+ class_name = self.class.name.split('::').last
87
+ "<#{class_name} payer_first_name: #{@payer_first_name}, payer_family_name:"\
88
+ " #{@payer_family_name}, payer_account_number: #{@payer_account_number},"\
89
+ " additional_properties: #{@additional_properties}>"
90
+ end
91
+
92
+ # Provides a debugging-friendly string with detailed object information.
93
+ def inspect
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} payer_first_name: #{@payer_first_name.inspect}, payer_family_name:"\
96
+ " #{@payer_family_name.inspect}, payer_account_number: #{@payer_account_number.inspect},"\
97
+ " additional_properties: #{@additional_properties}>"
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,116 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # PoliLinkBasicInfo Model.
8
+ class PoliLinkBasicInfo < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The total amount the customer(s) pay when using the POLiLink
13
+ # @return [Float]
14
+ attr_accessor :total_amount
15
+
16
+ # The cumulative amount paid towards the POLi Link over all transactions
17
+ # @return [Float]
18
+ attr_accessor :total_paid_amount
19
+
20
+ # Status of the POLi Link
21
+ # @return [PoliLinkBasicInfoStatus]
22
+ attr_accessor :status
23
+
24
+ # The transaction history of this POLi Link
25
+ # @return [Array[LinkPayment]]
26
+ attr_accessor :transactions
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['total_amount'] = 'TotalAmount'
32
+ @_hash['total_paid_amount'] = 'TotalPaidAmount'
33
+ @_hash['status'] = 'Status'
34
+ @_hash['transactions'] = 'Transactions'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ %w[
41
+ total_amount
42
+ total_paid_amount
43
+ status
44
+ transactions
45
+ ]
46
+ end
47
+
48
+ # An array for nullable fields
49
+ def self.nullables
50
+ []
51
+ end
52
+
53
+ def initialize(total_amount: SKIP, total_paid_amount: SKIP, status: SKIP,
54
+ transactions: SKIP, additional_properties: nil)
55
+ # Add additional model properties to the instance
56
+ additional_properties = {} if additional_properties.nil?
57
+
58
+ @total_amount = total_amount unless total_amount == SKIP
59
+ @total_paid_amount = total_paid_amount unless total_paid_amount == SKIP
60
+ @status = status unless status == SKIP
61
+ @transactions = transactions unless transactions == SKIP
62
+ @additional_properties = additional_properties
63
+ end
64
+
65
+ # Creates an instance of the object from a hash.
66
+ def self.from_hash(hash)
67
+ return nil unless hash
68
+
69
+ # Extract variables from the hash.
70
+ total_amount = hash.key?('TotalAmount') ? hash['TotalAmount'] : SKIP
71
+ total_paid_amount =
72
+ hash.key?('TotalPaidAmount') ? hash['TotalPaidAmount'] : SKIP
73
+ status = hash.key?('Status') ? hash['Status'] : SKIP
74
+ # Parameter is an array, so we need to iterate through it
75
+ transactions = nil
76
+ unless hash['Transactions'].nil?
77
+ transactions = []
78
+ hash['Transactions'].each do |structure|
79
+ transactions << (LinkPayment.from_hash(structure) if structure)
80
+ end
81
+ end
82
+
83
+ transactions = SKIP unless hash.key?('Transactions')
84
+
85
+ # Create a new hash for additional properties, removing known properties.
86
+ new_hash = hash.reject { |k, _| names.value?(k) }
87
+
88
+ additional_properties = APIHelper.get_additional_properties(
89
+ new_hash, proc { |value| value }
90
+ )
91
+
92
+ # Create object from extracted values.
93
+ PoliLinkBasicInfo.new(total_amount: total_amount,
94
+ total_paid_amount: total_paid_amount,
95
+ status: status,
96
+ transactions: transactions,
97
+ additional_properties: additional_properties)
98
+ end
99
+
100
+ # Provides a human-readable string representation of the object.
101
+ def to_s
102
+ class_name = self.class.name.split('::').last
103
+ "<#{class_name} total_amount: #{@total_amount}, total_paid_amount: #{@total_paid_amount},"\
104
+ " status: #{@status}, transactions: #{@transactions}, additional_properties:"\
105
+ " #{@additional_properties}>"
106
+ end
107
+
108
+ # Provides a debugging-friendly string with detailed object information.
109
+ def inspect
110
+ class_name = self.class.name.split('::').last
111
+ "<#{class_name} total_amount: #{@total_amount.inspect}, total_paid_amount:"\
112
+ " #{@total_paid_amount.inspect}, status: #{@status.inspect}, transactions:"\
113
+ " #{@transactions.inspect}, additional_properties: #{@additional_properties}>"
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,48 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # Status of the POLi Link
8
+ class PoliLinkBasicInfoStatus
9
+ POLI_LINK_BASIC_INFO_STATUS = [
10
+ # TODO: Write general description for UNUSED
11
+ UNUSED = 'Unused'.freeze,
12
+
13
+ # TODO: Write general description for ACTIVATED
14
+ ACTIVATED = 'Activated'.freeze,
15
+
16
+ # TODO: Write general description for PARTPAID
17
+ PARTPAID = 'PartPaid'.freeze,
18
+
19
+ # TODO: Write general description for FUTURE
20
+ FUTURE = 'Future'.freeze,
21
+
22
+ # TODO: Write general description for COMPLETED
23
+ COMPLETED = 'Completed'.freeze
24
+ ].freeze
25
+
26
+ def self.validate(value)
27
+ return false if value.nil?
28
+
29
+ POLI_LINK_BASIC_INFO_STATUS.include?(value)
30
+ end
31
+
32
+ def self.from_value(value, default_value = UNUSED)
33
+ return default_value if value.nil?
34
+
35
+ str = value.to_s.strip
36
+
37
+ case str.downcase
38
+ when 'unused' then UNUSED
39
+ when 'activated' then ACTIVATED
40
+ when 'partpaid' then PARTPAID
41
+ when 'future' then FUTURE
42
+ when 'completed' then COMPLETED
43
+ else
44
+ default_value
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,116 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # PoliLinkPaymentsResponse Model.
8
+ class PoliLinkPaymentsResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The total amount the customer(s) pay when using the POLiLink
13
+ # @return [Float]
14
+ attr_accessor :total_amount
15
+
16
+ # The cumulative amount paid towards the POLi Link over all transactions
17
+ # @return [Float]
18
+ attr_accessor :total_paid_amount
19
+
20
+ # Status of the POLi Link
21
+ # @return [PoliLinkPaymentsResponseStatus]
22
+ attr_accessor :status
23
+
24
+ # The transaction history of this POLi Link
25
+ # @return [Array[PoliLinkPaymentsResponseTransactionsItems]]
26
+ attr_accessor :transactions
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['total_amount'] = 'TotalAmount'
32
+ @_hash['total_paid_amount'] = 'TotalPaidAmount'
33
+ @_hash['status'] = 'Status'
34
+ @_hash['transactions'] = 'Transactions'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ %w[
41
+ total_amount
42
+ total_paid_amount
43
+ status
44
+ transactions
45
+ ]
46
+ end
47
+
48
+ # An array for nullable fields
49
+ def self.nullables
50
+ []
51
+ end
52
+
53
+ def initialize(total_amount: SKIP, total_paid_amount: SKIP, status: SKIP,
54
+ transactions: SKIP, additional_properties: nil)
55
+ # Add additional model properties to the instance
56
+ additional_properties = {} if additional_properties.nil?
57
+
58
+ @total_amount = total_amount unless total_amount == SKIP
59
+ @total_paid_amount = total_paid_amount unless total_paid_amount == SKIP
60
+ @status = status unless status == SKIP
61
+ @transactions = transactions unless transactions == SKIP
62
+ @additional_properties = additional_properties
63
+ end
64
+
65
+ # Creates an instance of the object from a hash.
66
+ def self.from_hash(hash)
67
+ return nil unless hash
68
+
69
+ # Extract variables from the hash.
70
+ total_amount = hash.key?('TotalAmount') ? hash['TotalAmount'] : SKIP
71
+ total_paid_amount =
72
+ hash.key?('TotalPaidAmount') ? hash['TotalPaidAmount'] : SKIP
73
+ status = hash.key?('Status') ? hash['Status'] : SKIP
74
+ # Parameter is an array, so we need to iterate through it
75
+ transactions = nil
76
+ unless hash['Transactions'].nil?
77
+ transactions = []
78
+ hash['Transactions'].each do |structure|
79
+ transactions << (PoliLinkPaymentsResponseTransactionsItems.from_hash(structure) if structure)
80
+ end
81
+ end
82
+
83
+ transactions = SKIP unless hash.key?('Transactions')
84
+
85
+ # Create a new hash for additional properties, removing known properties.
86
+ new_hash = hash.reject { |k, _| names.value?(k) }
87
+
88
+ additional_properties = APIHelper.get_additional_properties(
89
+ new_hash, proc { |value| value }
90
+ )
91
+
92
+ # Create object from extracted values.
93
+ PoliLinkPaymentsResponse.new(total_amount: total_amount,
94
+ total_paid_amount: total_paid_amount,
95
+ status: status,
96
+ transactions: transactions,
97
+ additional_properties: additional_properties)
98
+ end
99
+
100
+ # Provides a human-readable string representation of the object.
101
+ def to_s
102
+ class_name = self.class.name.split('::').last
103
+ "<#{class_name} total_amount: #{@total_amount}, total_paid_amount: #{@total_paid_amount},"\
104
+ " status: #{@status}, transactions: #{@transactions}, additional_properties:"\
105
+ " #{@additional_properties}>"
106
+ end
107
+
108
+ # Provides a debugging-friendly string with detailed object information.
109
+ def inspect
110
+ class_name = self.class.name.split('::').last
111
+ "<#{class_name} total_amount: #{@total_amount.inspect}, total_paid_amount:"\
112
+ " #{@total_paid_amount.inspect}, status: #{@status.inspect}, transactions:"\
113
+ " #{@transactions.inspect}, additional_properties: #{@additional_properties}>"
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,48 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # Status of the POLi Link
8
+ class PoliLinkPaymentsResponseStatus
9
+ POLI_LINK_PAYMENTS_RESPONSE_STATUS = [
10
+ # TODO: Write general description for UNUSED
11
+ UNUSED = 'Unused'.freeze,
12
+
13
+ # TODO: Write general description for ACTIVATED
14
+ ACTIVATED = 'Activated'.freeze,
15
+
16
+ # TODO: Write general description for PARTPAID
17
+ PARTPAID = 'PartPaid'.freeze,
18
+
19
+ # TODO: Write general description for FUTURE
20
+ FUTURE = 'Future'.freeze,
21
+
22
+ # TODO: Write general description for COMPLETED
23
+ COMPLETED = 'Completed'.freeze
24
+ ].freeze
25
+
26
+ def self.validate(value)
27
+ return false if value.nil?
28
+
29
+ POLI_LINK_PAYMENTS_RESPONSE_STATUS.include?(value)
30
+ end
31
+
32
+ def self.from_value(value, default_value = UNUSED)
33
+ return default_value if value.nil?
34
+
35
+ str = value.to_s.strip
36
+
37
+ case str.downcase
38
+ when 'unused' then UNUSED
39
+ when 'activated' then ACTIVATED
40
+ when 'partpaid' then PARTPAID
41
+ when 'future' then FUTURE
42
+ when 'completed' then COMPLETED
43
+ else
44
+ default_value
45
+ end
46
+ end
47
+ end
48
+ end