Sha256: 20c97e47ef8b070cc5f0c82bb58465353f26dfa677c9fbc8a3a248c0cb0ce00f
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true module Payments class CheckoutsController < ApplicationController before_action :find_payment def show @client_token = Braintree::ClientToken.generate( merchant_account_id: @payment.merchant_account ) set_payment_to_session(@payment) respond_with @payment, layout: current_account.blank? ? 'application' : 'cabinet' end def update @checkout = TranslationCms::Api::Payments::Checkout.create( payment_method_nonce: params['payment_method_nonce'], payment_transaction_id: @payment.id, device_data: params['device_data'] ) url = if @checkout.success payments_integrations_success_url(provider: :credit_card, order_id: @checkout.order_number) else payments_integrations_fail_url(provider: :credit_card, token: @payment.public_token) end redirect_to url end private def find_payment @payment = TranslationCms::Api::Payment.find(params[:id]).first raise ActiveRecord::RecordNotFound, "Payment #{params[:id]} not found" if @payment.nil? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
translation_cms-0.1.5 | app/controllers/payments/checkouts_controller.rb |