Class: MerchantZip::Charge

Inherits:
ApiResource show all
Extended by:
Operations::Get
Defined in:
lib/merchant-zip/charge.rb

Class Method Summary collapse

Methods included from Operations::Get

get

Methods inherited from ApiResource

class_name

Methods included from Operations::Request

included

Class Method Details

.create(params = {}, opts = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/merchant-zip/charge.rb', line 9

def self.create(params = {}, opts = {})
  payload = {
    authority: {
      type: "checkout_id",
      value: params[:checkout_id],
    },
    reference: params[:reference],
    amount: params[:amount],
    currency: params[:currency].to_s.upcase,
    capture: true,
  }

  request(:post, resource_url, payload, opts)
end

.resource_urlObject



5
6
7
# File 'lib/merchant-zip/charge.rb', line 5

def self.resource_url
  "/#{CGI.escape(class_name.tableize)}"
end