Class: CyberSourceMergedSpec::SubscriptionPayment

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/subscription_payment.rb

Overview

SubscriptionPayment Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(id: SKIP, status: SKIP, payment_type: SKIP, transaction_id: SKIP, date: SKIP, currency: SKIP, billing_start_date: SKIP, billing_end_date: SKIP, billing_cycle: SKIP, payment_number: SKIP, billing_amount: SKIP, setup_fee: SKIP, surcharge_amount: SKIP, surcharge_description: SKIP, modifiable: SKIP, additional_properties: nil) ⇒ SubscriptionPayment

Returns a new instance of SubscriptionPayment.



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 170

def initialize(id: SKIP, status: SKIP, payment_type: SKIP,
               transaction_id: SKIP, date: SKIP, currency: SKIP,
               billing_start_date: SKIP, billing_end_date: SKIP,
               billing_cycle: SKIP, payment_number: SKIP,
               billing_amount: SKIP, setup_fee: SKIP,
               surcharge_amount: SKIP, surcharge_description: SKIP,
               modifiable: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id unless id == SKIP
  @status = status unless status == SKIP
  @payment_type = payment_type unless payment_type == SKIP
  @transaction_id = transaction_id unless transaction_id == SKIP
  @date = date unless date == SKIP
  @currency = currency unless currency == SKIP
  @billing_start_date = billing_start_date unless billing_start_date == SKIP
  @billing_end_date = billing_end_date unless billing_end_date == SKIP
  @billing_cycle = billing_cycle unless billing_cycle == SKIP
  @payment_number = payment_number unless payment_number == SKIP
  @billing_amount = billing_amount unless billing_amount == SKIP
  @setup_fee = setup_fee unless setup_fee == SKIP
  @surcharge_amount = surcharge_amount unless surcharge_amount == SKIP
  @surcharge_description = surcharge_description unless surcharge_description == SKIP
  @modifiable = modifiable unless modifiable == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#billing_amountString

The amount billed for this payment.

Returns:

  • (String)


104
105
106
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 104

def billing_amount
  @billing_amount
end

#billing_cycleString

The billing cycle number.

Returns:

  • (String)


96
97
98
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 96

def billing_cycle
  @billing_cycle
end

#billing_end_dateDateTime

The end date of the billing cycle for this payment.

Returns:

  • (DateTime)


92
93
94
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 92

def billing_end_date
  @billing_end_date
end

#billing_start_dateDateTime

The start date of the billing cycle for this payment.

Returns:

  • (DateTime)


88
89
90
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 88

def billing_start_date
  @billing_start_date
end

#currencyString

Currency used for the order. Use the three-character [ISO Standard Currency Codes.](http://apps.cybersource.com/library/documentation/sbc/quickref/cur rencies.pdf)

Used by

Authorization Required field. Authorization Reversal For an authorization reversal (reversalInformation) or a capture (processingOptions.capture is set to true), you must use the same currency that you used in your payment authorization request.

PIN Debit

Currency for the amount you requested for the PIN debit purchase. This value is returned for partial authorizations. The issuing bank can approve a partial amount if the balance on the debit card is less than the requested transaction amount. For the possible values, see the [ISO Standard Currency Codes](https://developer.cybersource.com/library/documentation/sbc/quickre f/currencies.pdf). Returned by PIN debit purchase. For PIN debit reversal requests, you must use the same currency that was used for the PIN debit purchase or PIN debit credit that you are reversing. For the possible values, see the [ISO Standard Currency Codes](https://developer.cybersource.com/library/documentation/sbc/quickre f/currencies.pdf). Required field for PIN Debit purchase and PIN Debit credit requests. Optional field for PIN Debit reversal requests.

GPX

This field is optional for reversing an authorization or credit.

DCC for First Data

Your local currency.

Tax Calculation

Required for international tax and value added tax only. Optional for U.S. and Canadian taxes. Your local currency.

Returns:

  • (String)


84
85
86
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 84

def currency
  @currency
end

#dateDateTime

The date and time of the payment processing.

Returns:

  • (DateTime)


45
46
47
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 45

def date
  @date
end

#idString

Identifier assigned by Recurring Billing to uniquely reference this billing cycle’s payment, distinct from the Cybersource transactionID.

Returns:

  • (String)


16
17
18
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 16

def id
  @id
end

#modifiableTrueClass | FalseClass

Indicates if the payment is modifiable, meaning it can be skipped or restored.

Returns:

  • (TrueClass | FalseClass)


121
122
123
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 121

def modifiable
  @modifiable
end

#payment_numberString

The sequential number of the payment in the subscription.

Returns:

  • (String)


100
101
102
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 100

def payment_number
  @payment_number
end

#payment_typeString

The type of payment. Possible values:

  • STANDARD
  • RETRY

Returns:

  • (String)


33
34
35
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 33

def payment_type
  @payment_type
end

#setup_feeString

The setup fee associated with the payment.

Returns:

  • (String)


108
109
110
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 108

def setup_fee
  @setup_fee
end

#statusString

The current status of the payment. Possible values:

- SCHEDULED 
- PAID
- FAILED
- SKIPPED
- SCHEDULED_SKIPPED

Returns:

  • (String)


26
27
28
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 26

def status
  @status
end

#surcharge_amountString

The surcharge amount, if any.

Returns:

  • (String)


112
113
114
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 112

def surcharge_amount
  @surcharge_amount
end

#surcharge_descriptionString

The description for the surcharge.

Returns:

  • (String)


116
117
118
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 116

def surcharge_description
  @surcharge_description
end

#transaction_idString

An unique identification number generated by Cybersource to identify the submitted request. Returned by all services. It is also appended to the endpoint of the resource. On incremental authorizations, this value with be the same as the identification number returned in the original authorization response.

Returns:

  • (String)


41
42
43
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 41

def transaction_id
  @transaction_id
end

Class Method Details

.from_element(root) ⇒ Object



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 271

def self.from_element(root)
  id = XmlUtilities.from_element(root, 'id', String)
  status = XmlUtilities.from_element(root, 'status', String)
  payment_type = XmlUtilities.from_element(root, 'paymentType', String)
  transaction_id = XmlUtilities.from_element(root, 'transactionID', String)
  date = XmlUtilities.from_element(root, 'date', String,
                                   datetime_format: 'rfc3339')
  currency = XmlUtilities.from_element(root, 'currency', String)
  billing_start_date = XmlUtilities.from_element(root, 'billingStartDate',
                                                 String,
                                                 datetime_format: 'rfc3339')
  billing_end_date = XmlUtilities.from_element(root, 'billingEndDate',
                                               String,
                                               datetime_format: 'rfc3339')
  billing_cycle = XmlUtilities.from_element(root, 'billingCycle', String)
  payment_number = XmlUtilities.from_element(root, 'paymentNumber', String)
  billing_amount = XmlUtilities.from_element(root, 'billingAmount', String)
  setup_fee = XmlUtilities.from_element(root, 'setupFee', String)
  surcharge_amount = XmlUtilities.from_element(root, 'surchargeAmount',
                                               String)
  surcharge_description = XmlUtilities.from_element(root,
                                                    'surchargeDescription',
                                                    String)
  modifiable = XmlUtilities.from_element(root, 'modifiable', TrueClass)

  new(id: id,
      status: status,
      payment_type: payment_type,
      transaction_id: transaction_id,
      date: date,
      currency: currency,
      billing_start_date: billing_start_date,
      billing_end_date: billing_end_date,
      billing_cycle: billing_cycle,
      payment_number: payment_number,
      billing_amount: billing_amount,
      setup_fee: setup_fee,
      surcharge_amount: surcharge_amount,
      surcharge_description: surcharge_description,
      modifiable: modifiable,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 199

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  payment_type = hash.key?('paymentType') ? hash['paymentType'] : SKIP
  transaction_id = hash.key?('transactionID') ? hash['transactionID'] : SKIP
  date = if hash.key?('date')
           (DateTimeHelper.from_rfc3339(hash['date']) if hash['date'])
         else
           SKIP
         end
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  billing_start_date = if hash.key?('billingStartDate')
                         (DateTimeHelper.from_rfc3339(hash['billingStartDate']) if hash['billingStartDate'])
                       else
                         SKIP
                       end
  billing_end_date = if hash.key?('billingEndDate')
                       (DateTimeHelper.from_rfc3339(hash['billingEndDate']) if hash['billingEndDate'])
                     else
                       SKIP
                     end
  billing_cycle = hash.key?('billingCycle') ? hash['billingCycle'] : SKIP
  payment_number = hash.key?('paymentNumber') ? hash['paymentNumber'] : SKIP
  billing_amount = hash.key?('billingAmount') ? hash['billingAmount'] : SKIP
  setup_fee = hash.key?('setupFee') ? hash['setupFee'] : SKIP
  surcharge_amount =
    hash.key?('surchargeAmount') ? hash['surchargeAmount'] : SKIP
  surcharge_description =
    hash.key?('surchargeDescription') ? hash['surchargeDescription'] : SKIP
  modifiable = hash.key?('modifiable') ? hash['modifiable'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  SubscriptionPayment.new(id: id,
                          status: status,
                          payment_type: payment_type,
                          transaction_id: transaction_id,
                          date: date,
                          currency: currency,
                          billing_start_date: billing_start_date,
                          billing_end_date: billing_end_date,
                          billing_cycle: billing_cycle,
                          payment_number: payment_number,
                          billing_amount: billing_amount,
                          setup_fee: setup_fee,
                          surcharge_amount: surcharge_amount,
                          surcharge_description: surcharge_description,
                          modifiable: modifiable,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 124

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['status'] = 'status'
  @_hash['payment_type'] = 'paymentType'
  @_hash['transaction_id'] = 'transactionID'
  @_hash['date'] = 'date'
  @_hash['currency'] = 'currency'
  @_hash['billing_start_date'] = 'billingStartDate'
  @_hash['billing_end_date'] = 'billingEndDate'
  @_hash['billing_cycle'] = 'billingCycle'
  @_hash['payment_number'] = 'paymentNumber'
  @_hash['billing_amount'] = 'billingAmount'
  @_hash['setup_fee'] = 'setupFee'
  @_hash['surcharge_amount'] = 'surchargeAmount'
  @_hash['surcharge_description'] = 'surchargeDescription'
  @_hash['modifiable'] = 'modifiable'
  @_hash
end

.nullablesObject

An array for nullable fields



166
167
168
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 166

def self.nullables
  []
end

.optionalsObject

An array for optional fields



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 145

def self.optionals
  %w[
    id
    status
    payment_type
    transaction_id
    date
    currency
    billing_start_date
    billing_end_date
    billing_cycle
    payment_number
    billing_amount
    setup_fee
    surcharge_amount
    surcharge_description
    modifiable
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 358

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, status: #{@status.inspect}, payment_type:"\
  " #{@payment_type.inspect}, transaction_id: #{@transaction_id.inspect}, date:"\
  " #{@date.inspect}, currency: #{@currency.inspect}, billing_start_date:"\
  " #{@billing_start_date.inspect}, billing_end_date: #{@billing_end_date.inspect},"\
  " billing_cycle: #{@billing_cycle.inspect}, payment_number: #{@payment_number.inspect},"\
  " billing_amount: #{@billing_amount.inspect}, setup_fee: #{@setup_fee.inspect},"\
  " surcharge_amount: #{@surcharge_amount.inspect}, surcharge_description:"\
  " #{@surcharge_description.inspect}, modifiable: #{@modifiable.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_billing_end_dateObject



267
268
269
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 267

def to_custom_billing_end_date
  DateTimeHelper.to_rfc3339(billing_end_date)
end

#to_custom_billing_start_dateObject



263
264
265
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 263

def to_custom_billing_start_date
  DateTimeHelper.to_rfc3339(billing_start_date)
end

#to_custom_dateObject



259
260
261
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 259

def to_custom_date
  DateTimeHelper.to_rfc3339(date)
end

#to_sObject

Provides a human-readable string representation of the object.



346
347
348
349
350
351
352
353
354
355
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 346

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, status: #{@status}, payment_type: #{@payment_type},"\
  " transaction_id: #{@transaction_id}, date: #{@date}, currency: #{@currency},"\
  " billing_start_date: #{@billing_start_date}, billing_end_date: #{@billing_end_date},"\
  " billing_cycle: #{@billing_cycle}, payment_number: #{@payment_number}, billing_amount:"\
  " #{@billing_amount}, setup_fee: #{@setup_fee}, surcharge_amount: #{@surcharge_amount},"\
  " surcharge_description: #{@surcharge_description}, modifiable: #{@modifiable},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/cyber_source_merged_spec/models/subscription_payment.rb', line 314

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'id', id)
  XmlUtilities.add_as_subelement(doc, root, 'status', status)
  XmlUtilities.add_as_subelement(doc, root, 'paymentType', payment_type)
  XmlUtilities.add_as_subelement(doc, root, 'transactionID', transaction_id)
  XmlUtilities.add_as_subelement(doc, root, 'date', date,
                                 datetime_format: 'rfc3339')
  XmlUtilities.add_as_subelement(doc, root, 'currency', currency)
  XmlUtilities.add_as_subelement(doc, root, 'billingStartDate',
                                 billing_start_date,
                                 datetime_format: 'rfc3339')
  XmlUtilities.add_as_subelement(doc, root, 'billingEndDate',
                                 billing_end_date,
                                 datetime_format: 'rfc3339')
  XmlUtilities.add_as_subelement(doc, root, 'billingCycle', billing_cycle)
  XmlUtilities.add_as_subelement(doc, root, 'paymentNumber', payment_number)
  XmlUtilities.add_as_subelement(doc, root, 'billingAmount', billing_amount)
  XmlUtilities.add_as_subelement(doc, root, 'setupFee', setup_fee)
  XmlUtilities.add_as_subelement(doc, root, 'surchargeAmount',
                                 surcharge_amount)
  XmlUtilities.add_as_subelement(doc, root, 'surchargeDescription',
                                 surcharge_description)
  XmlUtilities.add_as_subelement(doc, root, 'modifiable', modifiable)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end