Class: PaypalServerSdk::ReasonCode

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

Overview

The reason code for the payment failure.

Constant Summary collapse

REASON_CODE =
[
  # PayPal declined the payment due to one or more customer issues.

  PAYMENT_DENIED = 'PAYMENT_DENIED'.freeze,

  # An internal server error has occurred.

  INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR'.freeze,

  # The payee account is not in good standing and cannot receive payments.

   = 'PAYEE_ACCOUNT_RESTRICTED'.freeze,

  # The payer account is not in good standing and cannot make payments.

   = 'PAYER_ACCOUNT_RESTRICTED'.freeze,

  # Payer cannot pay for this transaction.

  PAYER_CANNOT_PAY = 'PAYER_CANNOT_PAY'.freeze,

  # The transaction exceeds the payer's sending limit.

  SENDING_LIMIT_EXCEEDED = 'SENDING_LIMIT_EXCEEDED'.freeze,

  # The transaction exceeds the receiver's receiving limit.

  TRANSACTION_RECEIVING_LIMIT_EXCEEDED = 'TRANSACTION_RECEIVING_LIMIT_EXCEEDED'.freeze,

  # The transaction is declined due to a currency mismatch.

  CURRENCY_MISMATCH = 'CURRENCY_MISMATCH'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = PAYMENT_DENIED) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/paypal_server_sdk/models/reason_code.rb', line 41

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

  str = value.to_s.strip

  case str.downcase
  when 'payment_denied' then PAYMENT_DENIED
  when 'internal_server_error' then INTERNAL_SERVER_ERROR
  when 'payee_account_restricted' then 
  when 'payer_account_restricted' then 
  when 'payer_cannot_pay' then PAYER_CANNOT_PAY
  when 'sending_limit_exceeded' then SENDING_LIMIT_EXCEEDED
  when 'transaction_receiving_limit_exceeded' then TRANSACTION_RECEIVING_LIMIT_EXCEEDED
  when 'currency_mismatch' then CURRENCY_MISMATCH
  else
    default_value
  end
end

.validate(value) ⇒ Object



35
36
37
38
39
# File 'lib/paypal_server_sdk/models/reason_code.rb', line 35

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

  true
end