Class: PayPal::SDK::REST::DataTypes::Capture

Inherits:
Base show all
Includes:
RequestDataType
Defined in:
lib/paypal-sdk/rest/data_types.rb

Constant Summary

Constants inherited from Core::API::DataTypes::Base

Core::API::DataTypes::Base::ContentKey, Core::API::DataTypes::Base::HashOptions

Instance Attribute Summary

Attributes inherited from Base

#error, #header, #request_id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RequestDataType

#api, api, #error=, included

Methods included from SetAPI

#client_id=, #client_secret=, #set_config, #token=

Methods inherited from Base

#http_header, #merge!, #raise_error!, raise_on_api_error, #success?

Methods inherited from Core::API::DataTypes::Base

add_attribute, add_member, array_of, #convert_array, #convert_object, define_alias_methods, #hash_key, #initialize, #member_names, members, #members, #merge!, object_of, #set, #skip_value?, snakecase, #to_hash, #value_to_hash

Methods included from Core::Logging

#log_event, #logger, logger, logger=

Constructor Details

This class inherits a constructor from PayPal::SDK::Core::API::DataTypes::Base

Class Method Details

.find(resource_id) ⇒ Object

Raises:

  • (ArgumentError)

972
973
974
975
976
# File 'lib/paypal-sdk/rest/data_types.rb', line 972

def find(resource_id)
  raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
  path = "v1/payments/capture/#{resource_id}"
  self.new(api.get(path))
end

.load_membersObject


955
956
957
958
959
960
961
962
963
964
965
966
967
# File 'lib/paypal-sdk/rest/data_types.rb', line 955

def self.load_members
  object_of :id, String
  object_of :amount, Amount
  object_of :is_final_capture, Boolean
  object_of :state, String
  object_of :reason_code, String
  object_of :parent_payment, String
  object_of :invoice_number, String
  object_of :transaction_fee, Currency
  object_of :create_time, String
  object_of :update_time, String
  array_of  :links, Links
end

Instance Method Details

#refund(refund) ⇒ Object

Deprecated - please use refund_request


980
981
982
983
984
985
# File 'lib/paypal-sdk/rest/data_types.rb', line 980

def refund(refund)
  refund = Refund.new(refund) unless refund.is_a? Refund
  path = "v1/payments/capture/#{self.id}/refund"
  response = api.post(path, refund.to_hash, http_header)
  Refund.new(response)
end

#refund_request(refund_request) ⇒ Object


987
988
989
990
991
992
# File 'lib/paypal-sdk/rest/data_types.rb', line 987

def refund_request(refund_request)
  refund_request = RefundRequest.new(refund_request) unless refund_request.is_a? RefundRequest
  path = "v1/payments/capture/#{self.id}/refund"
  response = api.post(path, refund_request.to_hash, http_header)
  DetailedRefund.new(response)
end