我正在做一个购物车。我想在去支付网关之前保存订单。我的支付网关需要我发送一个 POST 到外部地址,而不是如何通过控制器操作来完成。
public function executeBuy(sfWebRequest $request)
{
sfProjectConfiguration::getActive()->loadHelpers('Url');
// save the order
$this->order = new Order();
$this->save
//etc....
//go to TPV Payment gateway
$dsAmount = (float)$order->getPriceWithShipping() * 100;
$dsOrder = (int)$order->getId() * 400;
$dsMerchantCode = (int)sfConfig::get('app_tpv_merchant_code');
$dsCurrency = (int)sfConfig::get('app_tpv_merchant_currency');
$dsMerchantURL = url_for('cart/ipn', true, array(
'sf_culture' => $this->getUser()->getCulture(),
));
$options = array(
'Ds_Merchant_Amount' => $dsAmount,
'Ds_Merchant_Currency' => $dsCurrency,
'Ds_Merchant_Order' => $dsOrder,
'Ds_Merchant_Titular' => $order->getAddress()->getCustomer()->getNameAndLastName(),
'Ds_Merchant_MerchantCode' => $dsMerchantCode,
'Ds_Merchant_MerchantURL' => $dsMerchantURL,
'Ds_Merchant_MerchantSignature' => $digest,
'Ds_Merchant_Terminal' => $dsCurrency
);
//how to send post $options variables to external url?
}