Class: PaypalServerSdk::BlikPaymentRequest

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

Overview

Information needed to pay using BLIK.

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:, country_code:, email: SKIP, experience_context: SKIP, level_0: SKIP, one_click: SKIP) ⇒ BlikPaymentRequest

Returns a new instance of BlikPaymentRequest.



71
72
73
74
75
76
77
78
79
# File 'lib/paypal_server_sdk/models/blik_payment_request.rb', line 71

def initialize(name:, country_code:, email: SKIP, experience_context: SKIP,
               level_0: SKIP, one_click: SKIP)
  @name = name
  @country_code = country_code
  @email = email unless email == SKIP
  @experience_context = experience_context unless experience_context == SKIP
  @level_0 = level_0 unless level_0 == SKIP
  @one_click = one_click unless one_click == 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)


22
23
24
# File 'lib/paypal_server_sdk/models/blik_payment_request.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/blik_payment_request.rb', line 29

def email
  @email
end

#experience_contextBlikExperienceContext

Customizes the payer experience during the approval process for the BLIK payment.



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

def experience_context
  @experience_context
end

#level_0BlikLevel0PaymentObject

Information used to pay using BLIK level_0 flow.



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

def level_0
  @level_0
end

#nameString

The full name representation like Mr J Smith.

Returns:

  • (String)


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

def name
  @name
end

#one_clickBlikOneClickPaymentRequest

Information used to pay using BLIK one-click flow.



42
43
44
# File 'lib/paypal_server_sdk/models/blik_payment_request.rb', line 42

def one_click
  @one_click
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  country_code = hash.key?('country_code') ? hash['country_code'] : nil
  email = hash.key?('email') ? hash['email'] : SKIP
  experience_context = BlikExperienceContext.from_hash(hash['experience_context']) if
    hash['experience_context']
  level_0 = BlikLevel0PaymentObject.from_hash(hash['level_0']) if hash['level_0']
  one_click = BlikOneClickPaymentRequest.from_hash(hash['one_click']) if hash['one_click']

  # Create object from extracted values.
  BlikPaymentRequest.new(name: name,
                         country_code: country_code,
                         email: email,
                         experience_context: experience_context,
                         level_0: level_0,
                         one_click: one_click)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['country_code'] = 'country_code'
  @_hash['email'] = 'email'
  @_hash['experience_context'] = 'experience_context'
  @_hash['level_0'] = 'level_0'
  @_hash['one_click'] = 'one_click'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/paypal_server_sdk/models/blik_payment_request.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    email
    experience_context
    level_0
    one_click
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



112
113
114
115
116
117
# File 'lib/paypal_server_sdk/models/blik_payment_request.rb', line 112

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

#to_sObject

Provides a human-readable string representation of the object.



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

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