public void ProcessPayment(PaymentInfo paymentInfo, Customer customer, Guid orderGuid, ref ProcessPaymentResult processPaymentResult)
{
TransactMode transactionMode = GetCurrentTransactionMode();
if (transactionMode == TransactMode.Authorize)
{
AuthorizeOrSale(paymentInfo, customer, orderGuid, processPaymentResult, true);
if (!String.IsNullOrEmpty(processPaymentResult.Error))
return;
}
else
{
AuthorizeOrSale(paymentInfo, customer, orderGuid, processPaymentResult, false);
if (!String.IsNullOrEmpty(processPaymentResult.Error))
return;
}
}
if (!String.IsNullOrEmpty(processPaymentResult.Error))
return;
doesn't seem to do anything. The AuthorizeOrSale() calls vary only by one argument. I believe can condense to:
public void ProcessPayment(PaymentInfo paymentInfo, Customer customer, Guid orderGuid, ref ProcessPaymentResult processPaymentResult)
{
TransactMode transactionMode = GetCurrentTransactionMode();
AuthorizeOrSale(paymentInfo, customer, orderGuid, processPaymentResult, authorizeOnly: transactionMode == TransactMode.Authorize);
}