Class: PaypalServerSdk::SubscriptionPaymentSource

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

Overview

The payment source definition. To be eligible to create subscription using debit or credit card, you will need to sign up here (www.paypal.com/bizsignup/entry/product/ppcp). Please note, its available only for non-3DS cards and for merchants in US and AU regions.

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(card: SKIP) ⇒ SubscriptionPaymentSource

Returns a new instance of SubscriptionPaymentSource.



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

def initialize(card: SKIP)
  @card = card unless card == SKIP
end

Instance Attribute Details

#cardSubscriptionCardRequest

The payment card to use to fund a payment. Can be a credit or debit card.



17
18
19
# File 'lib/paypal_server_sdk/models/subscription_payment_source.rb', line 17

def card
  @card
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



43
44
45
46
47
48
49
50
51
# File 'lib/paypal_server_sdk/models/subscription_payment_source.rb', line 43

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  card = SubscriptionCardRequest.from_hash(hash['card']) if hash['card']

  # Create object from extracted values.
  SubscriptionPaymentSource.new(card: card)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['card'] = 'card'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



27
28
29
30
31
# File 'lib/paypal_server_sdk/models/subscription_payment_source.rb', line 27

def self.optionals
  %w[
    card
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



60
61
62
63
# File 'lib/paypal_server_sdk/models/subscription_payment_source.rb', line 60

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} card: #{@card.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



54
55
56
57
# File 'lib/paypal_server_sdk/models/subscription_payment_source.rb', line 54

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} card: #{@card}>"
end