kaui 0.2.4 → 0.2.5
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.
- data/Gemfile.lock +2 -2
 - data/README.md +6 -2
 - data/app/controllers/kaui/refunds_controller.rb +16 -3
 - data/app/views/kaui/refunds/new.html.erb +3 -2
 - data/lib/kaui/version.rb +1 -1
 - metadata +4 -4
 
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            PATH
         
     | 
| 
       2 
2 
     | 
    
         
             
              remote: .
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                kaui (0.2. 
     | 
| 
      
 4 
     | 
    
         
            +
                kaui (0.2.5)
         
     | 
| 
       5 
5 
     | 
    
         
             
                  d3_rails (~> 2.10.3)
         
     | 
| 
       6 
6 
     | 
    
         
             
                  jquery-rails (~> 2.0)
         
     | 
| 
       7 
7 
     | 
    
         
             
                  killbill-client (~> 0.1.1)
         
     | 
| 
         @@ -64,7 +64,7 @@ GEM 
     | 
|
| 
       64 
64 
     | 
    
         
             
                  activesupport (~> 3.0)
         
     | 
| 
       65 
65 
     | 
    
         
             
                  money (~> 5.0.0)
         
     | 
| 
       66 
66 
     | 
    
         
             
                  railties (~> 3.0)
         
     | 
| 
       67 
     | 
    
         
            -
                multi_json (1.7. 
     | 
| 
      
 67 
     | 
    
         
            +
                multi_json (1.7.6)
         
     | 
| 
       68 
68 
     | 
    
         
             
                mysql2 (0.3.11)
         
     | 
| 
       69 
69 
     | 
    
         
             
                polyglot (0.3.3)
         
     | 
| 
       70 
70 
     | 
    
         
             
                rack (1.4.5)
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -7,11 +7,15 @@ Getting started 
     | 
|
| 
       7 
7 
     | 
    
         
             
            Running Kaui
         
     | 
| 
       8 
8 
     | 
    
         
             
            ------------
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
            You can run Kaui locally using the  
     | 
| 
      
 10 
     | 
    
         
            +
            You can run Kaui locally using the sandbox script:
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                # Point to your killbill installation
         
     | 
| 
       13 
13 
     | 
    
         
             
                export KILLBILL_URL="http://killbill.company.com:8080"
         
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
      
 14 
     | 
    
         
            +
                # Run the sandbox script
         
     | 
| 
      
 15 
     | 
    
         
            +
                script/sandbox 
         
     | 
| 
      
 16 
     | 
    
         
            +
                # Start the Rails app
         
     | 
| 
      
 17 
     | 
    
         
            +
                cd sandbox
         
     | 
| 
      
 18 
     | 
    
         
            +
                rails s
         
     | 
| 
       15 
19 
     | 
    
         | 
| 
       16 
20 
     | 
    
         | 
| 
       17 
21 
     | 
    
         
             
            Mounting Kaui into your own Rails app
         
     | 
| 
         @@ -65,16 +65,18 @@ class Kaui::RefundsController < Kaui::EngineController 
     | 
|
| 
       65 
65 
     | 
    
         
             
              end
         
     | 
| 
       66 
66 
     | 
    
         | 
| 
       67 
67 
     | 
    
         
             
              def create
         
     | 
| 
       68 
     | 
    
         
            -
                 
     | 
| 
       69 
     | 
    
         
            -
                account_id = params[:account_id]
         
     | 
| 
      
 68 
     | 
    
         
            +
                invoice = Kaui::KillbillHelper::get_invoice(params[:invoice_id])
         
     | 
| 
       70 
69 
     | 
    
         
             
                refund = Kaui::Refund.new(params[:refund])
         
     | 
| 
       71 
70 
     | 
    
         
             
                refund.adjusted = (refund.adjustment_type != "noInvoiceAdjustment")
         
     | 
| 
       72 
71 
     | 
    
         
             
                if refund.adjustment_type == "invoiceItemAdjustment"
         
     | 
| 
       73 
72 
     | 
    
         
             
                  refund.adjustments = []
         
     | 
| 
       74 
73 
     | 
    
         
             
                  params[:adjustments].each_with_index do |ii, idx|
         
     | 
| 
      
 74 
     | 
    
         
            +
                    original_item = find_original_item(invoice.items, ii[0])
         
     | 
| 
       75 
75 
     | 
    
         
             
                    h = Hash.new
         
     | 
| 
       76 
76 
     | 
    
         
             
                    h[:invoice_item_id] = ii[0]
         
     | 
| 
       77 
     | 
    
         
            -
                     
     | 
| 
      
 77 
     | 
    
         
            +
                    # If we tried to do a partial item adjustment, we pass the value, if not we don't send any value and let the system
         
     | 
| 
      
 78 
     | 
    
         
            +
                    # decide what is the maxium amount we can have on that item
         
     | 
| 
      
 79 
     | 
    
         
            +
                    h[:amount] = (ii[1].to_f == original_item.amount) ? nil : ii[1]
         
     | 
| 
       78 
80 
     | 
    
         
             
                    kaui_ii = Kaui::InvoiceItem.new(h)
         
     | 
| 
       79 
81 
     | 
    
         
             
                    puts "Got #{kaui_ii.inspect}"
         
     | 
| 
       80 
82 
     | 
    
         
             
                    refund.adjustments[idx] = kaui_ii
         
     | 
| 
         @@ -93,4 +95,15 @@ class Kaui::RefundsController < Kaui::EngineController 
     | 
|
| 
       93 
95 
     | 
    
         
             
                redirect_to kaui_engine.account_timeline_path(:id => params[:account_id])
         
     | 
| 
       94 
96 
     | 
    
         
             
              end
         
     | 
| 
       95 
97 
     | 
    
         | 
| 
      
 98 
     | 
    
         
            +
              private
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
              def find_original_item(items, item_id)
         
     | 
| 
      
 101 
     | 
    
         
            +
                items.each do |ii|
         
     | 
| 
      
 102 
     | 
    
         
            +
                  if ii.invoice_item_id == item_id
         
     | 
| 
      
 103 
     | 
    
         
            +
                    return ii
         
     | 
| 
      
 104 
     | 
    
         
            +
                  end
         
     | 
| 
      
 105 
     | 
    
         
            +
                end
         
     | 
| 
      
 106 
     | 
    
         
            +
                nil
         
     | 
| 
      
 107 
     | 
    
         
            +
              end
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
       96 
109 
     | 
    
         
             
            end
         
     | 
| 
         @@ -3,8 +3,9 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            </div>
         
     | 
| 
       4 
4 
     | 
    
         
             
            <%= form_for(@refund, :url => { :action => :create }, :html => { :class => "form-horizontal" }) do |f| %>
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 6 
     | 
    
         
            +
                <%= hidden_field_tag :account_id, @account_id %>
         
     | 
| 
      
 7 
     | 
    
         
            +
                <%= hidden_field_tag :payment_id, @payment_id %>
         
     | 
| 
      
 8 
     | 
    
         
            +
                <%= hidden_field_tag :invoice_id, @invoice_id%>
         
     | 
| 
       8 
9 
     | 
    
         
             
              <fieldset>
         
     | 
| 
       9 
10 
     | 
    
         
             
                <div class="control-group">
         
     | 
| 
       10 
11 
     | 
    
         
             
                  <label class="control-label">Date</label>
         
     | 
    
        data/lib/kaui/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: kaui
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.5
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2013-06- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-06-24 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rails
         
     | 
| 
         @@ -375,10 +375,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       375 
375 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       376 
376 
     | 
    
         
             
                  segments:
         
     | 
| 
       377 
377 
     | 
    
         
             
                  - 0
         
     | 
| 
       378 
     | 
    
         
            -
                  hash: - 
     | 
| 
      
 378 
     | 
    
         
            +
                  hash: -3532343417055905152
         
     | 
| 
       379 
379 
     | 
    
         
             
            requirements: []
         
     | 
| 
       380 
380 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       381 
     | 
    
         
            -
            rubygems_version: 1.8. 
     | 
| 
      
 381 
     | 
    
         
            +
            rubygems_version: 1.8.25
         
     | 
| 
       382 
382 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       383 
383 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       384 
384 
     | 
    
         
             
            summary: Killbill Admin UI plugin
         
     |