这对我来说很容易复制,就像在下面的例子中包括或不包括几行一样简单。
customerProfilePaymentType transProfile = new customerProfilePaymentType
{
customerProfileId = _custProfileId,
paymentProfile = new paymentProfile { paymentProfileId = _paymentProfileId }
};
transactionRequestType trans = new transactionRequestType
{
transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),
amount = TotalAmount,
profile = transProfile,
order = new orderType
{
description = "Test Description",
invoiceNumber = "Invoice #"
}
};
createTransactionRequest chargeReq = new createTransactionRequest { transactionRequest = trans };
createTransactionController chargeCntl = new createTransactionController(chargeReq);
chargeCntl.Execute();
_chargeResp = chargeCntl.GetApiResponse();
好的..所以这个很简单。在此代码的末尾,_chargeResp的值为null。但是,如果我只注释掉以“order = new orderType”开头的5行,那么代码运行就好了。
我可能只是在这里不理解某些事情,所以希望有人可以指出我正确的方向。
答案 0 :(得分:1)
这不是一个答案,但我没有足够的代表来评论。我猜测它与你的设置有关,因为我的沙盒测试对我有用(虽然我使用等效的VB语法而不是C#)。
Dim transactionRequest = New transactionRequestType() With { _
.transactionType = transactionTypeEnum.authCaptureTransaction.ToString(), _
.amount = amount, _
.payment = paymentType, _
.billTo = billingAddress, _
.order = New orderType With { _
.description = "Test Description", _
.invoiceNumber = "Invoice #" _
} _
}
确认电子邮件中的那两行也有我发送的信息:
=========订购信息=========
发票:发票#
描述:测试说明
金额:56.22(USD)
付款方式:Visa xxxx1111
交易类型:授权和捕获