catarse_moip 2.3.0 → 2.3.1
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.
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: a303201200c88bb87b69dbeef2fb5c3260580408
         | 
| 4 | 
            +
              data.tar.gz: 48376c06cd160dc931e6cd3be6d583c3cfb2a2a3
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: b042bad1301f0990563fd9417d392982e5091b9fb193c081f13347f7d4c4814130f97762677f3d315786e4722ceb8ae6aeeae37fb42789a4dd389be31b995287
         | 
| 7 | 
            +
              data.tar.gz: a9164d7b06956aadb95d88a06b833338a2c9dccdea1ed1ce663846c614c240f4dac2cc3bf4907d352bf01d17e1da3814e90a93d6f7649db06b0e02916bdb7da2
         | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -10,7 +10,7 @@ GIT | |
| 10 10 | 
             
            PATH
         | 
| 11 11 | 
             
              remote: .
         | 
| 12 12 | 
             
              specs:
         | 
| 13 | 
            -
                catarse_moip (2.3. | 
| 13 | 
            +
                catarse_moip (2.3.1)
         | 
| 14 14 | 
             
                  enumerate_it
         | 
| 15 15 | 
             
                  libxml-ruby (~> 2.6.0)
         | 
| 16 16 | 
             
                  rails (~> 4.0)
         | 
| @@ -42,7 +42,7 @@ GEM | |
| 42 42 | 
             
                  multi_json (~> 1.3)
         | 
| 43 43 | 
             
                  thread_safe (~> 0.1)
         | 
| 44 44 | 
             
                  tzinfo (~> 0.3.37)
         | 
| 45 | 
            -
                arel (4.0. | 
| 45 | 
            +
                arel (4.0.2)
         | 
| 46 46 | 
             
                atomic (1.1.14)
         | 
| 47 47 | 
             
                builder (3.1.4)
         | 
| 48 48 | 
             
                crack (0.1.8)
         | 
| @@ -123,19 +123,26 @@ module CatarseMoip | |
| 123 123 |  | 
| 124 124 | 
             
                def process_moip_message
         | 
| 125 125 | 
             
                  contribution.with_lock do
         | 
| 126 | 
            -
                    PaymentEngines.create_payment_notification contribution_id: contribution.id, extra_data: JSON.parse(params.to_json.force_encoding('iso-8859-1').encode('utf-8'))
         | 
| 126 | 
            +
                    payment_notification = PaymentEngines.create_payment_notification contribution_id: contribution.id, extra_data: JSON.parse(params.to_json.force_encoding('iso-8859-1').encode('utf-8'))
         | 
| 127 127 | 
             
                    payment_id = (contribution.payment_id.gsub(".", "").to_i rescue 0)
         | 
| 128 128 |  | 
| 129 129 | 
             
                    if payment_id <= params[:cod_moip].to_i
         | 
| 130 130 | 
             
                      contribution.update_attributes payment_id: params[:cod_moip]
         | 
| 131 131 |  | 
| 132 132 | 
             
                      case params[:status_pagamento].to_i
         | 
| 133 | 
            +
                      when TransactionStatus::PROCESS
         | 
| 134 | 
            +
                        payment_notification.deliver_process_notification
         | 
| 133 135 | 
             
                      when TransactionStatus::AUTHORIZED
         | 
| 134 136 | 
             
                        contribution.confirm! unless contribution.confirmed?
         | 
| 135 137 | 
             
                      when TransactionStatus::WRITTEN_BACK, TransactionStatus::REFUNDED
         | 
| 136 138 | 
             
                        contribution.refund! unless contribution.refunded?
         | 
| 137 139 | 
             
                      when TransactionStatus::CANCELED
         | 
| 138 | 
            -
                         | 
| 140 | 
            +
                        unless contribution.canceled?
         | 
| 141 | 
            +
                          contribution.cancel!
         | 
| 142 | 
            +
                          if contribution.payment_choice.downcase == 'boletobancario'
         | 
| 143 | 
            +
                            payment_notification.deliver_slip_canceled_notification
         | 
| 144 | 
            +
                          end
         | 
| 145 | 
            +
                        end
         | 
| 139 146 | 
             
                      end
         | 
| 140 147 | 
             
                    end
         | 
| 141 148 | 
             
                  end
         | 
    
        data/lib/catarse_moip/version.rb
    CHANGED
    
    
| @@ -35,6 +35,7 @@ describe CatarseMoip::MoipController do | |
| 35 35 | 
             
              let(:user){ double('user', id: 1) }
         | 
| 36 36 | 
             
              let(:project){ double('project', id: 1, name: 'test project') }
         | 
| 37 37 | 
             
              let(:extra_data){ {"id_transacao"=>contribution.key, "valor"=>"2190", "cod_moip"=>"12345123", "forma_pagamento"=>"1", "tipo_pagamento"=>"CartaoDeCredito", "email_consumidor"=>"some@email.com", "controller"=>"catarse_moip/payment/notifications", "action"=>"create"} }
         | 
| 38 | 
            +
              let(:payment_notification) {}
         | 
| 38 39 |  | 
| 39 40 | 
             
              before do
         | 
| 40 41 | 
             
                controller.stub(:current_user).and_return(user)
         | 
| @@ -43,11 +44,72 @@ describe CatarseMoip::MoipController do | |
| 43 44 | 
             
                ::MoipTransparente::Checkout.any_instance.stub(:moip_javascript_tag).and_return('<script>')
         | 
| 44 45 | 
             
                ::MoipTransparente::Checkout.any_instance.stub(:as_json).and_return('{}')
         | 
| 45 46 | 
             
                PaymentEngines.stub(:find_payment).and_return(contribution)
         | 
| 46 | 
            -
                PaymentEngines.stub(:create_payment_notification)
         | 
| 47 | 
            +
                PaymentEngines.stub(:create_payment_notification).and_return(payment_notification)
         | 
| 47 48 | 
             
                contribution.stub(:with_lock).and_yield
         | 
| 48 49 | 
             
              end
         | 
| 49 50 |  | 
| 50 51 | 
             
              describe "POST create_notification" do
         | 
| 52 | 
            +
                describe "payment notifications" do
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                  context "when payment status is processing (6)" do
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                    let(:payment_notification) do
         | 
| 57 | 
            +
                      pn = mock()
         | 
| 58 | 
            +
                      pn.stub(:deliver_process_notification).and_return(true)
         | 
| 59 | 
            +
                      pn
         | 
| 60 | 
            +
                    end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                    before do
         | 
| 63 | 
            +
                      contribution.stub(:payment_id).and_return('123')
         | 
| 64 | 
            +
                      contribution.stub(:update_attributes).and_return(true)
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                      payment_notification.should_receive(:deliver_process_notification)
         | 
| 67 | 
            +
                    end
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                    it("should satisfy expectations") do
         | 
| 70 | 
            +
                      post :create_notification, {:cod_moip => 125, :id_transacao => contribution.key, :use_route => 'catarse_moip', :status_pagamento => 6}
         | 
| 71 | 
            +
                    end
         | 
| 72 | 
            +
                  end
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                  context "when payment status is canceled and payment is made with Boleto" do
         | 
| 75 | 
            +
                    let(:payment_notification) do
         | 
| 76 | 
            +
                      pn = mock()
         | 
| 77 | 
            +
                      pn.stub(:deliver_slip_canceled_notification).and_return(true)
         | 
| 78 | 
            +
                      pn
         | 
| 79 | 
            +
                    end
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                    context "when contribution is made with Boleto" do
         | 
| 82 | 
            +
                      before do
         | 
| 83 | 
            +
                        contribution.stub(:payment_choice).and_return('BoletoBancario')
         | 
| 84 | 
            +
                        contribution.stub(:payment_id).and_return('123')
         | 
| 85 | 
            +
                        contribution.stub(:update_attributes).and_return(true)
         | 
| 86 | 
            +
                      end
         | 
| 87 | 
            +
             | 
| 88 | 
            +
                      context "when is not canceled yet" do
         | 
| 89 | 
            +
                        before do
         | 
| 90 | 
            +
                          contribution.stub(:canceled?).and_return(false)
         | 
| 91 | 
            +
             | 
| 92 | 
            +
                          payment_notification.should_receive(:deliver_slip_canceled_notification)
         | 
| 93 | 
            +
                        end
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                        it("should satisfy expectations") do
         | 
| 96 | 
            +
                          post :create_notification, {:cod_moip => 125, :id_transacao => contribution.key, :use_route => 'catarse_moip', :status_pagamento => 5}
         | 
| 97 | 
            +
                        end
         | 
| 98 | 
            +
                      end
         | 
| 99 | 
            +
             | 
| 100 | 
            +
                      context "when is already canceled" do
         | 
| 101 | 
            +
                        before do
         | 
| 102 | 
            +
                          payment_notification.should_not_receive(:deliver_slip_canceled_notification)
         | 
| 103 | 
            +
                        end
         | 
| 104 | 
            +
             | 
| 105 | 
            +
                        it("should satisfy expectations") do
         | 
| 106 | 
            +
                          post :create_notification, {:cod_moip => 125, :id_transacao => contribution.key, :use_route => 'catarse_moip', :status_pagamento => 5}
         | 
| 107 | 
            +
                        end
         | 
| 108 | 
            +
                      end
         | 
| 109 | 
            +
                    end
         | 
| 110 | 
            +
                  end
         | 
| 111 | 
            +
                end
         | 
| 112 | 
            +
             | 
| 51 113 | 
             
                context "when we search for a non-existant contribution" do
         | 
| 52 114 | 
             
                  before do
         | 
| 53 115 | 
             
                    PaymentEngines.should_receive(:find_payment).with(key: "non-existant contribution key").and_raise('error')
         | 
    
        metadata
    CHANGED
    
    | @@ -1,8 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: catarse_moip
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.3. | 
| 5 | 
            -
              prerelease: 
         | 
| 4 | 
            +
              version: 2.3.1
         | 
| 6 5 | 
             
            platform: ruby
         | 
| 7 6 | 
             
            authors:
         | 
| 8 7 | 
             
            - Antônio Roberto Silva
         | 
| @@ -11,102 +10,90 @@ authors: | |
| 11 10 | 
             
            autorequire: 
         | 
| 12 11 | 
             
            bindir: bin
         | 
| 13 12 | 
             
            cert_chain: []
         | 
| 14 | 
            -
            date: 2014- | 
| 13 | 
            +
            date: 2014-02-19 00:00:00.000000000 Z
         | 
| 15 14 | 
             
            dependencies:
         | 
| 16 15 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 17 16 | 
             
              name: rails
         | 
| 18 17 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 19 | 
            -
                none: false
         | 
| 20 18 | 
             
                requirements:
         | 
| 21 | 
            -
                - - ~>
         | 
| 19 | 
            +
                - - "~>"
         | 
| 22 20 | 
             
                  - !ruby/object:Gem::Version
         | 
| 23 21 | 
             
                    version: '4.0'
         | 
| 24 22 | 
             
              type: :runtime
         | 
| 25 23 | 
             
              prerelease: false
         | 
| 26 24 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 27 | 
            -
                none: false
         | 
| 28 25 | 
             
                requirements:
         | 
| 29 | 
            -
                - - ~>
         | 
| 26 | 
            +
                - - "~>"
         | 
| 30 27 | 
             
                  - !ruby/object:Gem::Version
         | 
| 31 28 | 
             
                    version: '4.0'
         | 
| 32 29 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 33 30 | 
             
              name: libxml-ruby
         | 
| 34 31 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 35 | 
            -
                none: false
         | 
| 36 32 | 
             
                requirements:
         | 
| 37 | 
            -
                - - ~>
         | 
| 33 | 
            +
                - - "~>"
         | 
| 38 34 | 
             
                  - !ruby/object:Gem::Version
         | 
| 39 35 | 
             
                    version: 2.6.0
         | 
| 40 36 | 
             
              type: :runtime
         | 
| 41 37 | 
             
              prerelease: false
         | 
| 42 38 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 43 | 
            -
                none: false
         | 
| 44 39 | 
             
                requirements:
         | 
| 45 | 
            -
                - - ~>
         | 
| 40 | 
            +
                - - "~>"
         | 
| 46 41 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 42 | 
             
                    version: 2.6.0
         | 
| 48 43 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 49 44 | 
             
              name: enumerate_it
         | 
| 50 45 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 51 | 
            -
                none: false
         | 
| 52 46 | 
             
                requirements:
         | 
| 53 | 
            -
                - -  | 
| 47 | 
            +
                - - ">="
         | 
| 54 48 | 
             
                  - !ruby/object:Gem::Version
         | 
| 55 49 | 
             
                    version: '0'
         | 
| 56 50 | 
             
              type: :runtime
         | 
| 57 51 | 
             
              prerelease: false
         | 
| 58 52 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 59 | 
            -
                none: false
         | 
| 60 53 | 
             
                requirements:
         | 
| 61 | 
            -
                - -  | 
| 54 | 
            +
                - - ">="
         | 
| 62 55 | 
             
                  - !ruby/object:Gem::Version
         | 
| 63 56 | 
             
                    version: '0'
         | 
| 64 57 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 65 58 | 
             
              name: rspec-rails
         | 
| 66 59 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 67 | 
            -
                none: false
         | 
| 68 60 | 
             
                requirements:
         | 
| 69 | 
            -
                - - ~>
         | 
| 61 | 
            +
                - - "~>"
         | 
| 70 62 | 
             
                  - !ruby/object:Gem::Version
         | 
| 71 63 | 
             
                    version: 2.14.0
         | 
| 72 64 | 
             
              type: :development
         | 
| 73 65 | 
             
              prerelease: false
         | 
| 74 66 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 75 | 
            -
                none: false
         | 
| 76 67 | 
             
                requirements:
         | 
| 77 | 
            -
                - - ~>
         | 
| 68 | 
            +
                - - "~>"
         | 
| 78 69 | 
             
                  - !ruby/object:Gem::Version
         | 
| 79 70 | 
             
                    version: 2.14.0
         | 
| 80 71 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 81 72 | 
             
              name: factory_girl_rails
         | 
| 82 73 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 83 | 
            -
                none: false
         | 
| 84 74 | 
             
                requirements:
         | 
| 85 | 
            -
                - -  | 
| 75 | 
            +
                - - ">="
         | 
| 86 76 | 
             
                  - !ruby/object:Gem::Version
         | 
| 87 77 | 
             
                    version: '0'
         | 
| 88 78 | 
             
              type: :development
         | 
| 89 79 | 
             
              prerelease: false
         | 
| 90 80 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 91 | 
            -
                none: false
         | 
| 92 81 | 
             
                requirements:
         | 
| 93 | 
            -
                - -  | 
| 82 | 
            +
                - - ">="
         | 
| 94 83 | 
             
                  - !ruby/object:Gem::Version
         | 
| 95 84 | 
             
                    version: '0'
         | 
| 96 85 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 97 86 | 
             
              name: database_cleaner
         | 
| 98 87 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 99 | 
            -
                none: false
         | 
| 100 88 | 
             
                requirements:
         | 
| 101 | 
            -
                - -  | 
| 89 | 
            +
                - - ">="
         | 
| 102 90 | 
             
                  - !ruby/object:Gem::Version
         | 
| 103 91 | 
             
                    version: '0'
         | 
| 104 92 | 
             
              type: :development
         | 
| 105 93 | 
             
              prerelease: false
         | 
| 106 94 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 107 | 
            -
                none: false
         | 
| 108 95 | 
             
                requirements:
         | 
| 109 | 
            -
                - -  | 
| 96 | 
            +
                - - ">="
         | 
| 110 97 | 
             
                  - !ruby/object:Gem::Version
         | 
| 111 98 | 
             
                    version: '0'
         | 
| 112 99 | 
             
            description: MoIP integration with Catarse crowdfunding platform
         | 
| @@ -118,9 +105,9 @@ executables: [] | |
| 118 105 | 
             
            extensions: []
         | 
| 119 106 | 
             
            extra_rdoc_files: []
         | 
| 120 107 | 
             
            files:
         | 
| 121 | 
            -
            - .gitignore
         | 
| 122 | 
            -
            - .rspec
         | 
| 123 | 
            -
            - .travis.yml
         | 
| 108 | 
            +
            - ".gitignore"
         | 
| 109 | 
            +
            - ".rspec"
         | 
| 110 | 
            +
            - ".travis.yml"
         | 
| 124 111 | 
             
            - Gemfile
         | 
| 125 112 | 
             
            - Gemfile.lock
         | 
| 126 113 | 
             
            - MIT-LICENSE
         | 
| @@ -194,27 +181,26 @@ files: | |
| 194 181 | 
             
            - test/dummy/script/rails
         | 
| 195 182 | 
             
            homepage: http://github.com/catarse/catarse_moip
         | 
| 196 183 | 
             
            licenses: []
         | 
| 184 | 
            +
            metadata: {}
         | 
| 197 185 | 
             
            post_install_message: 
         | 
| 198 186 | 
             
            rdoc_options: []
         | 
| 199 187 | 
             
            require_paths:
         | 
| 200 188 | 
             
            - lib
         | 
| 201 189 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 202 | 
            -
              none: false
         | 
| 203 190 | 
             
              requirements:
         | 
| 204 | 
            -
              - -  | 
| 191 | 
            +
              - - ">="
         | 
| 205 192 | 
             
                - !ruby/object:Gem::Version
         | 
| 206 193 | 
             
                  version: '0'
         | 
| 207 194 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 208 | 
            -
              none: false
         | 
| 209 195 | 
             
              requirements:
         | 
| 210 | 
            -
              - -  | 
| 196 | 
            +
              - - ">="
         | 
| 211 197 | 
             
                - !ruby/object:Gem::Version
         | 
| 212 198 | 
             
                  version: '0'
         | 
| 213 199 | 
             
            requirements: []
         | 
| 214 200 | 
             
            rubyforge_project: 
         | 
| 215 | 
            -
            rubygems_version:  | 
| 201 | 
            +
            rubygems_version: 2.2.0
         | 
| 216 202 | 
             
            signing_key: 
         | 
| 217 | 
            -
            specification_version:  | 
| 203 | 
            +
            specification_version: 4
         | 
| 218 204 | 
             
            summary: MoIP integration with Catarse
         | 
| 219 205 | 
             
            test_files:
         | 
| 220 206 | 
             
            - spec/controllers/catarse_moip/moip_controller_spec.rb
         |