Class: PaypalServerSdk::PaymentInitiator

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

Overview

The person or party who initiated or triggered the payment.

Constant Summary collapse

PAYMENT_INITIATOR =
[
  # Payment is initiated with the active engagement of the customer. e.g. a
  # customer checking out on a merchant website.
  CUSTOMER = 'CUSTOMER'.freeze,

  # Payment is initiated by merchant on behalf of the customer without the
  # active engagement of customer. e.g. a merchant charging the monthly
  # payment of a subscription to the customer.
  MERCHANT = 'MERCHANT'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = CUSTOMER) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/paypal_server_sdk/models/payment_initiator.rb', line 26

def self.from_value(value, default_value = CUSTOMER)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'customer' then CUSTOMER
  when 'merchant' then MERCHANT
  else
    default_value
  end
end

.validate(value) ⇒ Object



20
21
22
23
24
# File 'lib/paypal_server_sdk/models/payment_initiator.rb', line 20

def self.validate(value)
  return false if value.nil?

  true
end