/** * Executes multiple refunds with the provided payment gateway * @param \Omnipay\Common\GatewayInterface $gateway Omnipay payment gateway * @param Model_Brand_Refund[] $refunds * @param array $params pass this to the gateway * @return \Omnipay\Common\Message\ResponseInterface $response payment gateway response */ public function execute_multiple_refunds(GatewayInterface $gateway, array $refunds, array $params = array()) { $params = Arr::merge($this->convert_multiple_refunds($refunds), $params); $response = $gateway->refund($params)->send(); $raw_response = $response->getData(); $status = $response->isSuccessful() ? Model_Brand_Refund::TRANSACTION_REFUNDED : NULL; foreach ($refunds as $refund) { $refund->raw_response = $raw_response; $refund->transaction_status = $status; } return $response; }