Class: Accountability::BillingConfigurationsController
- Inherits:
-
AccountabilityController
- Object
- ApplicationController
- AccountabilityController
- Accountability::BillingConfigurationsController
- Defined in:
- app/controllers/accountability/billing_configurations_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #designate_as_primary ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
- #updated_billing_elements ⇒ Object
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/accountability/billing_configurations_controller.rb', line 10 def create bc_params = billing_configuration_params @billing_configuration = @account.build_billing_configuration_with_active_merchant_data(bc_params, verify_card: true) if @billing_configuration.save = 'Credit card successfully added.' render json: { status: :success, message: , updated_elements: updated_billing_elements } else render json: { status: :error, errors: @billing_configuration.errors } end end |
#designate_as_primary ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'app/controllers/accountability/billing_configurations_controller.rb', line 46 def designate_as_primary if @billing_configuration.primary! = 'Payment Method Set As Primary' render json: { status: :success, message: , updated_elements: updated_billing_elements } else render json: { status: :error, errors: @billing_configuration.errors } end end |
#destroy ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/accountability/billing_configurations_controller.rb', line 35 def destroy if @billing_configuration.destroy render json: { status: :success, message: 'Payment Method Destroyed' } else render json: { status: :error, errors: @billing_configuration.errors } end end |
#edit ⇒ Object
22 |
# File 'app/controllers/accountability/billing_configurations_controller.rb', line 22 def edit; end |
#new ⇒ Object
8 |
# File 'app/controllers/accountability/billing_configurations_controller.rb', line 8 def new; end |
#show ⇒ Object
6 |
# File 'app/controllers/accountability/billing_configurations_controller.rb', line 6 def show; end |
#update ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/accountability/billing_configurations_controller.rb', line 24 def update @billing_configuration.update billing_configuration_params if @billing_configuration.save = 'Configuration Updated' render json: { status: :success, message: , updated_elements: updated_billing_elements } else render json: { status: :error, errors: @billing_configuration.errors } end end |
#updated_billing_elements ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/accountability/billing_configurations_controller.rb', line 55 def updated_billing_elements configurations_partial = 'accountability/accounts/billing_configurations/configurations' payment_form_partial = 'accountability/accounts/payment_form' { configurations: render_to_string(partial: configurations_partial, layout: false, locals: { account: @account }), payment_form: render_to_string(partial: payment_form_partial, layout: false, locals: { account: @account }) } end |