title: Intercepting $http responses and passing back new brand new responses
body: <p>I'm creating an eCommerce store that will have to support multiple payment gateways. One of these payment gateways include the National Australian Bank, which doesn't include an API which communicates with HTTP codes and JSON. Instead, it responds with just text and a status of 200 even if a transaction fails. </p>
  
  <p>In my application I'm using the $http provider to handle these responses, but it will always fire the success function, thus I need to somehow intercept the response before deciding if it's a success or failure. </p>
  
  <p>Here's how it's set up:</p>
  
  <p>// Controller</p>
  
  <pre><code>PaymentService.submit(payment_info).then(function(resp){
    // Do stuff on success
  })
  </code></pre>
  
  <p>// PaymentService#submit</p>
  
  <pre><code>payment.submit = function(data) {
    var strategy;
  
    // general payment codez
  
    if (CURRENT_COUNTRY == 'au') {
      strategy = PaymentStrategy.nab.submit(card.number, card.cvv, card.exp_year, card.exp_month);
    }
  
    return strategy;
  }
  </code></pre>
  
  <p>// PaymentStrategy.nab#submit</p>
  
  <pre><code>service.submit = function(number, cvv, exp_year, exp_month) {
  
    // payment codez specific to NAB
  
    return $http.post(resource_path, $httpParamSerializerJQLike(payload), { headers: headers })
  }
  </code></pre>
  
  <p>So the issue is that PaymentService.submit is the promise that was passed back from PaymentStrategy.nab. However that promise will always fire the success callback because the response is always 200 even if the payment failed (that's house National Australian Bank's current system works. It's supposed to be submitted with an HTML form). </p>
  
  <p>I want the PaymentService.submit method to work for any payment gateway - so I need the promise that is passed back to always behave the same. The only place these kinds of unique configurations should occur is within their own strategies. </p>
  
  <p>With all that said, how can I get a response from NAB, normalize that response, and then back another proper response back down the chain?</p>