Class: PaypalServerSdk::P24PaymentObject

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

Overview

Information used to pay using P24(Przelewy24).

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, email: SKIP, country_code: SKIP, payment_descriptor: SKIP, method_id: SKIP, method_description: SKIP) ⇒ P24PaymentObject

Returns a new instance of P24PaymentObject.



72
73
74
75
76
77
78
79
80
81
# File 'lib/paypal_server_sdk/models/p24_payment_object.rb', line 72

def initialize(name: SKIP, email: SKIP, country_code: SKIP,
               payment_descriptor: SKIP, method_id: SKIP,
               method_description: SKIP)
  @name = name unless name == SKIP
  @email = email unless email == SKIP
  @country_code = country_code unless country_code == SKIP
  @payment_descriptor = payment_descriptor unless payment_descriptor == SKIP
  @method_id = method_id unless method_id == SKIP
  @method_description = method_description unless method_description == SKIP
end

Instance Attribute Details

#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)


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

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)


21
22
23
# File 'lib/paypal_server_sdk/models/p24_payment_object.rb', line 21

def email
  @email
end

#method_descriptionString

Friendly name of the payment scheme or bank used for the payment.

Returns:

  • (String)


41
42
43
# File 'lib/paypal_server_sdk/models/p24_payment_object.rb', line 41

def method_description
  @method_description
end

#method_idString

Numeric identifier of the payment scheme or bank used for the payment.

Returns:

  • (String)


37
38
39
# File 'lib/paypal_server_sdk/models/p24_payment_object.rb', line 37

def method_id
  @method_id
end

#nameString

The full name representation like Mr J Smith.

Returns:

  • (String)


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

def name
  @name
end

#payment_descriptorString

P24 generated payment description.

Returns:

  • (String)


33
34
35
# File 'lib/paypal_server_sdk/models/p24_payment_object.rb', line 33

def payment_descriptor
  @payment_descriptor
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/paypal_server_sdk/models/p24_payment_object.rb', line 84

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP
  country_code = hash.key?('country_code') ? hash['country_code'] : SKIP
  payment_descriptor =
    hash.key?('payment_descriptor') ? hash['payment_descriptor'] : SKIP
  method_id = hash.key?('method_id') ? hash['method_id'] : SKIP
  method_description =
    hash.key?('method_description') ? hash['method_description'] : SKIP

  # Create object from extracted values.
  P24PaymentObject.new(name: name,
                       email: email,
                       country_code: country_code,
                       payment_descriptor: payment_descriptor,
                       method_id: method_id,
                       method_description: method_description)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
51
52
53
# File 'lib/paypal_server_sdk/models/p24_payment_object.rb', line 44

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['email'] = 'email'
  @_hash['country_code'] = 'country_code'
  @_hash['payment_descriptor'] = 'payment_descriptor'
  @_hash['method_id'] = 'method_id'
  @_hash['method_description'] = 'method_description'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
# File 'lib/paypal_server_sdk/models/p24_payment_object.rb', line 68

def self.nullables
  []
end

.optionalsObject

An array for optional fields



56
57
58
59
60
61
62
63
64
65
# File 'lib/paypal_server_sdk/models/p24_payment_object.rb', line 56

def self.optionals
  %w[
    name
    email
    country_code
    payment_descriptor
    method_id
    method_description
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



107
108
109
110
111
112
# File 'lib/paypal_server_sdk/models/p24_payment_object.rb', line 107

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