asp.net-mvc - 使用 DirectPost 方法的 Moneris 预授权
问题描述
我在我的产品中集成了一些网关,但我被困在 Moneris (eSelectPlus) 上。问题是,我找不到配置变量来指定我要使用的交易类型(即:PreAuth、PreAuth Complete/Capture、Purchase .. 等)。我从邮递员那里调用这个网址进行测试,
https://esqa.moneris.com/HPPDP/index.php?ps_store_id={{store_id}}&hpp_key={{key}}&charge_total=11.00&order_id=0ec60134-7e2a-49a2-a1f7-a5e66b89862b
大多数网关在这个 url 中有一个配置变量,我在 Moneris 中找不到。
这是我得到的回应,
<form method=POST action="https://www.store.goodbarsecurity.com/checkout_confirmation.php" name="responseForm"><input type="hidden" name="response_order_id" id="response_order_id" value="mdp19272024343p77"><input type="hidden" name="date_stamp" id="date_stamp" value="2019-09-30"><input type="hidden" name="time_stamp" id="time_stamp" value="02:45:34"><input type="hidden" name="bank_transaction_id" id="bank_transaction_id" value="660148420014985290"><input type="hidden" name="charge_total" id="charge_total" value="10.00"><input type="hidden" name="bank_approval_code" id="bank_approval_code" value="755358"><input type="hidden" name="response_code" id="response_code" value="027"><input type="hidden" name="iso_code" id="iso_code" value="01"><input type="hidden" name="message" id="message" value="**APPROVED** * ="><input type="hidden" name="trans_name" id="trans_name" value="purchase"><input type="hidden" name="cardholder" id="cardholder" value=""><input type="hidden" name="f4l4" id="f4l4" value="4242***4242"><input type="hidden" name="card" id="card" value="V"><input type="hidden" name="expiry_date" id="expiry_date" value=""><input type="hidden" name="result" id="result" value="1"><input type="hidden" name="transactionKey" id="transactionKey" value="aP0fIRkTqqTmpEKmtcK1hB9l9HCpQE"></form><div style="display:none;height:1px;width:1px;overflow:hidden"><img src="https://www.offlinx.com/pixel.gif?program_id=directpost&visitor_id=dpp1569825823TXKoULoow6N93uwhh" alt="moneris_logo"> </div><script>
function init()
{
document.responseForm.submit();
}
window.onload=init;
</script>
如您所见,它已获批准但交易类型为“购买”,我希望将此类型更改为“PreAuth”之类的。
解决方案
我通过传递这样的xml字符串解决了这个问题:
在此链接上发布请求
https://esqa.moneris.com/gateway2/servlet/MpgRequest
使用标题:
Content-Type: application/xml
对于 PreAuth 请求 XML 将类似于:
<?xml version="1.0"?>
<request>
<store_id>yourstoreid</store_id>
<api_token>yourapitoken</api_token>
<purchase>
<crypt_type>1</crypt_type>
<order_id>a863eed8-9a79-4e92-892b-06f1bd23c68a</order_id>
<cust_id>testclient1</cust_id>
<amount>11.00</amount>
<pan>4111111111111111</pan>
<expdate>2709</expdate>
<cust_info>
<first_name>eselectplus</first_name>
<last_name>test</last_name>
<address>address1</address>
<city>Mississauga</city>
<country>Canada</country>
<postal_code>ABC 123</postal_code>
<phone_number>123456789</phone_number>
<email>test@test.com</email>
</cust_info>
</purchase>
</request>
要完成此请求,请在同一 URL 上发布完成请求,例如:
<?xml version="1.0"?>
<request>
<store_id>yourstoreid</store_id>
<api_token>yourapitoken</api_token>
<completion>
<order_id>a863eed8-9a79-4e92-892b-06f1bd23c68a</order_id>
<txn_number>24-0_14</txn_number>
<comp_amount>11.00</comp_amount>
<crypt_type>1</crypt_type>
<cust_info>
</cust_info>
</completion>
</request>
我希望这对某人有所帮助。
推荐阅读
- vba - Excel VBA 的表格边距格式不一致
- json - Scala - Circe - 没有类名的案例类序列化
- ffmpeg - 使用ffmpeg命令行工具从yuv44416le到yuv420p10le的色彩空间转换
- firebase - Firebase + Mlab:如何保护两者?
- java - spotify api java [spotify-web-api-java] 的分页示例
- java - Android Firebase 获取所有用户信息问题
- linux - Dockerized nginx 在几秒钟后关闭
- r - 在 BCDating 包中使用 BBQ 功能时出错
- woocommerce - 添加到购物车按钮文本更改基于折扣
- xamarin.forms - FileUploaderPlugin - Android 上的 MultiPartDataMediaFormatterBoundary 错误