Class: PaypalServerSdk::CaptureStatus

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

Overview

The status of the captured payment.

Constant Summary collapse

CAPTURE_STATUS =
[
  # The funds for this captured payment were credited to the payee's PayPal

  # account.

  COMPLETED = 'COMPLETED'.freeze,

  # The funds could not be captured.

  DECLINED = 'DECLINED'.freeze,

  # An amount less than this captured payment's amount was partially

  # refunded to the payer.

  PARTIALLY_REFUNDED = 'PARTIALLY_REFUNDED'.freeze,

  # The funds for this captured payment was not yet credited to the payee's

  # PayPal account. For more information, see status.details.

  PENDING = 'PENDING'.freeze,

  # An amount greater than or equal to this captured payment's amount was

  # refunded to the payer.

  REFUNDED = 'REFUNDED'.freeze,

  # There was an error while capturing payment.

  FAILED = 'FAILED'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = COMPLETED) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/paypal_server_sdk/models/capture_status.rb', line 39

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

  str = value.to_s.strip

  case str.downcase
  when 'completed' then COMPLETED
  when 'declined' then DECLINED
  when 'partially_refunded' then PARTIALLY_REFUNDED
  when 'pending' then PENDING
  when 'refunded' then REFUNDED
  when 'failed' then FAILED
  else
    default_value
  end
end

.validate(value) ⇒ Object



33
34
35
36
37
# File 'lib/paypal_server_sdk/models/capture_status.rb', line 33

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

  true
end