Class: LogaltyCertificateIssuanceApiCerty::CancellationCode

Inherits:
Object
  • Object
show all
Defined in:
lib/logalty_certificate_issuance_api_certy/models/cancellation_code.rb

Overview

Cancellation code provided by the end-user: - ‘OPTION_ZERO`: No reason indicated. - `USER_MOBILE_CHANGED`: User changed their phone number. - `SMS_NOT_RECEIVED`: User did not receive the SMS. - `USER_NO_TOKENS_AVAILABLE`: User does not have a cell phone. - `TECHNICAL_PROBLEMS`: Technical problems reported by the user. - `RCPT_INVALID`: Transaction not directed at the user. - `SENDER_UNKNOWN`: User does not know the sender. - `USER_DATA_INVALID`: User data is incorrect. - `DOCUMENT_DATA_INVALID`: Documentation is incorrect. - `OTHER_REASONS`: Other problems. - `NOT_DOCUMENT_AGREE`: User does not agree with the documentation.

Constant Summary collapse

CANCELLATION_CODE =
[
  # TODO: Write general description for OPTION_ZERO
  OPTION_ZERO = 'OPTION_ZERO'.freeze,

  # TODO: Write general description for USER_MOBILE_CHANGED
  USER_MOBILE_CHANGED = 'USER_MOBILE_CHANGED'.freeze,

  # TODO: Write general description for SMS_NOT_RECEIVED
  SMS_NOT_RECEIVED = 'SMS_NOT_RECEIVED'.freeze,

  # TODO: Write general description for USER_NO_TOKENS_AVAILABLE
  USER_NO_TOKENS_AVAILABLE = 'USER_NO_TOKENS_AVAILABLE'.freeze,

  # TODO: Write general description for TECHNICAL_PROBLEMS
  TECHNICAL_PROBLEMS = 'TECHNICAL_PROBLEMS'.freeze,

  # TODO: Write general description for RCPT_INVALID
  RCPT_INVALID = 'RCPT_INVALID'.freeze,

  # TODO: Write general description for SENDER_UNKNOWN
  SENDER_UNKNOWN = 'SENDER_UNKNOWN'.freeze,

  # TODO: Write general description for USER_DATA_INVALID
  USER_DATA_INVALID = 'USER_DATA_INVALID'.freeze,

  # TODO: Write general description for DOCUMENT_DATA_INVALID
  DOCUMENT_DATA_INVALID = 'DOCUMENT_DATA_INVALID'.freeze,

  # TODO: Write general description for OTHER_REASONS
  OTHER_REASONS = 'OTHER_REASONS'.freeze,

  # TODO: Write general description for NOT_DOCUMENT_AGREE
  NOT_DOCUMENT_AGREE = 'NOT_DOCUMENT_AGREE'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = OPTION_ZERO) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/logalty_certificate_issuance_api_certy/models/cancellation_code.rb', line 59

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

  str = value.to_s.strip

  case str.downcase
  when 'option_zero' then OPTION_ZERO
  when 'user_mobile_changed' then USER_MOBILE_CHANGED
  when 'sms_not_received' then SMS_NOT_RECEIVED
  when 'user_no_tokens_available' then USER_NO_TOKENS_AVAILABLE
  when 'technical_problems' then TECHNICAL_PROBLEMS
  when 'rcpt_invalid' then RCPT_INVALID
  when 'sender_unknown' then SENDER_UNKNOWN
  when 'user_data_invalid' then USER_DATA_INVALID
  when 'document_data_invalid' then DOCUMENT_DATA_INVALID
  when 'other_reasons' then OTHER_REASONS
  when 'not_document_agree' then NOT_DOCUMENT_AGREE
  else
    default_value
  end
end

.validate(value) ⇒ Object



53
54
55
56
57
# File 'lib/logalty_certificate_issuance_api_certy/models/cancellation_code.rb', line 53

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

  CANCELLATION_CODE.include?(value)
end