1
我正在嘗試將柑橘支付網關集成到我在zend中編寫的應用程序中。我正在使用柑橘旅館結帳。我在控制器中生成簽名,然後傳遞這些值以查看錶單的創建位置。 控制器代碼:如何在zend中集成柑橘支付網關?
$formPostUrl = "https://sandbox.citruspay.com/sslperf/your-vanityUrlPart";
$secret_key = "xxxxxx"; // your secret key
$vanityUrl = "xxx"; // your vanity url
$merchantTxnId = uniqid();
$orderAmount = "1.00";
$currency = "INR";
$TransactionData= $vanityUrl.$orderAmount.$merchantTxnId.$currency;
$securitySignature = hash_hmac('sha1', $TransactionData, $secret_key);
$data = [
'formPostUrl' => $formPostUrl,
'vanityUrl' => $vanityUrl,
'merchantTxnId' => $merchantTxnId,
'orderAmount' => $orderAmount,
'currency' => $currency,
'securitySignature' => $securitySignature,
'returnUrl' => $this->hostName.'/'.'paymentResponse'
];
return new ViewModel ($data);
查看代碼:
<form align="center" method="post" action="<?php echo $formPostUrl;?>">
<input ng-model="amount" type="number"class="form-control" id="orderAmount" name="orderAmount" placeholder="Enter the amount here.." required min="1" />
<input type="hidden" id="merchantTxnId" name="merchantTxnId" value="<?php echo $merchantTxnId;?>" />
<input type="hidden" id="currency" name="currency" value="<?php echo $currency;?>" />
<input type="hidden" name="returnUrl" value="<?php echo $returnUrl;?>" />
<input type="hidden" id="secSignature" name="secSignature" value="<?php echo $securitySignature;?>" />
<input type="Submit" value="Pay Now"/>
</form>
但這裏的問題是,securitySignature使用量創建代碼寫在控制器,但我不得不採取金額從用戶喜歡的形式這應該是可見的。我無法在視圖中創建安全簽名,因爲它需要security_key,出於安全原因,我無法在視圖中寫入安全簽名。有沒有什麼辦法從視圖我可以發送數額控制器,然後在控制器發出一個POST請求formPostUrl這也重定向到formPostUrl就像我們提出的請求,也重定向到該URL。