Skip to content

Commit

Permalink
Merge pull request #147 from ketangarala/Issues/Issue-50
Browse files Browse the repository at this point in the history
SI: PayPal Express Authorize Setting Not Creating Authorizations #50
  • Loading branch information
Will Strohl authored Jul 27, 2018
2 parents 630aaec + fe7f1d0 commit 5dd7920
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,10 @@ public override bool ProcessCheckout(OrderTaskContext context)
EventLog.LogEvent("PayPal Express Checkout", "CartReturnUrl=" + cartReturnUrl, EventLogSeverity.Information);

PaymentActionCodeType mode = PaymentActionCodeType.Authorization;
if (context.HccApp.CurrentStore.Settings.PayPal.ExpressAuthorizeOnly)
{
mode = PaymentActionCodeType.Order;
}
else
if (!context.HccApp.CurrentStore.Settings.PayPal.ExpressAuthorizeOnly)
{
mode = PaymentActionCodeType.Sale;
}
}

// Accelerated boarding
if (string.IsNullOrWhiteSpace(context.HccApp.CurrentStore.Settings.PayPal.UserName))
Expand Down
8 changes: 7 additions & 1 deletion Libraries/Hotcakes.Commerce/Payment/Methods/PaypalExpress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,16 @@ public bool Authorize(Transaction t, HotcakesApplication app)
{
var OrderNumber = t.MerchantInvoiceNumber + Guid.NewGuid();

PaymentActionCodeType mode = PaymentActionCodeType.Authorization;
if (!app.CurrentStore.Settings.PayPal.ExpressAuthorizeOnly)
{
mode = PaymentActionCodeType.Sale;
}

var paymentResponse = ppAPI.DoExpressCheckoutPayment(t.PreviousTransactionNumber,
t.PreviousTransactionAuthCode,
t.Amount.ToString("N", CultureInfo.InvariantCulture),
PaymentActionCodeType.Order,
mode,
PayPalAPI.GetCurrencyCodeType(app.CurrentStore.Settings.PayPal.Currency),
OrderNumber);

Expand Down

0 comments on commit 5dd7920

Please sign in to comment.