Class: ThePlaidApi::ExternalPaymentScheduleBase

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/external_payment_schedule_base.rb

Overview

The schedule that the payment will be executed on. If a schedule is provided, the payment is automatically set up as a standing order. If no schedule is specified, the payment will be executed only once.

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(interval: SKIP, interval_execution_day: SKIP, start_date: SKIP, end_date: SKIP, adjusted_start_date: SKIP, additional_properties: nil) ⇒ ExternalPaymentScheduleBase

Returns a new instance of ExternalPaymentScheduleBase.



87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/the_plaid_api/models/external_payment_schedule_base.rb', line 87

def initialize(interval: SKIP, interval_execution_day: SKIP,
               start_date: SKIP, end_date: SKIP, adjusted_start_date: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @interval = interval unless interval == SKIP
  @interval_execution_day = interval_execution_day unless interval_execution_day == SKIP
  @start_date = start_date unless start_date == SKIP
  @end_date = end_date unless end_date == SKIP
  @adjusted_start_date = adjusted_start_date unless adjusted_start_date == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#adjusted_start_dateDate

The start date sent to the bank after adjusting for holidays or weekends. Will be provided in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD). If the start date did not require adjustment, this field will be ‘null`.

Returns:

  • (Date)


55
56
57
# File 'lib/the_plaid_api/models/external_payment_schedule_base.rb', line 55

def adjusted_start_date
  @adjusted_start_date
end

#end_dateDate

A date in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD). Standing order payments will end on the last ‘interval_execution_day` on or before the `end_date`. If the only `interval_execution_day` between the start date and the end date (inclusive) is also the same day that `/payment_initiation/payment/create` was called, the bank may make a payment on that day, but it is not guaranteed to do so.

Returns:

  • (Date)


48
49
50
# File 'lib/the_plaid_api/models/external_payment_schedule_base.rb', line 48

def end_date
  @end_date
end

#intervalPaymentScheduleInterval

The frequency interval of the payment.



16
17
18
# File 'lib/the_plaid_api/models/external_payment_schedule_base.rb', line 16

def interval
  @interval
end

#interval_execution_dayInteger

The day of the interval on which to schedule the payment. If the payment interval is weekly, ‘interval_execution_day` should be an integer from 1 (Monday) to 7 (Sunday). If the payment interval is monthly, `interval_execution_day` should be an integer indicating which day of the month to make the payment on. Integers from 1 to 28 can be used to make a payment on that day of the month. Negative integers from -1 to -5 can be used to make a payment relative to the end of the month. To make a payment on the last day of the month, use -1; to make the payment on the second-to-last day, use -2, and so on.

Returns:

  • (Integer)


28
29
30
# File 'lib/the_plaid_api/models/external_payment_schedule_base.rb', line 28

def interval_execution_day
  @interval_execution_day
end

#start_dateDate

A date in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD). Standing order payments will begin on the first ‘interval_execution_day` on or after the `start_date`. If the first `interval_execution_day` on or after the start date is also the same day that `/payment_initiation/payment/create` was called, the bank may make the first payment on that day, but it is not guaranteed to do so.

Returns:

  • (Date)


38
39
40
# File 'lib/the_plaid_api/models/external_payment_schedule_base.rb', line 38

def start_date
  @start_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/the_plaid_api/models/external_payment_schedule_base.rb', line 102

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  interval = hash.key?('interval') ? hash['interval'] : SKIP
  interval_execution_day =
    hash.key?('interval_execution_day') ? hash['interval_execution_day'] : SKIP
  start_date = hash.key?('start_date') ? hash['start_date'] : SKIP
  end_date = hash.key?('end_date') ? hash['end_date'] : SKIP
  adjusted_start_date =
    hash.key?('adjusted_start_date') ? hash['adjusted_start_date'] : 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.
  ExternalPaymentScheduleBase.new(interval: interval,
                                  interval_execution_day: interval_execution_day,
                                  start_date: start_date,
                                  end_date: end_date,
                                  adjusted_start_date: adjusted_start_date,
                                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



58
59
60
61
62
63
64
65
66
# File 'lib/the_plaid_api/models/external_payment_schedule_base.rb', line 58

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['interval'] = 'interval'
  @_hash['interval_execution_day'] = 'interval_execution_day'
  @_hash['start_date'] = 'start_date'
  @_hash['end_date'] = 'end_date'
  @_hash['adjusted_start_date'] = 'adjusted_start_date'
  @_hash
end

.nullablesObject

An array for nullable fields



80
81
82
83
84
85
# File 'lib/the_plaid_api/models/external_payment_schedule_base.rb', line 80

def self.nullables
  %w[
    end_date
    adjusted_start_date
  ]
end

.optionalsObject

An array for optional fields



69
70
71
72
73
74
75
76
77
# File 'lib/the_plaid_api/models/external_payment_schedule_base.rb', line 69

def self.optionals
  %w[
    interval
    interval_execution_day
    start_date
    end_date
    adjusted_start_date
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



139
140
141
142
143
144
145
# File 'lib/the_plaid_api/models/external_payment_schedule_base.rb', line 139

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} interval: #{@interval.inspect}, interval_execution_day:"\
  " #{@interval_execution_day.inspect}, start_date: #{@start_date.inspect}, end_date:"\
  " #{@end_date.inspect}, adjusted_start_date: #{@adjusted_start_date.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



131
132
133
134
135
136
# File 'lib/the_plaid_api/models/external_payment_schedule_base.rb', line 131

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} interval: #{@interval}, interval_execution_day: #{@interval_execution_day},"\
  " start_date: #{@start_date}, end_date: #{@end_date}, adjusted_start_date:"\
  " #{@adjusted_start_date}, additional_properties: #{@additional_properties}>"
end