Sha256: b2a35d7f2a8ea1c311f34d89aa379db8c55b951f8ad0caaea12bd4b8b8d169b3

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

module MangoPay
  # An immediate contribution is a request to process directly a payment with a payment card already registred by the user.
  class ImmediateContribution < MangoPay::Ressource

    # Create an immediate contribution
    #
    # * *Args*    :
    #   - +data+ -> A JSON with the following attributes (Square brackets for optionals):
    #               * [Tag]
    #               * UserID
    #               * WalletID
    #               * Amount
    #               * PaymentCardID
    #               * [ClientFeeAmount]
    # * *Returns* :
    #   - An immediate contribution object
    #
    def self.create(data)
      post_request('immediate-contributions', data)
    end

    # Get an immediate contribution
    #
    # * *Args*    :
    #   - +immediate_contribution_id+ -> The id of the immediate contribution you want to retrieve
    # * *Returns* :
    #   - An immediate contribution object
    #
    def self.details(immediate_contribution_id)
      get_request(File.join('immediate-contributions', immediate_contribution_id.to_s))
    end

    # Refund a given immediate contribution
    #
    # * *Args*    :
    #   - +data+ -> A JSON with the following attributes (Square brackets for optionals):
    #               * [Tag]
    #               * ImmediateContributionID
    #               * UserID
    # * *Returns* :
    #   - A refund object
    #
    def self.refund(data)
      post_request(File.join('refunds'), data)
    end

    # Get a refund object
    #
    # * *Args*    :
    #   - +immediate_contribution_refund_id+ -> The id of the refund you want to retrieve
    # * *Returns* :
    #   - A refund object
    #
    def self.get_refund(immediate_contribution_refund_id)
      get_request(File.join('refunds', immediate_contribution_refund_id.to_s))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mangopay-2.0.0 lib/mangopay/immediate_contribution.rb