Class: GoPay::Payment

Inherits:
Object
  • Object
show all
Defined in:
lib/gopay/payment.rb

Class Method Summary collapse

Class Method Details

.create(payment_data) ⇒ Object



6
7
8
9
# File 'lib/gopay/payment.rb', line 6

def self.create(payment_data)
  target = { target: { type: "ACCOUNT", goid: GoPay.goid } }
  GoPay.request :post, "/api/payments/payment", body_parameters: payment_data.merge(target)
end

.create_recurrence(original_payment_id, recurring_payment_data) ⇒ Object



23
24
25
# File 'lib/gopay/payment.rb', line 23

def self.create_recurrence(original_payment_id, recurring_payment_data)
  GoPay.request :post, "/api/payments/payment/#{original_payment_id}/create-recurrence", body_parameters: recurring_payment_data
end

.refund(id, amount) ⇒ Object



19
20
21
# File 'lib/gopay/payment.rb', line 19

def self.refund(id, amount)
  GoPay.request :post, "/api/payments/payment/#{id}/refund", body_parameters: { amount: amount }
end

.retrieve(id) ⇒ Object



11
12
13
# File 'lib/gopay/payment.rb', line 11

def self.retrieve(id)
  GoPay.request :get, "/api/payments/payment/#{id}"
end

.void_recurrence(id) ⇒ Object



15
16
17
# File 'lib/gopay/payment.rb', line 15

def self.void_recurrence(id)
  GoPay.request :post, "/api/payments/payment/#{id}/void-recurrence"
end