Class: OCI::OspGateway::Models::PaypalPaymentOption

Inherits:
PaymentOption
  • Object
show all
Defined in:
lib/oci/osp_gateway/models/paypal_payment_option.rb

Overview

PayPal Payment related details

Constant Summary

Constants inherited from PaymentOption

OCI::OspGateway::Models::PaymentOption::PAYMENT_METHOD_ENUM

Instance Attribute Summary collapse

Attributes inherited from PaymentOption

#payment_method, #wallet_instrument_id, #wallet_transaction_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PaymentOption

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ PaypalPaymentOption

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



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
103
# File 'lib/oci/osp_gateway/models/paypal_payment_option.rb', line 70

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['paymentMethod'] = 'PAYPAL'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.email_address = attributes[:'emailAddress'] if attributes[:'emailAddress']

  raise 'You cannot provide both :emailAddress and :email_address' if attributes.key?(:'emailAddress') && attributes.key?(:'email_address')

  self.email_address = attributes[:'email_address'] if attributes[:'email_address']

  self.first_name = attributes[:'firstName'] if attributes[:'firstName']

  raise 'You cannot provide both :firstName and :first_name' if attributes.key?(:'firstName') && attributes.key?(:'first_name')

  self.first_name = attributes[:'first_name'] if attributes[:'first_name']

  self.last_name = attributes[:'lastName'] if attributes[:'lastName']

  raise 'You cannot provide both :lastName and :last_name' if attributes.key?(:'lastName') && attributes.key?(:'last_name')

  self.last_name = attributes[:'last_name'] if attributes[:'last_name']

  self.ext_billing_agreement_id = attributes[:'extBillingAgreementId'] if attributes[:'extBillingAgreementId']

  raise 'You cannot provide both :extBillingAgreementId and :ext_billing_agreement_id' if attributes.key?(:'extBillingAgreementId') && attributes.key?(:'ext_billing_agreement_id')

  self.ext_billing_agreement_id = attributes[:'ext_billing_agreement_id'] if attributes[:'ext_billing_agreement_id']
end

Instance Attribute Details

#email_addressString

The email address of the paypal user.

Returns:

  • (String)


14
15
16
# File 'lib/oci/osp_gateway/models/paypal_payment_option.rb', line 14

def email_address
  @email_address
end

#ext_billing_agreement_idString

Agreement id for the paypal account.

Returns:

  • (String)


26
27
28
# File 'lib/oci/osp_gateway/models/paypal_payment_option.rb', line 26

def ext_billing_agreement_id
  @ext_billing_agreement_id
end

#first_nameString

First name of the paypal user.

Returns:

  • (String)


18
19
20
# File 'lib/oci/osp_gateway/models/paypal_payment_option.rb', line 18

def first_name
  @first_name
end

#last_nameString

Last name of the paypal user.

Returns:

  • (String)


22
23
24
# File 'lib/oci/osp_gateway/models/paypal_payment_option.rb', line 22

def last_name
  @last_name
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/oci/osp_gateway/models/paypal_payment_option.rb', line 29

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'wallet_instrument_id': :'walletInstrumentId',
    'wallet_transaction_id': :'walletTransactionId',
    'payment_method': :'paymentMethod',
    'email_address': :'emailAddress',
    'first_name': :'firstName',
    'last_name': :'lastName',
    'ext_billing_agreement_id': :'extBillingAgreementId'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/oci/osp_gateway/models/paypal_payment_option.rb', line 44

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'wallet_instrument_id': :'String',
    'wallet_transaction_id': :'String',
    'payment_method': :'String',
    'email_address': :'String',
    'first_name': :'String',
    'last_name': :'String',
    'ext_billing_agreement_id': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/oci/osp_gateway/models/paypal_payment_option.rb', line 112

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    wallet_instrument_id == other.wallet_instrument_id &&
    wallet_transaction_id == other.wallet_transaction_id &&
    payment_method == other.payment_method &&
    email_address == other.email_address &&
    first_name == other.first_name &&
    last_name == other.last_name &&
    ext_billing_agreement_id == other.ext_billing_agreement_id
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/oci/osp_gateway/models/paypal_payment_option.rb', line 148

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


128
129
130
# File 'lib/oci/osp_gateway/models/paypal_payment_option.rb', line 128

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



137
138
139
# File 'lib/oci/osp_gateway/models/paypal_payment_option.rb', line 137

def hash
  [wallet_instrument_id, wallet_transaction_id, payment_method, email_address, first_name, last_name, ext_billing_agreement_id].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



181
182
183
184
185
186
187
188
189
190
# File 'lib/oci/osp_gateway/models/paypal_payment_option.rb', line 181

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



175
176
177
# File 'lib/oci/osp_gateway/models/paypal_payment_option.rb', line 175

def to_s
  to_hash.to_s
end