Class: FdxV660Api::PaymentInitiationPartyToPaymentMethodEntity

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/payment_initiation_party_to_payment_method_entity.rb

Overview

Registration between a payment initiation party and a Payment Method

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(registration_id: SKIP, payment_method: SKIP, account: SKIP, locations: SKIP, additional_properties: nil) ⇒ PaymentInitiationPartyToPaymentMethodEntity

Returns a new instance of PaymentInitiationPartyToPaymentMethodEntity.



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/fdx_v660_api/models/payment_initiation_party_to_payment_method_entity.rb', line 54

def initialize(registration_id: SKIP, payment_method: SKIP, account: SKIP,
               locations: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @registration_id = registration_id unless registration_id == SKIP
  @payment_method = payment_method unless payment_method == SKIP
  @account =  unless  == SKIP
  @locations = locations unless locations == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#accountObject

Account details

Returns:

  • (Object)


22
23
24
# File 'lib/fdx_v660_api/models/payment_initiation_party_to_payment_method_entity.rb', line 22

def 
  @account
end

#locationsArray[PaymentDeliveryAddressEntity]

Address associated with the payment method registration of a payment initiation party

Returns:



27
28
29
# File 'lib/fdx_v660_api/models/payment_initiation_party_to_payment_method_entity.rb', line 27

def locations
  @locations
end

#payment_methodPaymentMethodEntity2

Payment method details



18
19
20
# File 'lib/fdx_v660_api/models/payment_initiation_party_to_payment_method_entity.rb', line 18

def payment_method
  @payment_method
end

#registration_idString

Registration ID

Returns:

  • (String)


14
15
16
# File 'lib/fdx_v660_api/models/payment_initiation_party_to_payment_method_entity.rb', line 14

def registration_id
  @registration_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/fdx_v660_api/models/payment_initiation_party_to_payment_method_entity.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  registration_id =
    hash.key?('registrationId') ? hash['registrationId'] : SKIP
  payment_method = PaymentMethodEntity2.from_hash(hash['paymentMethod']) if
    hash['paymentMethod']
   = hash.key?('account') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:PaymentInitiationPartyToPaymentMethodEntityAccount), hash['account']
  ) : SKIP
  # Parameter is an array, so we need to iterate through it
  locations = nil
  unless hash['locations'].nil?
    locations = []
    hash['locations'].each do |structure|
      locations << (PaymentDeliveryAddressEntity.from_hash(structure) if structure)
    end
  end

  locations = SKIP unless hash.key?('locations')

  # 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.
  PaymentInitiationPartyToPaymentMethodEntity.new(registration_id: registration_id,
                                                  payment_method: payment_method,
                                                  account: ,
                                                  locations: locations,
                                                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/fdx_v660_api/models/payment_initiation_party_to_payment_method_entity.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['registration_id'] = 'registrationId'
  @_hash['payment_method'] = 'paymentMethod'
  @_hash['account'] = 'account'
  @_hash['locations'] = 'locations'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/fdx_v660_api/models/payment_initiation_party_to_payment_method_entity.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
47
# File 'lib/fdx_v660_api/models/payment_initiation_party_to_payment_method_entity.rb', line 40

def self.optionals
  %w[
    registration_id
    payment_method
    account
    locations
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



106
107
108
109
110
111
112
# File 'lib/fdx_v660_api/models/payment_initiation_party_to_payment_method_entity.rb', line 106

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



123
124
125
126
127
128
# File 'lib/fdx_v660_api/models/payment_initiation_party_to_payment_method_entity.rb', line 123

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} registration_id: #{@registration_id.inspect}, payment_method:"\
  " #{@payment_method.inspect}, account: #{@account.inspect}, locations:"\
  " #{@locations.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



115
116
117
118
119
120
# File 'lib/fdx_v660_api/models/payment_initiation_party_to_payment_method_entity.rb', line 115

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} registration_id: #{@registration_id}, payment_method: #{@payment_method},"\
  " account: #{@account}, locations: #{@locations}, additional_properties:"\
  " #{@additional_properties}>"
end