uCommerce - Integrating uCommerce with a Payment Provider
Dear Support
Now, I already Integrate uCommerce with a Payment Provider but I've some problem when we create payment I'm not found referenceId in payment, here is code:
/// <summary>
/// Creates a new payment fully initialized.
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public override Payment CreatePayment(PaymentRequest request)
{
var payment = base.CreatePayment(request);
payment.ReferenceId = GetReferenceId(request);
payment.PaymentStatus = PaymentStatus.Get((int)PaymentStatusCode.PendingAuthorization);
payment.TransactionId = null;
payment["paymentGuid"] = Guid.NewGuid().ToString();
request.PurchaseOrder.AddPayment(payment);
payment.Save();
return payment;
}
/// <summary>
/// Gets the reference id.
/// </summary>
/// <remarks>
/// This is the OrderNumber of the <see cref="PurchaseOrder">purchase order</see> if set, else the order number series named "Default Payment Reference" is used for the reference id.
/// </remarks>
/// <param name="paymentRequest">The payment request.</param>
/// <returns></returns>
protected virtual string GetReferenceId(PaymentRequest paymentRequest)
{
string usedOrderId; // placeholder for the orderId used in this context.
if (!string.IsNullOrEmpty(paymentRequest.PurchaseOrder.OrderNumber))
usedOrderId = paymentRequest.PurchaseOrder.OrderNumber;
else
{
var numberSeriesService = ObjectFactory.Instance.Resolve<INumberSeriesService>();
string orderNumber = numberSeriesService.GetNumber("Default Payment Reference");
usedOrderId = orderNumber;
}
return usedOrderId;
}
Above code is comming from ExternalPaymentMethodService which all our paymentproviders derrive from. So if you do the same thing, then you can just call base.CreatePayment, and then the referenceId should've been set.
uCommerce - Integrating uCommerce with a Payment Provider
Dear Support
Now, I already Integrate uCommerce with a Payment Provider but I've some problem when we create payment I'm not found referenceId in payment, here is code:
Thank you for help!!!
Best regards,
Paul
Hello Paul,
ReferenceId can be set by the following:
Above code is comming from ExternalPaymentMethodService which all our paymentproviders derrive from. So if you do the same thing, then you can just call base.CreatePayment, and then the referenceId should've been set.
Best regards
Morten
is working on a reply...