チケットの登録を許可するために、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));
}
よろしくお願いします。
/brinck10