public async Task <int> Run() { if (db.Setting("PushPayEnableImport")) { #if DEBUG Console.WriteLine("Running PushPay Import for " + db.Host); #endif string access_token, refresh_token; access_token = db.GetSetting("PushpayAccessToken", ""); refresh_token = db.GetSetting("PushpayRefreshToken", ""); pushpay = new PushpayConnection(access_token, refresh_token, db); ImportUnreconciled = db.Setting("PushPayImportUnreconciled"); } else { return(0); } #if DEBUG try { return(await RunInternal()); } catch (Exception ex) { Console.WriteLine("PushPay error"); Console.WriteLine(ex.ToString()); Console.ReadKey(); Environment.Exit(1); return(0); } #else return(await RunInternal()); #endif }
public PushpayController(IRequestManager requestManager) : base(requestManager) { PaymentProcessTypes processType = PaymentProcessTypes.OneTimeGiving; try { processType = (PaymentProcessTypes)requestManager.CurrentHttpContext.Session["PaymentProcessType"]; } catch (Exception e) { Console.WriteLine(e.Message); } _pushpay = new PushpayConnection( CurrentDatabase.GetSetting("PushPayAccessToken", ""), CurrentDatabase.GetSetting("PushPayRefreshToken", ""), CurrentDatabase, Configuration.Current.PushpayAPIBaseUrl, Configuration.Current.PushpayClientID, Configuration.Current.PushpayClientSecret, Configuration.Current.OAuth2TokenEndpoint, Configuration.Current.TouchpointAuthServer, Configuration.Current.OAuth2AuthorizeEndpoint); _pushpayPayment = new PushpayPayment(_pushpay, CurrentDatabase, processType); _resolver = new PushpayResolver(_pushpay, CurrentDatabase); _merchantHandle = _pushpayPayment._merchantHandle; _givingLink = $"{Configuration.Current.PushpayGivingLinkBase}/{_merchantHandle}"; }
public PushpayController(IRequestManager requestManager) : base(requestManager) { PaymentProcessTypes processType = PaymentProcessTypes.OneTimeGiving; try { processType = (PaymentProcessTypes)int.Parse(requestManager.SessionProvider.Get <string>("PaymentProcessType")); } catch (Exception e) { Console.WriteLine(e.Message); } _pushpay = new PushpayConnection( CurrentDatabase.GetSetting("PushPayAccessToken", ""), CurrentDatabase.GetSetting("PushPayRefreshToken", ""), CurrentDatabase, Configuration.Current.PushpayAPIBaseUrl, Configuration.Current.PushpayClientID, Configuration.Current.PushpayClientSecret, Configuration.Current.OAuth2TokenEndpoint, Configuration.Current.TouchpointAuthServer, Configuration.Current.OAuth2AuthorizeEndpoint); _pushpayPayment = new PushpayPayment(_pushpay, CurrentDatabase, processType); _resolver = new PushpayResolver(_pushpay, CurrentDatabase); _defaultMerchantHandle = _pushpayPayment._defaultMerchantHandle; _givingLink = Configuration.Current.PushpayGivingLinkBase; _state = CurrentDatabase.Host; isTesting = MultipleGatewayUtils.Setting(CurrentDatabase, "GatewayTesting", (int)processType); if (isTesting) { _ru = "touchpointest"; } else { _ru = Configuration.Current.PushpayRU; } }