Class: PayPal::SDK::REST::DataTypes::FuturePayment

Inherits:
Payment show all
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 inherited from Payment

all, #approval_url, #execute, find, load_members, #token, #update

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, load_members, #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

.exch_token(auth_code) ⇒ Object



276
277
278
279
280
281
282
# File 'lib/paypal-sdk/rest/data_types.rb', line 276

def exch_token(auth_code)
  if auth_code
    PayPal::SDK::OpenIDConnect::DataTypes::Tokeninfo.token_hash(auth_code)
  else
    raise ArgumentError.new("authorization code required") if auth_code.to_s.strip.empty?
  end
end

Instance Method Details

#create(correlation_id = nil) ⇒ Object



260
261
262
263
264
265
266
267
268
269
270
# File 'lib/paypal-sdk/rest/data_types.rb', line 260

def create(correlation_id=nil)
  path = "v1/payments/payment"
  if correlation_id != nil
    header = http_header
    header = header.merge({
      "PAYPAL-CLIENT-METADATA-ID" => correlation_id})
  end
  response = api.post(path, self.to_hash, http_header)
  self.merge!(response)
  success?
end