Sha256: 4f49ef8b435fbd336cef09e13857d7a83695a846d7d99a76a2942dcdf457dc8f

Contents?: true

Size: 434 Bytes

Versions: 2

Compression:

Stored size: 434 Bytes

Contents

class ChatsController < ApplicationController
  def generate_checkout_token
    chat = Chat.find(params[:id])

    order_id = "#{params[:id]}#{SecureRandom.hex(3)}"
    Order.create!(order_id: order_id)

    response = Veritrans.create_widget_token(
      transaction_details: {
        order_id: order_id,
        gross_amount: chat.gross_amount
      }
    )

    token = response.token_id
    render json: {token: token}
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veritrans-2.3.0 example/rails/cable/app/controllers/chats_controller.rb
veritrans-2.2.0 example/rails/cable/app/controllers/chats_controller.rb