class MidtransApi::Api::Gopay::Charge

Constants

PATH
PAYMENT_TYPE

Public Instance Methods

post(params) click to toggle source
# File lib/midtrans_api/api/gopay/charge.rb, line 10
def post(params)
  gopay_params = {}

  unless client.config.notification_url.nil?
    gopay_params = {
      enable_callback: true,
      callback_url: client.config.notification_url
    }
  end

  response = client.post(PATH,
                         transaction_details: params[:transaction_details],
                         item_details: params[:item_details],
                         customer_details: params[:customer_details],
                         payment_type: PAYMENT_TYPE,
                         gopay: gopay_params)
  MidtransApi::Model::Gopay::Charge.new(response)
end