Sha256: 0c0ed80c4a8ff62fa253f04c1e6931d40e27d3c3a16b649920816e8b25007f22

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

module PaymentGateway
  def authorize_payment(amount, payload, payment_id, return_url, constituent_id, options = {})
    parameters = {
      'Amount': amount,
      'Card': {
        'TessituraMerchantServicesData': payload,
      },
      'PaymentId': payment_id,
      'ConstituentId': constituent_id,
      'TransactionOrigin': 'webapi',
      'PaymentMethodId': 606,
      'ReturnUrl': return_url,
    }
    options.merge!(basic_auth: @auth, headers: @headers)
    options.merge!(:body => parameters)
    self.class.post(base_api_endpoint('PaymentGateway/Authorization/Authorize'), options)
  end

  def finalize_payment(payload, payment_id, options = {})
    parameters = {
      'PaymentId': payment_id,
      'RedirectResult': payload,
    }
    options.merge!(basic_auth: @auth, headers: @headers)
    options.merge!(:body => parameters)
    self.class.post(base_api_endpoint('PaymentGateway/Authorization/Finalize'), options)
  end

  def reversal_request(amount, reference_number, payment_id, options = {})
    parameters = {
      'Amount': amount,
      'PaymentId': payment_id,
      'TransactionOrigin': 'webapi',
      'PaymentMethodId': 606,
    }
    options.merge!(basic_auth: @auth, headers: @headers)
    options.merge!(:body => parameters)
    self.class.post(base_api_endpoint("PaymentGateway/Authorization/#{reference_number}/Reverse"), options)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tessitura_rest-1.3 lib/tessitura_rest/payment_gateway/payment_gateway.rb