Class: PaypalServerSdk::CardStoredCredential
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::CardStoredCredential
- Defined in:
- lib/paypal_server_sdk/models/card_stored_credential.rb
Overview
Provides additional details to process a payment using a ‘card` that has been stored or is intended to be stored (also referred to as stored_credential or card-on-file).<br/>Parameter compatibility:<br/><ul><li>`payment_type=ONE_TIME` is compatible only with `payment_initiator=CUSTOMER`.</li><li>`usage=FIRST` is compatible only with `payment_initiator=CUSTOMER`.</li><li>`previous_transaction_reference` or `previous_network_transaction_reference` is compatible only with `payment_initiator=MERCHANT`.</li><li>Only one of the parameters - `previous_transaction_reference` and `previous_network_transaction_reference` - can be present in the request.</li></ul>
Instance Attribute Summary collapse
-
#payment_initiator ⇒ PaymentInitiator
The person or party who initiated or triggered the payment.
-
#payment_type ⇒ StoredPaymentSourcePaymentType
Indicates the type of the stored payment_source payment.
-
#previous_network_transaction_reference ⇒ NetworkTransactionReference
Reference values used by the card network to identify a transaction.
-
#usage ⇒ StoredPaymentSourceUsageType
Indicates if this is a ‘first` or `subsequent` payment using a stored payment source (also referred to as stored credential or card on file).
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(payment_initiator:, payment_type:, usage: StoredPaymentSourceUsageType::DERIVED, previous_network_transaction_reference: SKIP) ⇒ CardStoredCredential
constructor
A new instance of CardStoredCredential.
Methods inherited from BaseModel
Constructor Details
#initialize(payment_initiator:, payment_type:, usage: StoredPaymentSourceUsageType::DERIVED, previous_network_transaction_reference: SKIP) ⇒ CardStoredCredential
Returns a new instance of CardStoredCredential.
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/paypal_server_sdk/models/card_stored_credential.rb', line 63 def initialize(payment_initiator:, payment_type:, usage: StoredPaymentSourceUsageType::DERIVED, previous_network_transaction_reference: SKIP) @payment_initiator = payment_initiator @payment_type = payment_type @usage = usage unless usage == SKIP unless previous_network_transaction_reference == SKIP @previous_network_transaction_reference = previous_network_transaction_reference end end |
Instance Attribute Details
#payment_initiator ⇒ PaymentInitiator
The person or party who initiated or triggered the payment.
24 25 26 |
# File 'lib/paypal_server_sdk/models/card_stored_credential.rb', line 24 def payment_initiator @payment_initiator end |
#payment_type ⇒ StoredPaymentSourcePaymentType
Indicates the type of the stored payment_source payment.
28 29 30 |
# File 'lib/paypal_server_sdk/models/card_stored_credential.rb', line 28 def payment_type @payment_type end |
#previous_network_transaction_reference ⇒ NetworkTransactionReference
Reference values used by the card network to identify a transaction.
37 38 39 |
# File 'lib/paypal_server_sdk/models/card_stored_credential.rb', line 37 def previous_network_transaction_reference @previous_network_transaction_reference end |
#usage ⇒ StoredPaymentSourceUsageType
Indicates if this is a ‘first` or `subsequent` payment using a stored payment source (also referred to as stored credential or card on file).
33 34 35 |
# File 'lib/paypal_server_sdk/models/card_stored_credential.rb', line 33 def usage @usage end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/paypal_server_sdk/models/card_stored_credential.rb', line 76 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. payment_initiator = hash.key?('payment_initiator') ? hash['payment_initiator'] : nil payment_type = hash.key?('payment_type') ? hash['payment_type'] : nil usage = hash['usage'] ||= StoredPaymentSourceUsageType::DERIVED if hash['previous_network_transaction_reference'] previous_network_transaction_reference = NetworkTransactionReference.from_hash(hash['previous_network_transaction_reference']) end # Create object from extracted values. CardStoredCredential.new(payment_initiator: payment_initiator, payment_type: payment_type, usage: usage, previous_network_transaction_reference: previous_network_transaction_reference) end |
.names ⇒ Object
A mapping from model property names to API property names.
40 41 42 43 44 45 46 47 48 |
# File 'lib/paypal_server_sdk/models/card_stored_credential.rb', line 40 def self.names @_hash = {} if @_hash.nil? @_hash['payment_initiator'] = 'payment_initiator' @_hash['payment_type'] = 'payment_type' @_hash['usage'] = 'usage' @_hash['previous_network_transaction_reference'] = 'previous_network_transaction_reference' @_hash end |
.nullables ⇒ Object
An array for nullable fields
59 60 61 |
# File 'lib/paypal_server_sdk/models/card_stored_credential.rb', line 59 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
51 52 53 54 55 56 |
# File 'lib/paypal_server_sdk/models/card_stored_credential.rb', line 51 def self.optionals %w[ usage previous_network_transaction_reference ] end |