Class: PaypalServerSdk::CvvCode

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

Overview

The card verification value code for for Visa, Discover, Mastercard, or American Express.

Constant Summary collapse

CVV_CODE =
[
  # For Visa, Mastercard, Discover, or American Express, error -

  # unrecognized or unknown response.

  CVV_E = 'E'.freeze,

  # For Visa, Mastercard, Discover, or American Express, invalid or null.

  CVV_I = 'I'.freeze,

  # For Visa, Mastercard, Discover, or American Express, the CVV2/CSC

  # matches.

  CVV_M = 'M'.freeze,

  # For Visa, Mastercard, Discover, or American Express, the CVV2/CSC does

  # not match.

  CVV_N = 'N'.freeze,

  # For Visa, Mastercard, Discover, or American Express, it was not

  # processed.

  CVV_P = 'P'.freeze,

  # For Visa, Mastercard, Discover, or American Express, the service is not

  # supported.

  CVV_S = 'S'.freeze,

  # For Visa, Mastercard, Discover, or American Express, unknown - the

  # issuer is not certified.

  CVV_U = 'U'.freeze,

  # For Visa, Mastercard, Discover, or American Express, no response. For

  # Maestro, the service is not available.

  CVV_X = 'X'.freeze,

  # For Visa, Mastercard, Discover, or American Express, error.

  ENUM_ALL_OTHERS = 'All others'.freeze,

  # For Maestro, the CVV2 matched.

  CVV_0 = '0'.freeze,

  # For Maestro, the CVV2 did not match.

  CVV_1 = '1'.freeze,

  # For Maestro, the merchant has not implemented CVV2 code handling.

  CVV_2 = '2'.freeze,

  # For Maestro, the merchant has indicated that CVV2 is not present on

  # card.

  CVV_3 = '3'.freeze,

  # For Maestro, the service is not available.

  CVV_4 = '4'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = CVV_E) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/paypal_server_sdk/models/cvv_code.rb', line 68

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

  str = value.to_s.strip

  case str.downcase
  when 'cvv_e' then CVV_E
  when 'cvv_i' then CVV_I
  when 'cvv_m' then CVV_M
  when 'cvv_n' then CVV_N
  when 'cvv_p' then CVV_P
  when 'cvv_s' then CVV_S
  when 'cvv_u' then CVV_U
  when 'cvv_x' then CVV_X
  when 'enum_all_others' then ENUM_ALL_OTHERS
  when 'cvv_0' then CVV_0
  when 'cvv_1' then CVV_1
  when 'cvv_2' then CVV_2
  when 'cvv_3' then CVV_3
  when 'cvv_4' then CVV_4
  else
    default_value
  end
end

.validate(value) ⇒ Object



62
63
64
65
66
# File 'lib/paypal_server_sdk/models/cvv_code.rb', line 62

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

  true
end