• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sleede / fab-manager / #98

pending completion
#98

push

coveralls-ruby

sylvainbx
Merge branch 'dev' for release 5.7.0

1368 of 1368 new or added lines in 161 files covered. (100.0%)

7383 of 12030 relevant lines covered (61.37%)

14.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

54.17
/app/controllers/api/checkout_controller.rb
1
# frozen_string_literal: true
2

3
require 'stripe/helper'
1✔
4
require 'pay_zen/helper'
1✔
5

6
# API Controller for cart checkout
7
class API::CheckoutController < API::ApiController
1✔
8
  include ::API::OrderConcern
1✔
9
  before_action :authenticate_user!
1✔
10
  before_action :current_order
1✔
11
  before_action :ensure_order
1✔
12

13
  def payment
1✔
14
    authorize @current_order, policy_class: CheckoutPolicy
11✔
15
    if @current_order.statistic_profile_id.nil? && current_user.privileged?
11✔
16
      user = User.find(params[:customer_id])
×
17
      @current_order.statistic_profile = user.statistic_profile
×
18
    end
19
    res = Checkout::PaymentService.new.payment(@current_order, current_user, params[:coupon_code],
11✔
20
                                               params[:payment_id])
21
    render json: res
11✔
22
  rescue Stripe::StripeError => e
23
    render json: Stripe::Helper.human_error(e), status: :unprocessable_entity
×
24
  rescue PayzenError => e
25
    render json: PayZen::Helper.human_error(e), status: :unprocessable_entity
×
26
  rescue StandardError => e
27
    Rails.logger.error e
×
28
    Rails.logger.debug e.backtrace
×
29
    render json: e, status: :unprocessable_entity
×
30
  end
31

32
  def confirm_payment
1✔
33
    authorize @current_order, policy_class: CheckoutPolicy
×
34
    res = Checkout::PaymentService.new.confirm_payment(@current_order, current_user, params[:coupon_code], params[:payment_id])
×
35
    render json: res
×
36
  rescue StandardError => e
37
    render json: e, status: :unprocessable_entity
×
38
  end
39
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc