1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00
fab-manager/lib/pay_zen/transaction.rb

29 lines
893 B
Ruby

# frozen_string_literal: true
require 'pay_zen/client'
# Transaction/* endpoints of the PayZen REST API
class PayZen::Transaction < PayZen::Client
def initialize(base_url: nil, username: nil, password: nil)
super(base_url: base_url, username: username, password: password)
end
##
# @see https://payzen.io/fr-FR/rest/V4.0/api/playground/Transaction/Get/
##
def get(uuid)
post('/Transaction/Get/', uuid: uuid)
end
##
# @see https://payzen.io/fr-FR/rest/V4.0/api/playground/Transaction/CancelOrRefund
##
def cancel_or_refund(uuid,
amount: 0,
currency: Setting.get('payzen_currency'),
resolution_mode: nil,
comment: nil)
post('/Transaction/CancelOrRefund/', uuid: uuid, amount: amount, currency: currency, resolutionMode: resolution_mode, comment: comment)
end
end