Class: BillingsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/billings_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/billings_controller.rb', line 8

def edit
  @account = 

  @account.cardholder_name = @account.credit_card.cardholder_name
  @account.billing_email = @account.customer.email
  @account.expiration_month = @account.credit_card.expiration_month
  @account.expiration_year = @account.credit_card.expiration_year

  if @account.billing_address
    @account.street_address = @account.billing_address.street_address
    @account.extended_address = @account.billing_address.extended_address
    @account.locality = @account.billing_address.locality
    @account.region = @account.billing_address.region
    @account.postal_code = @account.billing_address.postal_code
    @account.country_name = @account.billing_address.country_name
  end
end

#showObject



5
6
# File 'app/controllers/billings_controller.rb', line 5

def show
end

#updateObject



26
27
28
29
30
31
32
33
# File 'app/controllers/billings_controller.rb', line 26

def update
  @account = 
  if @account.save_customer_and_subscription!(params[:account])
    redirect_to (@account), :notice => t('.update.notice', :default => "Billing information updated successfully")
  else
    render :edit
  end
end