killbill-payment-test 4.0.1 → 4.1.0
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 +4 -4
- data/lib/payment_test/api.rb +8 -0
- data/lib/payment_test/application.rb +5 -1
- data/lib/payment_test/state.rb +31 -3
- metadata +8 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a1fca0d5e65d4c027b05794b40b6698bdea292f4
         | 
| 4 | 
            +
              data.tar.gz: 64389b6fc0795780650fb2bd64da5313356b9ca3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2dd32dddfa5476f16356f06b88ed4320e977c6482b45b953e36d3e8c5d1c1fde3807b56f6f7e0bee601de6e30c014905fef8ed45c9afd3a13b7ed5b6b7eedd69
         | 
| 7 | 
            +
              data.tar.gz: a3033fcecf611ece18ec2b2ea602bbcf9d4fb8e9b4c851f2ae8f5e7b9e6f35f9b6f64a6cf505de94308e1107692c0cb26228f15e764bdf955685b0b2d9efa805
         | 
    
        data/lib/payment_test/api.rb
    CHANGED
    
    | @@ -67,6 +67,14 @@ module PaymentTest | |
| 67 67 | 
             
                      PluginPropertyUtils.add_property_if_not_exist(properties, 'TRANSACTION_STATUS', 'ERROR')
         | 
| 68 68 | 
             
                    end
         | 
| 69 69 |  | 
| 70 | 
            +
                    if @state.always_return_plugin_status_pending(method)
         | 
| 71 | 
            +
                      PluginPropertyUtils.add_property_if_not_exist(properties, 'TRANSACTION_STATUS', 'PENDING')
         | 
| 72 | 
            +
                    end
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                    if @state.always_return_plugin_status_canceled(method)
         | 
| 75 | 
            +
                      PluginPropertyUtils.add_property_if_not_exist(properties, 'TRANSACTION_STATUS', 'CANCELED')
         | 
| 76 | 
            +
                    end        
         | 
| 77 | 
            +
             | 
| 70 78 | 
             
                    # Finally make the call
         | 
| 71 79 | 
             
                    @api_control.send method, *args
         | 
| 72 80 | 
             
                  end
         | 
| @@ -26,12 +26,16 @@ post '/plugins/killbill-payment-test/configure', :provides => 'json' do | |
| 26 26 |  | 
| 27 27 | 
             
              action = data['CONFIGURE_ACTION']
         | 
| 28 28 | 
             
              if action.nil?
         | 
| 29 | 
            -
                halt 400, {'Content-Type' => 'text/plain'}, "Invalid json, need to specify one CONFIGURE_ACTION={ACTION_RETURN_PLUGIN_STATUS_ERROR|ACTION_THROW_EXCEPTION|ACTION_RETURN_NIL|ACTION_SLEEP|ACTION_RESET}"
         | 
| 29 | 
            +
                halt 400, {'Content-Type' => 'text/plain'}, "Invalid json, need to specify one CONFIGURE_ACTION={ACTION_RETURN_PLUGIN_STATUS_ERROR|ACTION_RETURN_PLUGIN_STATUS_CANCELED|ACTION_THROW_EXCEPTION|ACTION_RETURN_NIL|ACTION_SLEEP|ACTION_RESET}"
         | 
| 30 30 | 
             
              end
         | 
| 31 31 |  | 
| 32 32 |  | 
| 33 33 | 
             
              if action == 'ACTION_RETURN_PLUGIN_STATUS_ERROR'
         | 
| 34 34 | 
             
                state.configure_always_return_plugin_status_error(data['METHODS'])
         | 
| 35 | 
            +
              elsif action == 'ACTION_RETURN_PLUGIN_STATUS_CANCELED'
         | 
| 36 | 
            +
                state.configure_always_return_plugin_status_canceled(data['METHODS'])
         | 
| 37 | 
            +
              elsif action == 'ACTION_RETURN_PLUGIN_STATUS_PENDING'
         | 
| 38 | 
            +
                state.configure_always_return_plugin_status_pending(data['METHODS'])
         | 
| 35 39 | 
             
              elsif action == 'ACTION_THROW_EXCEPTION'
         | 
| 36 40 | 
             
                state.configure_always_throw(data['METHODS'])
         | 
| 37 41 | 
             
              elsif action == 'ACTION_RETURN_NIL'
         | 
    
        data/lib/payment_test/state.rb
    CHANGED
    
    | @@ -9,6 +9,13 @@ module PaymentTest | |
| 9 9 | 
             
                  reset_configuration
         | 
| 10 10 | 
             
                end
         | 
| 11 11 |  | 
| 12 | 
            +
                def configure_always_return_plugin_status_pending(methods=nil)
         | 
| 13 | 
            +
                  reset_configuration
         | 
| 14 | 
            +
                  configure_methods(methods)
         | 
| 15 | 
            +
                  @always_return_plugin_status_pending = true
         | 
| 16 | 
            +
                  log_current_state
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
             | 
| 12 19 | 
             
                def configure_always_return_plugin_status_error(methods=nil)
         | 
| 13 20 | 
             
                  reset_configuration
         | 
| 14 21 | 
             
                  configure_methods(methods)
         | 
| @@ -16,6 +23,12 @@ module PaymentTest | |
| 16 23 | 
             
                  log_current_state
         | 
| 17 24 | 
             
                end
         | 
| 18 25 |  | 
| 26 | 
            +
                def configure_always_return_plugin_status_canceled(methods=nil)
         | 
| 27 | 
            +
                  reset_configuration
         | 
| 28 | 
            +
                  configure_methods(methods)
         | 
| 29 | 
            +
                  @always_return_plugin_status_canceled = true
         | 
| 30 | 
            +
                  log_current_state
         | 
| 31 | 
            +
                end
         | 
| 19 32 |  | 
| 20 33 | 
             
                def configure_always_throw(methods=nil)
         | 
| 21 34 | 
             
                  reset_configuration
         | 
| @@ -40,6 +53,8 @@ module PaymentTest | |
| 40 53 |  | 
| 41 54 | 
             
                def reset_configuration
         | 
| 42 55 | 
             
                  @always_return_plugin_status_error = false
         | 
| 56 | 
            +
                  @always_return_plugin_status_pending = false
         | 
| 57 | 
            +
                  @always_return_plugin_status_canceled = false
         | 
| 43 58 | 
             
                  @always_throw = false
         | 
| 44 59 | 
             
                  @always_return_nil = false
         | 
| 45 60 | 
             
                  @sleep_time_sec = nil
         | 
| @@ -51,6 +66,14 @@ module PaymentTest | |
| 51 66 | 
             
                  @always_return_plugin_status_error && is_for_method(method)
         | 
| 52 67 | 
             
                end
         | 
| 53 68 |  | 
| 69 | 
            +
                def always_return_plugin_status_pending(method)
         | 
| 70 | 
            +
                  @always_return_plugin_status_pending && is_for_method(method)
         | 
| 71 | 
            +
                end
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                def always_return_plugin_status_canceled(method)
         | 
| 74 | 
            +
                  @always_return_plugin_status_canceled && is_for_method(method)
         | 
| 75 | 
            +
                end
         | 
| 76 | 
            +
             | 
| 54 77 | 
             
                def always_throw(method)
         | 
| 55 78 | 
             
                  @always_throw && is_for_method(method)
         | 
| 56 79 | 
             
                end
         | 
| @@ -65,11 +88,16 @@ module PaymentTest | |
| 65 88 | 
             
                end
         | 
| 66 89 |  | 
| 67 90 | 
             
                def is_clear
         | 
| 68 | 
            -
                  return !@always_return_plugin_status_error && | 
| 91 | 
            +
                  return !@always_return_plugin_status_error &&
         | 
| 92 | 
            +
                      !@always_return_plugin_status_canceled &&
         | 
| 93 | 
            +
                          !@always_return_plugin_status_pending &&
         | 
| 94 | 
            +
                              !@always_throw &&
         | 
| 95 | 
            +
                                  !@always_return_nil &&
         | 
| 96 | 
            +
                                      @sleep_time_sec.nil?
         | 
| 69 97 | 
             
                end
         | 
| 70 98 |  | 
| 71 99 | 
             
                def log_current_state
         | 
| 72 | 
            -
                  puts "PaymentTest:State : @always_return_plugin_status_error = #{@always_return_plugin_status_error}, @always_throw = #{@always_throw}, @always_return_nil = #{@always_return_nil}, @sleep_time_sec = #{@sleep_time_sec}, @methods=#{@methods}"
         | 
| 100 | 
            +
                  puts "PaymentTest:State : @always_return_plugin_status_error = #{@always_return_plugin_status_error}, @always_return_plugin_status_canceled = #{@always_return_plugin_status_canceled}, @always_return_plugin_status_pending=#{@always_return_plugin_status_pending}, @always_throw = #{@always_throw}, @always_return_nil = #{@always_return_nil}, @sleep_time_sec = #{@sleep_time_sec}, @methods=#{@methods}"
         | 
| 73 101 | 
             
                end
         | 
| 74 102 |  | 
| 75 103 | 
             
                private
         | 
| @@ -85,4 +113,4 @@ module PaymentTest | |
| 85 113 | 
             
                  @methods.include? method.to_s
         | 
| 86 114 | 
             
                end
         | 
| 87 115 | 
             
              end
         | 
| 88 | 
            -
            end
         | 
| 116 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: killbill-payment-test
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 4.0 | 
| 4 | 
            +
              version: 4.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Kill Bill core team
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017- | 
| 11 | 
            +
            date: 2017-06-30 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -212,6 +212,9 @@ dependencies: | |
| 212 212 | 
             
                - - ">="
         | 
| 213 213 | 
             
                  - !ruby/object:Gem::Version
         | 
| 214 214 | 
             
                    version: 10.0.0
         | 
| 215 | 
            +
                - - "<"
         | 
| 216 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 217 | 
            +
                    version: '11.0'
         | 
| 215 218 | 
             
              name: rake
         | 
| 216 219 | 
             
              prerelease: false
         | 
| 217 220 | 
             
              type: :development
         | 
| @@ -220,6 +223,9 @@ dependencies: | |
| 220 223 | 
             
                - - ">="
         | 
| 221 224 | 
             
                  - !ruby/object:Gem::Version
         | 
| 222 225 | 
             
                    version: 10.0.0
         | 
| 226 | 
            +
                - - "<"
         | 
| 227 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 228 | 
            +
                    version: '11.0'
         | 
| 223 229 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 224 230 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 225 231 | 
             
                requirements:
         |