kaui 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,13 +13,22 @@ class Kaui::AccountsController < Kaui::EngineController
13
13
  if key.present?
14
14
  # support id (UUID) and external key search
15
15
  if key =~ /[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}/
16
- @account = Kaui::KillbillHelper.get_account(key)
16
+ @account = Kaui::KillbillHelper::get_account(key)
17
17
  else
18
- @account = Kaui::KillbillHelper.get_account_by_external_key(key)
18
+ @account = Kaui::KillbillHelper::get_account_by_external_key(key)
19
19
  end
20
20
 
21
21
  if @account.present?
22
- @payment_methods = Kaui::KillbillHelper.get_payment_methods(@account.account_id)
22
+ @payment_methods = Kaui::KillbillHelper::get_payment_methods(@account.account_id)
23
+ @bundles = Kaui::KillbillHelper::get_bundles(@account.account_id)
24
+ @subscriptions_by_bundle_id = {}
25
+
26
+ @bundles.each do |bundle|
27
+ subscriptions = Kaui::KillbillHelper::get_subscriptions_for_bundle(bundle.bundle_id)
28
+ if subscriptions.present?
29
+ @subscriptions_by_bundle_id[bundle.bundle_id.to_s] = (@subscriptions_by_bundle_id[bundle.bundle_id.to_s] || []) + subscriptions
30
+ end
31
+ end
23
32
  else
24
33
  flash[:error] = "Account #{@account_id} not found"
25
34
  redirect_to :action => :index
@@ -32,7 +41,7 @@ class Kaui::AccountsController < Kaui::EngineController
32
41
  def payment_methods
33
42
  @account_id = params[:id]
34
43
  if @account_id.present?
35
- @payment_methods = Kaui::KillbillHelper.get_payment_methods(@account_id)
44
+ @payment_methods = Kaui::KillbillHelper::get_payment_methods(@account_id)
36
45
  unless @payment_methods.is_a?(Array)
37
46
  flash[:notice] = "No payment methods for account_id '#{@account_id}'"
38
47
  redirect_to :action => :index
@@ -43,11 +52,74 @@ class Kaui::AccountsController < Kaui::EngineController
43
52
  end
44
53
  end
45
54
 
55
+ def add_payment_method
56
+ account_id = params[:id]
57
+ @account = Kaui::KillbillHelper::get_account(account_id)
58
+ if @account.nil?
59
+ flash[:error] = "Account not found for id #{account_id}"
60
+ redirect_to :back
61
+ else
62
+ render "kaui/payment_methods/new"
63
+ end
64
+ end
65
+
66
+ def do_add_payment_method
67
+ account_id = params[:id]
68
+ @account = Kaui::KillbillHelper::get_account(account_id)
69
+
70
+ # Implementation example using standard credit card fields
71
+ @card_type = params[:card_type]
72
+ @card_holder_name = params[:card_holder_name]
73
+ @expiration_year = params[:expiration_year]
74
+ @expiration_month = params[:expiration_month]
75
+ @credit_card_number = params[:credit_card_number]
76
+ @address1 = params[:address1]
77
+ @address2 = params[:address2]
78
+ @city = params[:city]
79
+ @country = params[:country]
80
+ @postal_code = params[:postal_code]
81
+ @state = params[:state]
82
+ @is_default = params[:is_default]
83
+ @reason = params[:reason]
84
+ @comment = params[:comment]
85
+
86
+ if @account.present?
87
+ properties = [ Kaui::PluginInfoProperty.new('key' => 'type', 'value' => 'CreditCard'),
88
+ Kaui::PluginInfoProperty.new('key' => 'cardType', 'value' => @card_type),
89
+ Kaui::PluginInfoProperty.new('key' => 'cardHolderName', 'value' => @card_holder_name),
90
+ Kaui::PluginInfoProperty.new('key' => 'expirationDate', 'value' => "#{@expiration_year}-#{@expiration_month}"),
91
+ Kaui::PluginInfoProperty.new('key' => 'maskNumber', 'value' => @credit_card_number),
92
+ Kaui::PluginInfoProperty.new('key' => 'address1', 'value' => @address1),
93
+ Kaui::PluginInfoProperty.new('key' => 'address2', 'value' => @address2),
94
+ Kaui::PluginInfoProperty.new('key' => 'city', 'value' => @city),
95
+ Kaui::PluginInfoProperty.new('key' => 'country', 'value' => @country),
96
+ Kaui::PluginInfoProperty.new('key' => 'postalCode', 'value' => @postal_code),
97
+ Kaui::PluginInfoProperty.new('key' => 'state', 'value' => @state) ]
98
+
99
+ plugin_info = Kaui::PluginInfo.new('properties' => properties)
100
+ payment_method = Kaui::PaymentMethod.new('accountId' => @account.account_id,
101
+ 'isDefault' => @is_default == 1,
102
+ 'pluginName' => Kaui.creditcard_plugin_name.call,
103
+ 'pluginInfo' => plugin_info)
104
+
105
+ success = Kaui::KillbillHelper::add_payment_method(payment_method, current_user, @reason, @comment)
106
+
107
+ if success
108
+ flash[:info] = "Payment method created"
109
+ redirect_to account_timeline_path(@account.account_id)
110
+ return
111
+ else
112
+ flash[:error] = "Error while adding payment method"
113
+ end
114
+ end
115
+ render "kaui/payment_methods/new"
116
+ end
117
+
46
118
  def set_default_payment_method
47
119
  @account_id = params[:id]
48
120
  @payment_method_id = params[:payment_method_id]
49
121
  if @account_id.present? && @payment_method_id.present?
50
- @payment_methods = Kaui::KillbillHelper.set_payment_method_as_default(@account_id, @payment_method_id)
122
+ @payment_methods = Kaui::KillbillHelper::set_payment_method_as_default(@account_id, @payment_method_id)
51
123
  else
52
124
  flash[:notice] = "No account_id or payment_method_id given"
53
125
  end
@@ -17,6 +17,7 @@ class Kaui::BundlesController < Kaui::EngineController
17
17
  end
18
18
 
19
19
  if @bundle.present?
20
+ @account = Kaui::KillbillHelper::get_account_by_bundle_id(@bundle.bundle_id)
20
21
  @subscriptions = Kaui::KillbillHelper.get_subscriptions_for_bundle(@bundle.bundle_id)
21
22
  else
22
23
  flash[:error] = "Bundle #{key} not found"
@@ -26,4 +27,46 @@ class Kaui::BundlesController < Kaui::EngineController
26
27
  flash[:error] = "No id given"
27
28
  end
28
29
  end
30
+
31
+ def transfer
32
+ bundle_id = params[:id]
33
+ @bundle = Kaui::KillbillHelper::get_bundle(bundle_id)
34
+ @account = Kaui::KillbillHelper::get_account_by_bundle_id(bundle_id)
35
+
36
+ if @account.nil?
37
+ flash[:error] = "Account not found for bundle id #{bundle_id}"
38
+ end
39
+ end
40
+
41
+ def do_transfer
42
+ bundle_id = params[:id]
43
+ key = params[:new_account_key]
44
+ if key.present?
45
+ # support id (UUID) and external key search
46
+ if key =~ /[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}/
47
+ result = Kaui::KillbillHelper.get_account(key)
48
+ else
49
+ result = Kaui::KillbillHelper.get_account_by_external_key(key)
50
+ end
51
+ if bundle_id.present? && result.is_a?(Kaui::Account)
52
+ @new_account = result
53
+ success = Kaui::KillbillHelper::transfer_bundle(bundle_id, @new_account.account_id)
54
+ if success
55
+ flash[:info] = "Bundle transfered successfully"
56
+ redirect_to Kaui.account_home_path.call(@new_account.external_key)
57
+ return
58
+ else
59
+ flash[:error] = "Error transfering bundle"
60
+ end
61
+ else
62
+ flash[:error] = "Could not retrieve account #{result}"
63
+ end
64
+ else
65
+ flash[:error] = "No account key given"
66
+ end
67
+ @bundle = Kaui::KillbillHelper::get_bundle(bundle_id)
68
+ @account = Kaui::KillbillHelper::get_account_by_bundle_id(bundle_id)
69
+ render :transfer
70
+ end
71
+
29
72
  end
@@ -47,7 +47,7 @@ class Kaui::SubscriptionsController < Kaui::EngineController
47
47
  @subscription.price_list = plan["priceListName"]
48
48
 
49
49
  begin
50
- Kaui::KillbillHelper::create_subscription(@subscription)
50
+ Kaui::KillbillHelper::create_subscription(@subscription, current_user)
51
51
  redirect_to Kaui.bundle_home_path.call(@bundle.external_key)
52
52
  rescue => e
53
53
  flash[:error] = e.message
@@ -96,7 +96,7 @@ class Kaui::SubscriptionsController < Kaui::EngineController
96
96
  catalog = Kaui::KillbillHelper::get_available_base_plans
97
97
 
98
98
  plan = catalog[params[:plan_name]]
99
- start_date = params[:start_date]
99
+ requested_date = params[:requested_date]
100
100
 
101
101
  subscription.billing_period = plan["billingPeriod"]
102
102
  subscription.product_category = plan["productCategory"]
@@ -105,7 +105,7 @@ class Kaui::SubscriptionsController < Kaui::EngineController
105
105
  subscription.subscription_id = params[:subscription][:subscription_id]
106
106
  # TODO: need to use entered start_date (or current date if none entered)
107
107
 
108
- Kaui::KillbillHelper::update_subscription(subscription)
108
+ Kaui::KillbillHelper::update_subscription(subscription, requested_date, current_user)
109
109
  redirect_to Kaui.bundle_home_path.call(bundle.external_key)
110
110
  else
111
111
  flash[:error] = "No subscription given"
@@ -131,7 +131,7 @@ class Kaui::SubscriptionsController < Kaui::EngineController
131
131
  def destroy
132
132
  subscription_id = params[:id]
133
133
  if subscription_id.present?
134
- Kaui::KillbillHelper::delete_subscription(subscription_id)
134
+ Kaui::KillbillHelper::delete_subscription(subscription_id, current_user)
135
135
  redirect_to :back
136
136
  else
137
137
  flash[:error] = "No subscription id given"
@@ -59,9 +59,18 @@ module Kaui
59
59
  process_response(data, :single) {|json| Kaui::Account.new(json) }
60
60
  rescue => e
61
61
  puts "#{$!}\n\t" + e.backtrace.join("\n\t")
62
+ "#{e.message} #{e.response}"
62
63
  end
63
64
  end
64
65
 
66
+ def self.get_account_by_bundle_id(bundle_id)
67
+ begin
68
+ bundle = get_bundle(bundle_id)
69
+ account = get_account(bundle.account_id)
70
+ rescue => e
71
+ puts "#{$!}\n\t" + e.backtrace.join("\n\t")
72
+ end
73
+ end
65
74
 
66
75
  ############## BUNDLE ##############
67
76
 
@@ -94,10 +103,16 @@ module Kaui
94
103
  end
95
104
  end
96
105
 
97
- def self.get_bundles(account_id)
106
+ def self.transfer_bundle(bundle_id, new_account_id, current_user = nil, reason = nil, comment = nil)
98
107
  begin
99
- data = call_killbill :get, "/1.0/kb/accounts/#{account_id}/bundles"
100
- process_response(data, :multiple) {|json| Kaui::Bundle.new(json) }
108
+ data = call_killbill :put,
109
+ "/1.0/kb/bundles/#{bundle_id}",
110
+ ActiveSupport::JSON.encode("accountId" => new_account_id),
111
+ :content_type => :json,
112
+ "X-Killbill-CreatedBy" => current_user,
113
+ "X-Killbill-Reason" => "#{reason}",
114
+ "X-Killbill-Comment" => "#{comment}"
115
+ return data[:code] < 300
101
116
 
102
117
  rescue => e
103
118
  puts "#{$!}\n\t" + e.backtrace.join("\n\t")
@@ -157,11 +172,11 @@ module Kaui
157
172
  end
158
173
  end
159
174
 
160
- def self.update_subscription(subscription, current_user = nil, reason = nil, comment = nil)
175
+ def self.update_subscription(subscription, requested_date = nil, current_user = nil, reason = nil, comment = nil)
161
176
  begin
162
177
  subscription_data = Kaui::Subscription.camelize(subscription.to_hash)
163
178
  data = call_killbill :put,
164
- "/1.0/kb/subscriptions/#{subscription.subscription_id}",
179
+ "/1.0/kb/subscriptions/#{subscription.subscription_id}?requested_date=#{requested_date}",
165
180
  ActiveSupport::JSON.encode(subscription_data, :root => false),
166
181
  :content_type => :json,
167
182
  "X-Killbill-CreatedBy" => current_user,
@@ -351,6 +366,21 @@ module Kaui
351
366
  end
352
367
  end
353
368
 
369
+ def self.add_payment_method(payment_method, current_user = nil, reason = nil, comment = nil)
370
+ payment_method_data = Kaui::Refund.camelize(payment_method.to_hash)
371
+ begin
372
+ data = call_killbill :post, "/1.0/kb/accounts/#{payment_method.account_id}/paymentMethods?isDefault=#{payment_method.is_default}",
373
+ ActiveSupport::JSON.encode(payment_method_data, :root => false),
374
+ :content_type => :json,
375
+ "X-Killbill-CreatedBy" => current_user,
376
+ "X-Killbill-Reason" => extract_reason_code(reason),
377
+ "X-Killbill-Comment" => "#{comment}"
378
+ return data[:code] < 300
379
+ rescue => e
380
+ puts "#{$!}\n\t" + e.backtrace.join("\n\t")
381
+ end
382
+ end
383
+
354
384
  ############## REFUND ##############
355
385
 
356
386
  def self.get_refunds_for_payment(payment_id)
@@ -29,11 +29,16 @@
29
29
  <%= render :partial => "kaui/tags/tags_table",
30
30
  :locals => { :tags => @tags, :tags_url_or_path => kaui_engine.edit_account_tags_path(:params => { :account_id => @account.account_id }) } %>
31
31
  </dl>
32
- <% if @subscriptions.present? %>
33
- <%= render :partial => "kaui/subscriptions/subscriptions_table", :locals => { :subscriptions => @subscriptions } %>
34
- <% end %>
35
32
  <% if @payment_methods.present? %>
36
- <%= render :partial => "kaui/payment_methods/payment_methods_table", :locals => { :payment_methods => @payment_methods } %>
33
+ <%= render :partial => "kaui/payment_methods/payment_methods_table", :locals => { :account_id => @account.account_id, :payment_methods => @payment_methods } %>
34
+ <% end %>
35
+ <%= link_to "Add payment method", kaui_engine.add_payment_method_account_path(@account.account_id), :class => "btn btn-mini" %>
36
+ <% @bundles.each do |bundle| %>
37
+ <% subs = @subscriptions_by_bundle_id[bundle.bundle_id] %>
38
+ <% if subs.present? %>
39
+ <h4><%= link_to Kaui.bundle_key_display_string.call(bundle.external_key), Kaui.bundle_home_path.call(bundle.external_key) if bundle.external_key.present? %>&nbsp;</h4>
40
+ <%= render :partial => "kaui/subscriptions/subscriptions_table", :locals => { :subscriptions => subs } %>
41
+ <% end %>
37
42
  <% end %>
38
43
  <% else %>
39
44
  <p>Account not found</p>
@@ -1,10 +1,12 @@
1
1
  <% if @bundle.present? %>
2
2
  <h3><%= link_to Kaui.bundle_key_display_string.call(@bundle.external_key), Kaui.bundle_home_path.call(@bundle.external_key) if @bundle.external_key.present? %>&nbsp;</h3>
3
3
  <dl class="dl-horizontal">
4
- <dt>Account id:</dt>
5
- <dd><%= @bundle.account_id %>&nbsp;</dd>
4
+ <dt>Account:</dt>
5
+ <dd><%= @account.name %>&nbsp;</dd>
6
+ <dd><%= link_to @account.email, Kaui.account_home_path.call(@account.external_key) %>&nbsp;</dd>
6
7
  <dt>Bundle key:</dt>
7
8
  <dd><%= @bundle.external_key %>&nbsp;</dd>
9
+ <dd><%= link_to "Transfer Ownership", kaui_engine.transfer_bundle_path(@bundle.bundle_id), :class => "btn btn-mini" %></dd>
8
10
  <% if @subscriptions.present? %>
9
11
  <%= render :partial => "kaui/subscriptions/subscriptions_table", :locals => { :subscriptions => @subscriptions } %>
10
12
  <% end %>
@@ -0,0 +1,23 @@
1
+ <h3>Transfer <%= link_to Kaui.bundle_key_display_string.call(@bundle.external_key), Kaui.bundle_home_path.call(@bundle.external_key) if @bundle.external_key.present? %>&nbsp;</h3>
2
+ <%= form_tag do_transfer_bundle_path(@bundle.bundle_id), :class => "form-horizontal", :method => :put do %>
3
+ <div class="control-group">
4
+ <%= label_tag :current_owner, 'Current account', :class => "control-label" %>
5
+ <div class="controls">
6
+ <label class="checkbox">
7
+ <%= link_to @account.name, Kaui.account_home_path.call(@account.external_key) %><br/>
8
+ <%= link_to @account.email, Kaui.account_home_path.call(@account.external_key) %><br/>
9
+ <%= link_to @account.external_key, Kaui.account_home_path.call(@account.external_key) %>
10
+ </label>
11
+ </div>
12
+ </div>
13
+ <div class="control-group">
14
+ <label class="control-label" for="new_account_key">New Account</label>
15
+ <div class="controls">
16
+ <%= text_field_tag :new_account_key, nil, :class => "input-xlarge" %>
17
+ </div>
18
+ </div>
19
+ <div class="form-actions">
20
+ <%= submit_tag "Change", :class => 'btn btn-primary' %>
21
+ <%= link_to 'Back', :back, :class => 'btn' %>
22
+ </div>
23
+ <% end %>
@@ -12,7 +12,7 @@
12
12
  <dd><%= @invoice.amount %>&nbsp;</dd>
13
13
  <dt>Balance:</dt>
14
14
  <dd><%= @invoice.balance %>&nbsp;</dd>
15
- </dt>
15
+ </dl>
16
16
  <div class="page-header">
17
17
  <h3>Subscriptions</h3>
18
18
  </div>
@@ -0,0 +1,60 @@
1
+ <div class="control-group">
2
+ <%= label_tag :card_type, "Card Type", :class => "control-label" %>
3
+ <div class="controls">
4
+ <%= text_field_tag :card_type, @card_type, :class => 'input-small' %>
5
+ </div>
6
+ </div>
7
+ <div class="control-group">
8
+ <%= label_tag :card_holder_name, "Name of card holder", :class => "control-label" %>
9
+ <div class="controls">
10
+ <%= text_field_tag :card_holder_name, @card_holder_name, :class => "input-xlarge" %>
11
+ </div>
12
+ </div>
13
+ <div class="control-group">
14
+ <label class="control-label">Expiration date</label>
15
+ <div class="controls">
16
+ <%= text_field_tag :expiration_year, @expiration_year, :class => "input-small", :placeholder => "Year" %>&nbsp;<%= text_field_tag :expiration_month, @expiration_month, :class => "input-small", :placeholder => "Month" %>
17
+ </div>
18
+ </div>
19
+ <div class="control-group">
20
+ <%= label_tag :credit_card_number, "Credit card number", :class => "control-label" %>
21
+ <div class="controls">
22
+ <%= text_field_tag :credit_card_number, @credit_card_number, :class => "input-xlarge" %>
23
+ </div>
24
+ </div>
25
+ <div class="control-group">
26
+ <%= label_tag :address1, "Adress 1", :class => "control-label" %>
27
+ <div class="controls">
28
+ <%= text_field_tag :address1, @address1, :class => "input-xlarge" %>
29
+ </div>
30
+ </div>
31
+ <div class="control-group">
32
+ <%= label_tag :address2, "Adress 2", :class => "control-label" %>
33
+ <div class="controls">
34
+ <%= text_field_tag :address2, @address2, :class => "input-xlarge" %>
35
+ </div>
36
+ </div>
37
+ <div class="control-group">
38
+ <%= label_tag :city, "City", :class => "control-label" %>
39
+ <div class="controls">
40
+ <%= text_field_tag :city, @city, :class => "input-xlarge" %>
41
+ </div>
42
+ </div>
43
+ <div class="control-group">
44
+ <%= label_tag :postal_code, "ZIP code", :class => "control-label" %>
45
+ <div class="controls">
46
+ <%= text_field_tag :postal_code, @postal_code, :class => "input-xlarge" %>
47
+ </div>
48
+ </div>
49
+ <div class="control-group">
50
+ <%= label_tag :state, "State", :class => "control-label" %>
51
+ <div class="controls">
52
+ <%= text_field_tag :state, @state, :class => "input-xlarge" %>
53
+ </div>
54
+ </div>
55
+ <div class="control-group">
56
+ <%= label_tag :country, "Country", :class => "control-label" %>
57
+ <div class="controls">
58
+ <%= text_field_tag :country, @country, :class => "input-xlarge" %>
59
+ </div>
60
+ </div>
@@ -14,28 +14,28 @@
14
14
  </tr>
15
15
  </thead>
16
16
  <tbody>
17
- <% if payment_methods.present? && !payment_methods.nil? %>
18
- <% payment_methods.each do |payment_method| %>
19
- <tr>
20
- <td><%= payment_method.type %></a></td>
21
- <td><%= payment_method.card_type %></a></td>
22
- <td><%= payment_method.card_holder_name %><%= payment_method.email %></a></td>
23
- <td><%= payment_method.mask_number %><%= payment_method.baid %></td>
24
- <td><%= payment_method.expiration_dt %></td>
25
- <td>
26
- <% if payment_method.is_default %>
27
- <i class="icon-ok"></i>
28
- <% else %>
29
- <%= link_to "Make Default", kaui_engine.set_default_payment_method_account_path(payment_method.account_id, :params => { :payment_method_id => payment_method.payment_method_id }), :method => :put, :confirm => "Are you sure you want to make this payment method default?", :class => "btn btn-mini" %>
30
- <% end %>
31
- </td>
32
- <td>
33
- <% unless payment_method.is_default %>
34
- <%= link_to "Delete", kaui_engine.payment_method_path(payment_method.payment_method_id), :method => :delete, :confirm => "Are you sure you want to delete this payment method?", :class => "btn btn-mini" %>
35
- <% end %>
36
- </td>
37
- </tr>
17
+ <% if payment_methods.present? && !payment_methods.nil? %>
18
+ <% payment_methods.each do |payment_method| %>
19
+ <tr>
20
+ <td><%= payment_method.type %></a></td>
21
+ <td><%= payment_method.card_type %></a></td>
22
+ <td><%= payment_method.card_holder_name %><%= payment_method.email %></a></td>
23
+ <td><%= payment_method.mask_number %><%= payment_method.baid %></td>
24
+ <td><%= payment_method.expiration_dt %></td>
25
+ <td>
26
+ <% if payment_method.is_default %>
27
+ <i class="icon-ok"></i>
28
+ <% else %>
29
+ <%= link_to "Make Default", kaui_engine.set_default_payment_method_account_path(payment_method.account_id, :params => { :payment_method_id => payment_method.payment_method_id }), :method => :put, :confirm => "Are you sure you want to make this payment method default?", :class => "btn btn-mini" %>
30
+ <% end %>
31
+ </td>
32
+ <td>
33
+ <% unless payment_method.is_default %>
34
+ <%= link_to "Delete", kaui_engine.payment_method_path(payment_method.payment_method_id), :method => :delete, :confirm => "Are you sure you want to delete this payment method?", :class => "btn btn-mini" %>
35
+ <% end %>
36
+ </td>
37
+ </tr>
38
+ <% end %>
38
39
  <% end %>
39
- <% end %>
40
40
  </tbody>
41
- </table>
41
+ </table>
@@ -0,0 +1,23 @@
1
+ <div class="page-header">
2
+ <h1>Add Payment Method</h1>
3
+ </div>
4
+ <%= form_tag do_add_payment_method_account_path(@account.account_id), :class => "form-horizontal" do %>
5
+ <fieldset>
6
+ <div class="control-group">
7
+ <label class="control-label">Account name</label>
8
+ <div class="controls">
9
+ <label class="checkbox">
10
+ <%= @account.name %><br/>
11
+ <%= @account.email %>
12
+ </label>
13
+ </div>
14
+ </div>
15
+ <div id="creditcard">
16
+ <%= render :partial => "kaui/payment_methods/new_creditcard_payment_method" %>
17
+ </div>
18
+ <div class="form-actions">
19
+ <%= button_tag "Create payment method", :class =>"btn btn-primary" %>
20
+ <%= link_to 'Back', :back, :class => 'btn' %>
21
+ </div>
22
+ </fieldset>
23
+ <% end %>
@@ -14,9 +14,9 @@
14
14
  </div>
15
15
  </div>
16
16
  <div class="control-group">
17
- <%= label_tag :start_date, 'Change Date:', :class => "control-label" %>
17
+ <%= label_tag :requested_date, 'Change Date:', :class => "control-label" %>
18
18
  <div class="controls">
19
- <%= text_field_tag :start_date, nil, :class => 'input-xlarge date-picker' %>
19
+ <%= text_field_tag :requested_date, nil, :class => 'input-xlarge date-picker' %>
20
20
  </div>
21
21
  </div>
22
22
  <div class="form-actions">
@@ -1,4 +1,4 @@
1
- <% if @invoice.present? %>
1
+ <% if @subscription.present? %>
2
2
  <div class="page-header">
3
3
  <h2>Subscription <%= @subscription.id %></h2>
4
4
  </div>
data/config/routes.rb CHANGED
@@ -3,9 +3,11 @@ Kaui::Engine.routes.draw do
3
3
 
4
4
  resources :accounts, :only => [ :index, :show ] do
5
5
  member do
6
- get :payment_methods, :as => "payment_methods"
7
- put :set_default_payment_method, :as => "set_default_payment_method"
8
- delete :delete_payment_method, :as => "delete_payment_method"
6
+ get :payment_methods
7
+ put :set_default_payment_method
8
+ get :add_payment_method
9
+ post :do_add_payment_method
10
+ delete :delete_payment_method
9
11
  end
10
12
  end
11
13
 
@@ -33,7 +35,12 @@ Kaui::Engine.routes.draw do
33
35
  end
34
36
  end
35
37
 
36
- resources :bundles, :only => [ :index, :show ]
38
+ resources :bundles, :only => [ :index, :show ] do
39
+ member do
40
+ put :do_transfer
41
+ get :transfer
42
+ end
43
+ end
37
44
 
38
45
  resources :subscriptions do
39
46
  member do
data/lib/kaui/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kaui
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
data/lib/kaui.rb CHANGED
@@ -9,10 +9,12 @@ module Kaui
9
9
  mattr_accessor :bundle_home_path
10
10
  mattr_accessor :invoice_home_path
11
11
  mattr_accessor :bundle_key_display_string
12
+ mattr_accessor :creditcard_plugin_name
12
13
 
13
14
  self.killbill_finder = lambda { Kaui::Engine.config.killbill_url }
14
15
  self.account_home_path = lambda {|account_id| Kaui::Engine.routes.url_helpers.account_path(account_id) }
15
16
  self.bundle_home_path = lambda {|bundle_id| Kaui::Engine.routes.url_helpers.bundle_path(:id => bundle_id) }
16
17
  self.invoice_home_path = lambda {|invoice_id| Kaui::Engine.routes.url_helpers.invoice_path(:id => invoice_id) }
17
18
  self.bundle_key_display_string = lambda {|bundle_key| bundle_key }
19
+ self.creditcard_plugin_name = lambda { nil }
18
20
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaui
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alena Dudzinskaya
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-07-31 00:00:00 Z
18
+ date: 2012-08-06 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Rails UI plugin for Killbill administration.
@@ -95,6 +95,7 @@ files:
95
95
  - app/views/kaui/bundle_tags/edit.html.erb
96
96
  - app/views/kaui/bundles/index.html.erb
97
97
  - app/views/kaui/bundles/show.html.erb
98
+ - app/views/kaui/bundles/transfer.html.erb
98
99
  - app/views/kaui/chargebacks/index.html.erb
99
100
  - app/views/kaui/chargebacks/new.html.erb
100
101
  - app/views/kaui/chargebacks/show.html.erb
@@ -105,8 +106,10 @@ files:
105
106
  - app/views/kaui/home/index.html.erb
106
107
  - app/views/kaui/invoices/index.html.erb
107
108
  - app/views/kaui/invoices/show.html.erb
109
+ - app/views/kaui/payment_methods/_new_creditcard_payment_method.html.erb
108
110
  - app/views/kaui/payment_methods/_payment_methods_table.html.erb
109
111
  - app/views/kaui/payment_methods/index.html.erb
112
+ - app/views/kaui/payment_methods/new.html.erb
110
113
  - app/views/kaui/payment_methods/show.html.erb
111
114
  - app/views/kaui/payments/_payments_table.html.erb
112
115
  - app/views/kaui/payments/new.html.erb