我正在尝试创建定期付款资料。我能够成功创建订阅。现在我想通过初始付款创建订阅。我添加了以下代码:
CurrencyCodeType currency = (CurrencyCodeType)Enum.Parse(typeof(CurrencyCodeType), "USD");
BasicAmountType intialPaymentAmount = new BasicAmountType(currency, "4000");
scheduleDetails.ActivationDetails.InitialAmount = intialPaymentAmount;
但是上面的代码会抛出null引用对象错误。
这确实让我错误:
scheduleDetails.ActivationDetails.InitialAmount = intialPaymentAmount;
但在调试模式下,intialPaymentAmount
中有所有内容。
我做错了什么?
答案 0 :(得分:1)
这样我解决了问题
BasicAmountType intialPaymentAmount = new BasicAmountType(currency, "4000");
ActivationDetailsType acd = new ActivationDetailsType();
acd.InitialAmount = intialPaymentAmount;
acd.FailedInitialAmountAction = FailedPaymentActionType.CANCELONFAILURE;
scheduleDetails.ActivationDetails = acd;