mollie - 调用 Mollie webhook URL 但未获取付款 ID
问题描述
我们已经创建了问题,这与 https://github.com/mollie/api-documentation/issues/583 类似
我们已经在请求中设置了 webhook URL 的 id 参数,但是每次我们得到的 id 都是空的,所以我的问题是 id 参数是我们传递还是你方传递了参数?让我知道我们现在遇到了大麻烦。
创建付款响应
{
"resource": "payment",
"id": "tr_pCHpdCbpb5",
"mode": "test",
"createdAt": "2020-01-24T09:40:18+00:00",
"amount": {
"value": "100.10",
"currency": "EUR"
},
"description": "46-201800046",
"method": null,
"metadata": null,
"status": "open",
"isCancelable": false,
"expiresAt": "2020-01-24T09:55:18+00:00",
"profileId": "pfl_wv9K6uRbg7",
"sequenceType": "oneoff",
"redirectUrl": "http://localhost:60991/nl-nl/OrderValidation?paymentType=mollie",
"webhookUrl": "https://devee05.solvisoft.net/api/mollie/webhook",
"_links": {
"self": {
"href": "https://api.mollie.com/v2/payments/tr_pCHpdCbpb5",
"type": "application/hal+json"
},
"checkout": {
"href": "https://www.mollie.com/payscreen/select-method/pCHpdCbpb5",
"type": "text/html"
},
"documentation": {
"href": "https://docs.mollie.com/reference/v2/payments-api/create-payment",
"type": "text/html"
}
}
}
当我们支付特定于支付方式的金额时,Webhook URL 自动调用但我们每次都获得 id 为空,但我们检测或自动映射当前创建的支付 id?在 webhook URL 中。
解决方案
大家好,我正在使用获取 webhook URL 数据Request content
public virtual HttpResponseMessage Webhook(string id)
{
StringBuilder sb = new StringBuilder();
string filePath = System.Web.Hosting.HostingEnvironment.MapPath("~/MollieLog/MollieStatus.txt");
HttpContent requestContent = Request.Content;
string jsonContent = requestContent.ReadAsStringAsync().Result;
sb.AppendLine("Request content - " + jsonContent);
try
{
string mollieResponse = new MollieService(_apiKey).Get(string.Concat("payments/", id));
sb.AppendLine("ID - " + id);
sb.AppendLine("Current Date Time " + DateTime.Now);
sb.AppendLine(mollieResponse);
sb.AppendLine(Newtonsoft.Json.JsonConvert.SerializeObject(Request.Headers));
sb.AppendLine("---------------------------------------");
File.AppendAllText(filePath, sb.ToString());
sb.Clear();
}
catch (Exception ex)
{
sb.AppendLine("Error " + ex.Message);
File.AppendAllText(filePath, sb.ToString());
}
return Request.CreateResponse(HttpStatusCode.OK);
}
输出
Request content - id=tr_dCCujJWqK9
推荐阅读
- python - 全局 requests.Session 对象的缺点
- javascript - Vue/Bootstrap 复选框,一次只能选中一个
- erlang - 为什么 Erlang 中的模式匹配记录会抛出错误
- spring - Spring Cloud Gateway - 每个路由的安全配置。客户端注册时动态重新加载
- powershell - 通过 powershell、DOS、任务序列等远程锁定 OSD 计算机
- python - pyspark 'DataFrame' 对象没有属性 '_get_object_id'
- javascript - 如何过滤和检索 Firebase 实时数据库中的嵌套子项?
- c++ - 为什么这种到 int 的转换会给出错误的结果
- arrays - np.asarray 错误:无法将输入数组从形状 (2,2) 广播到形状 (2)
- javascript - VideoJS 的实时用户界面——任何手动操作搜索行为的方法?