private function getRefundURL($paymentDetails) {
		if (!is_object($paymentDetails))
			throw new Exception("Invalid payment details in getRefundURL");
		if (!is_array($paymentDetails->transactions))
			throw new Exception("Invalid transaction list in getRefundURL");
		foreach ($paymentDetails->transactions as $transact) {
			if (!is_array($transact->related_resources))
				throw new Exception("Invalid related resources in getRefundURL");
			foreach ($transact->related_resources as $res) {
				if (!is_array($res->sale->links))
					throw new Exception("Invalid related links in getRefundURL");
				foreach ($res->sale->links as $link) {
					if ($link->rel == 'refund')
						return $link->href;
				}
			}
		}
		throw new Exception("Missing refund URL in getRefundURL");
	}
private function getRefundURL($paymentDetails) {
		if (!is_object($paymentDetails))
			throw new Exception("Invalid payment details in getRefundURL");
		if (!is_array($paymentDetails->transactions))
			throw new Exception("Invalid transaction list in getRefundURL");
		foreach ($paymentDetails->transactions as $transact) {
			if (!is_array($transact->related_resources))
				throw new Exception("Invalid related resources in getRefundURL");
			foreach ($transact->related_resources as $res) {
				if (!is_array($res->sale->links))
					throw new Exception("Invalid related links in getRefundURL");
				foreach ($res->sale->links as $link) {
					if ($link->rel == 'refund')
						return $link->href;
				}
			}
		}
		throw new Exception("Missing refund URL in getRefundURL");
	}
private function getRefundURL ( $ paymentDetails ) { if ( ! is_object ( $ paymentDetails ) ) throw new Exception ( "Invalid payment details in getRefundURL" ) ; if ( ! is_array ( $ paymentDetails -> transactions ) ) throw new Exception ( "Invalid transaction list in getRefundURL" ) ; foreach ( $ paymentDetails -> transactions as $ transact ) { if ( ! is_array ( $ transact -> related_resources ) ) throw new Exception ( "Invalid related resources in getRefundURL" ) ; foreach ( $ transact -> related_resources as $ res ) { if ( ! is_array ( $ res -> sale -> links ) ) throw new Exception ( "Invalid related links in getRefundURL" ) ; foreach ( $ res -> sale -> links as $ link ) { if ( $ link -> rel == 'refund' ) return $ link -> href ; } } } throw new Exception ( "Missing refund URL in getRefundURL" ) ; }
Process a JSON parsed payment object, and locate the refund URL for that payment
@param object $paymentDetails Payment object
@return string refund URL
@throws Exception if the data does not look like a valid payment object, or if the object does not have a refund url
Process a JSON parsed payment object and locate the refund URL for that payment