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

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



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

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.<blockquote><strong>Note:</strong> 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.</blockquote>

Returns:

  • (String)


23
24
25
# File 'lib/paypal_server_sdk/models/blik_payment_request.rb', line 23

def country_code
  @country_code
end

#emailString

The internationalized email address.<blockquote><strong>Note:</strong> 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.</blockquote>

Returns:

  • (String)


31
32
33
# File 'lib/paypal_server_sdk/models/blik_payment_request.rb', line 31

def email
  @email
end

#experience_contextBlikExperienceContext

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



36
37
38
# File 'lib/paypal_server_sdk/models/blik_payment_request.rb', line 36

def experience_context
  @experience_context
end

#level_0BlikLevel0PaymentObject

Information used to pay using BLIK level_0 flow.



40
41
42
# File 'lib/paypal_server_sdk/models/blik_payment_request.rb', line 40

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.



44
45
46
# File 'lib/paypal_server_sdk/models/blik_payment_request.rb', line 44

def one_click
  @one_click
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
# File 'lib/paypal_server_sdk/models/blik_payment_request.rb', line 84

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.



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

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



69
70
71
# File 'lib/paypal_server_sdk/models/blik_payment_request.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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