Module: Vindi::Rest::Charge

Included in:
Vindi::Rest
Defined in:
lib/vindi/rest/charge.rb

Overview

Methods for the charges API

Instance Method Summary collapse

Instance Method Details

#capture_charge(charge_id, options = {}) ⇒ Object

Capture a charge from merchant vindi

Examples:

Capture charge #2

client.capture_charge(2)

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    charge attributes

See Also:



103
104
105
# File 'lib/vindi/rest/charge.rb', line 103

def capture_charge(charge_id, options = {})
  post("charges/#{charge_id}/capture", options)[:charge]
end

#charge(charge_id, options = {}) ⇒ Hash

Get a single charge from a merchant

Examples:

Get charge #2 from vindi

client.charge(2)

Parameters:

  • charge_id (Integer)

    ID of the charge

Returns:

  • (Hash)

    The charge you requested, if it exists

See Also:



23
24
25
# File 'lib/vindi/rest/charge.rb', line 23

def charge(charge_id, options = {})
  get("charges/#{charge_id}", options)[:charge]
end

#delete_charge(charge_id, options = {}) ⇒ Object

Delete a charge from merchant vindi

Examples:

Delete charge #2

client.delete_charge(2)

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    charge attributes

See Also:



90
91
92
# File 'lib/vindi/rest/charge.rb', line 90

def delete_charge(charge_id, options = {})
  delete("charges/#{charge_id}", options)[:charge]
end

#fraud_review(charge_id, options = {}) ⇒ Object

Perform fraud review

Examples:

perform a fraud review charge #2

client.fraud_review_charge(2)

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    charge attributes

See Also:



78
79
80
# File 'lib/vindi/rest/charge.rb', line 78

def fraud_review(charge_id, options = {})
  post("charges/#{charge_id}/fraud_review", options)[:charge]
end

#list_charges(options = {}) ⇒ Array<Hash>

List charge for the authenticate user

Examples:

Get all charges from merchant vindi

Returns:

  • (Array<Hash>)

    A list of charges for a merchant.



11
12
13
# File 'lib/vindi/rest/charge.rb', line 11

def list_charges(options = {})
  get('charges', options)[:charges]
end

#perform_charge(charge_id, options = {}) ⇒ Object

Perform a charge

Examples:

perform a charge #2

client.perform_charge(2)

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    charge attributes

See Also:



56
57
58
# File 'lib/vindi/rest/charge.rb', line 56

def perform_charge(charge_id, options = {})
  post("charges/#{charge_id}/charge", options)[:charge]
end

#refund_charge(charge_id, options = {}) ⇒ Object

Refund from a charge

Examples:

refund from charge #2

client.refund_charge(2, amount: 50)

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    charge attributes

See Also:



67
68
69
# File 'lib/vindi/rest/charge.rb', line 67

def refund_charge(charge_id, options = {})
  post("charges/#{charge_id}/refund", options)[:charge]
end

#reissue_charge(charge_id, options = {}) ⇒ Object

Reissue a charge

Examples:

reissue charge #2

client.reissue_charge(2, payment_method_code: 'debit_card')

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    charge attributes

See Also:



45
46
47
# File 'lib/vindi/rest/charge.rb', line 45

def reissue_charge(charge_id, options = {})
  post("charges/#{charge_id}/reissue", options)[:charge]
end

#update_charge(charge_id, options = {}) ⇒ Object

Edit a charge

Examples:

update charge #2

client.update_charge(2, installments: 3)

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    charge attributes

See Also:



34
35
36
# File 'lib/vindi/rest/charge.rb', line 34

def update_charge(charge_id, options = {})
  put("charges/#{charge_id}", options)[:charge]
end