【发布时间】:2019-11-20 15:11:54
【问题描述】:
我在我的 API 中使用条带连接,我想更新现有的 paymentIntent。 API 的官方库提供了这些方法。
public PaymentIntent Get(string paymentIntentId,
PaymentIntentGetOptions options = null, RequestOptions requestOptions = null)
public PaymentIntent Update(string paymentIntentId,
PaymentIntentUpdateOptions options, RequestOptions requestOptions = null);
我唯一想更新资源的是目的地,所以我在意识到没有简单的方法之前就开始这样做了:
var paymentIntentService = new PaymentIntentService();
var paymentIntent = paymentIntentService.Get(transaction.ExternalTransactionId);
if (null != destinationStripeAccount)
{
paymentIntent.TransferData.DestinationId = destinationStripeAccount.AccountId;
}
//This takes in a PaymentIntentUpdateOptions instead of a paymentIntent WTF
paymentIntentService.Update(paymentIntent.Id, new PaymentIntentUpdateOptions { });
PaymentIntent 不是 PaymentIntentUpdate 选项,因此我需要将所有值映射到另一个。我宁愿不需要安装像 AutoMapper 这样的附加依赖项,手动映射字段会很麻烦。
有谁知道是否有一种方法可以只更新目的地,或者有一种简单的方法来更新付款意图?
【问题讨论】:
-
不只需要在更新选项对象中提供需要更改的内容吗?
-
我看看能不能找到那个对象的源代码并确认
标签: c# stripe-payments