我正在尝试自定义 uCommerce 和 DIBS 之间的对话以允许票证注册。
到目前为止,我已经成功复制了 DibsPageBuilder 并添加了 maketicket 参数。但是,我需要自定义对 DibsPaymentMethodService 类中的函数 ProcessCallcack 所做的回调。
我仔细复制了 ProcessCallback 及其内容并将其添加到我的自定义类中,但是当我运行结帐管道时,我不断收到以下错误:
UCommerce.Pipelines.PipelineException: Exception occoured while processing pipeline
'UCommerce.Pipelines.Checkout.CheckoutPipeline'. See inner exception for details.
---> System.Security.SecurityException: Payment insufficient to cover order total
for OrderGuid xxx. Please ensure that payments cover the entire value of the order
before checking out. at
Commerce.Pipelines.Checkout.ValidatePaymentsMadeAgainstOrderTotalTask.Execute(PurchaseOrder subject)
at UCommerce.Pipelines.Pipeline`1.Execute(T subject) --- End of inner exception
stack trace ---...
当我使用通常构成该函数的相同代码手动覆盖 ProcessCallback 时,我不明白为什么结帐管道未能成功。换句话说,如果我不覆盖 ProcessCallback 函数运行顺利,但我无法进行自定义。我不得不说,错误发生在我自定义任何东西之前。
我当前的 uCommerce 平台运行版本 2.6.1。我复制的代码是:
public override void ProcessCallback(Payment payment)
{
if (payment.PaymentStatusId != 10000001)
return;
DibsPaymentMethodServiceConfigurationSection instance =
DibsPaymentMethodServiceConfigurationSection.Instance;
string s = HttpContext.Current.Request["transact"];
if (string.IsNullOrEmpty(s))
throw new ArgumentException("transact must be present in query string.");
int result;
if (!int.TryParse(s, out result))
throw new FormatException("transact must be a valid int32");
PaymentStatusCode paymentStatusCode = PaymentStatusCode.Authorized;
if (instance.UseMd5)
{
string parameter1 = this.GetParameter("authkey", "When using md5 \"{0}\" cannot be null or empty", new string[1]
{
"authkey"
});
string parameter2 = this.GetParameter("currency", "When using md5 \"{0}\" cannot be null or empty", new string[1]
{
"currency"
});
string parameter3 = this.GetParameter("amount", "When using md5 \"{0}\" cannot be null or empty", new string[1]
{
"amount"
});
int currencyNumber = new CurrencyCodeTranslater().FromIsoCode(parameter2);
string postMd5Key = new DibsMd5Computer().GetPostMd5Key(result.ToString(), parameter3, currencyNumber);
if (!parameter1.Equals(postMd5Key))
paymentStatusCode = PaymentStatusCode.Declined;
}
payment.PaymentStatus = PaymentStatus.Get((object) paymentStatusCode);
payment.TransactionId = result.ToString();
this.ProcessPaymentRequest(new PaymentRequest(payment.PurchaseOrder, payment));
}
提前谢谢了。
/布林克10