Class: PaypalServerSdk::PaypalWalletStoredCredential

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

Overview

Provides additional details to process a payment using the PayPal wallet billing agreement or a vaulted payment method that has been stored or is intended to be stored.

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(payment_initiator:, charge_pattern: SKIP, usage_pattern: SKIP, usage: StoredPaymentSourceUsageType::DERIVED) ⇒ PaypalWalletStoredCredential

Returns a new instance of PaypalWalletStoredCredential.



55
56
57
58
59
60
61
62
# File 'lib/paypal_server_sdk/models/paypal_wallet_stored_credential.rb', line 55

def initialize(payment_initiator:, charge_pattern: SKIP,
               usage_pattern: SKIP,
               usage: StoredPaymentSourceUsageType::DERIVED)
  @payment_initiator = payment_initiator
  @charge_pattern = charge_pattern unless charge_pattern == SKIP
  @usage_pattern = usage_pattern unless usage_pattern == SKIP
  @usage = usage unless usage == SKIP
end

Instance Attribute Details

#charge_patternUsagePattern

Expected business/pricing model for the billing agreement.

Returns:



20
21
22
# File 'lib/paypal_server_sdk/models/paypal_wallet_stored_credential.rb', line 20

def charge_pattern
  @charge_pattern
end

#payment_initiatorPaymentInitiator

The person or party who initiated or triggered the payment.

Returns:



16
17
18
# File 'lib/paypal_server_sdk/models/paypal_wallet_stored_credential.rb', line 16

def payment_initiator
  @payment_initiator
end

#usageStoredPaymentSourceUsageType

Indicates if this is a ‘first` or `subsequent` payment using a stored payment source (also referred to as stored credential or card on file).



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

def usage
  @usage
end

#usage_patternUsagePattern

Expected business/pricing model for the billing agreement.

Returns:



24
25
26
# File 'lib/paypal_server_sdk/models/paypal_wallet_stored_credential.rb', line 24

def usage_pattern
  @usage_pattern
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/paypal_server_sdk/models/paypal_wallet_stored_credential.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  payment_initiator =
    hash.key?('payment_initiator') ? hash['payment_initiator'] : nil
  charge_pattern =
    hash.key?('charge_pattern') ? hash['charge_pattern'] : SKIP
  usage_pattern = hash.key?('usage_pattern') ? hash['usage_pattern'] : SKIP
  usage = hash['usage'] ||= StoredPaymentSourceUsageType::DERIVED

  # Create object from extracted values.
  PaypalWalletStoredCredential.new(payment_initiator: payment_initiator,
                                   charge_pattern: charge_pattern,
                                   usage_pattern: usage_pattern,
                                   usage: usage)
end

.namesObject

A mapping from model property names to API property names.



32
33
34
35
36
37
38
39
# File 'lib/paypal_server_sdk/models/paypal_wallet_stored_credential.rb', line 32

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['payment_initiator'] = 'payment_initiator'
  @_hash['charge_pattern'] = 'charge_pattern'
  @_hash['usage_pattern'] = 'usage_pattern'
  @_hash['usage'] = 'usage'
  @_hash
end

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/paypal_server_sdk/models/paypal_wallet_stored_credential.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    charge_pattern
    usage_pattern
    usage
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



91
92
93
94
95
96
# File 'lib/paypal_server_sdk/models/paypal_wallet_stored_credential.rb', line 91

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} payment_initiator: #{@payment_initiator.inspect}, charge_pattern:"\
  " #{@charge_pattern.inspect}, usage_pattern: #{@usage_pattern.inspect}, usage:"\
  " #{@usage.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



84
85
86
87
88
# File 'lib/paypal_server_sdk/models/paypal_wallet_stored_credential.rb', line 84

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} payment_initiator: #{@payment_initiator}, charge_pattern:"\
  " #{@charge_pattern}, usage_pattern: #{@usage_pattern}, usage: #{@usage}>"
end