class OffsitePayments::Integrations::Latipay::RefundInterface
Public Class Methods
url()
click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 147 def self.url # according to latipay doc, this url does not have a version part. "https://api.latipay.net/refund" end
Public Instance Methods
call(order_id, refund_amount, reference = '')
click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 152 def call(order_id, refund_amount, reference = '') raise ArgumentError, "Order ID must be specified" if order_id.blank? raise ArgumentError, "Refund amount must be specified" if refund_amount.blank? options = { refund_amount: refund_amount, reference: reference, user_id: @user_id, order_id: order_id } options[:signature] = self.sign(options) raw_response = ssl_post(self.class.url, options.to_json, standard_headers) parsed_response = parse_response(raw_response) validate_response(parsed_response) parsed_response['message'] end
validate_response(parsed_response)
click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 163 def validate_response(parsed_response) raise RefundRequestError, parsed_response unless parsed_response['code'] == 0 end