Class: Kortana::Modules::Payments

Inherits:
Object
  • Object
show all
Defined in:
lib/kortana/modules/payments.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Payments

Returns a new instance of Payments.



4
5
6
# File 'lib/kortana/modules/payments.rb', line 4

def initialize(client)
  @client = client
end

Instance Method Details

#cancel_intent(id) ⇒ Object



29
30
31
# File 'lib/kortana/modules/payments.rb', line 29

def cancel_intent(id)
  @client.post("/payments/intents/#{id}/cancel")
end

#confirm_intent(id, payment_method = nil) ⇒ Object



23
24
25
26
27
# File 'lib/kortana/modules/payments.rb', line 23

def confirm_intent(id, payment_method = nil)
  @client.post("/payments/intents/#{id}/confirm", {
    paymentMethod: payment_method
  })
end

#create_intent(amount:, currency: "DNR", description: nil, customer_id: nil, merchant_id: nil, metadata: nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/kortana/modules/payments.rb', line 8

def create_intent(amount:, currency: "DNR", description: nil, customer_id: nil, merchant_id: nil, metadata: nil)
  @client.post("/payments/intents", {
    amount: amount.to_s,
    currency: currency,
    description: description,
    customerId: customer_id,
    merchantId: merchant_id,
    metadata: 
  })
end

#create_invoice(items:, customer: nil, due_date: nil, metadata: nil) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/kortana/modules/payments.rb', line 33

def create_invoice(items:, customer: nil, due_date: nil, metadata: nil)
  @client.post("/payments/invoices", {
    items: items,
    customer: customer,
    dueDate: due_date,
    metadata: 
  })
end


46
47
48
49
50
51
52
53
# File 'lib/kortana/modules/payments.rb', line 46

def create_payment_link(amount:, currency: "DNR", description: nil, expires_at: nil)
  @client.post("/payments/links", {
    amount: amount.to_s,
    currency: currency,
    description: description,
    expiresAt: expires_at
  })
end

#get_intent(id) ⇒ Object



19
20
21
# File 'lib/kortana/modules/payments.rb', line 19

def get_intent(id)
  @client.get("/payments/intents/#{id}")
end

#get_invoice(id) ⇒ Object



42
43
44
# File 'lib/kortana/modules/payments.rb', line 42

def get_invoice(id)
  @client.get("/payments/invoices/#{id}")
end


55
56
57
# File 'lib/kortana/modules/payments.rb', line 55

def get_payment_link(id)
  @client.get("/payments/links/#{id}")
end