Class: PaypalServerSdk::TrustlyPaymentObject

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/trustly_payment_object.rb

Overview

Information needed to pay using Trustly.

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(name: SKIP, country_code: SKIP, email: SKIP, bic: SKIP, iban_last_chars: SKIP) ⇒ TrustlyPaymentObject

Returns a new instance of TrustlyPaymentObject.



67
68
69
70
71
72
73
74
# File 'lib/paypal_server_sdk/models/trustly_payment_object.rb', line 67

def initialize(name: SKIP, country_code: SKIP, email: SKIP, bic: SKIP,
               iban_last_chars: SKIP)
  @name = name unless name == SKIP
  @country_code = country_code unless country_code == SKIP
  @email = email unless email == SKIP
  @bic = bic unless bic == SKIP
  @iban_last_chars = iban_last_chars unless iban_last_chars == SKIP
end

Instance Attribute Details

#bicString

The business identification code (BIC). In payments systems, a BIC is used to identify a specific business, most commonly a bank.

Returns:

  • (String)


34
35
36
# File 'lib/paypal_server_sdk/models/trustly_payment_object.rb', line 34

def bic
  @bic
end

#country_codeString

The [two-character ISO 3166-1 code](/api/rest/reference/country-codes/) that identifies the country or region. Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the ‘C2` country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.

Returns:

  • (String)


22
23
24
# File 'lib/paypal_server_sdk/models/trustly_payment_object.rb', line 22

def country_code
  @country_code
end

#emailString

The internationalized email address. Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.

Returns:

  • (String)


29
30
31
# File 'lib/paypal_server_sdk/models/trustly_payment_object.rb', line 29

def email
  @email
end

#iban_last_charsString

The last characters of the IBAN used to pay.

Returns:

  • (String)


38
39
40
# File 'lib/paypal_server_sdk/models/trustly_payment_object.rb', line 38

def iban_last_chars
  @iban_last_chars
end

#nameString

The full name representation like Mr J Smith.

Returns:

  • (String)


14
15
16
# File 'lib/paypal_server_sdk/models/trustly_payment_object.rb', line 14

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/paypal_server_sdk/models/trustly_payment_object.rb', line 77

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  name = hash.key?('name') ? hash['name'] : SKIP
  country_code = hash.key?('country_code') ? hash['country_code'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP
  bic = hash.key?('bic') ? hash['bic'] : SKIP
  iban_last_chars =
    hash.key?('iban_last_chars') ? hash['iban_last_chars'] : SKIP

  # Create object from extracted values.

  TrustlyPaymentObject.new(name: name,
                           country_code: country_code,
                           email: email,
                           bic: bic,
                           iban_last_chars: iban_last_chars)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
# File 'lib/paypal_server_sdk/models/trustly_payment_object.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['country_code'] = 'country_code'
  @_hash['email'] = 'email'
  @_hash['bic'] = 'bic'
  @_hash['iban_last_chars'] = 'iban_last_chars'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/paypal_server_sdk/models/trustly_payment_object.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



52
53
54
55
56
57
58
59
60
# File 'lib/paypal_server_sdk/models/trustly_payment_object.rb', line 52

def self.optionals
  %w[
    name
    country_code
    email
    bic
    iban_last_chars
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



104
105
106
107
108
# File 'lib/paypal_server_sdk/models/trustly_payment_object.rb', line 104

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, country_code: #{@country_code.inspect}, email:"\
  " #{@email.inspect}, bic: #{@bic.inspect}, iban_last_chars: #{@iban_last_chars.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



97
98
99
100
101
# File 'lib/paypal_server_sdk/models/trustly_payment_object.rb', line 97

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name}, country_code: #{@country_code}, email: #{@email}, bic:"\
  " #{@bic}, iban_last_chars: #{@iban_last_chars}>"
end