public void TestCredentials(APIResponse apiResponse) { V2SettingsGenerator seetingsGen = new V2SettingsGenerator(GetProvider()); try { _plugin.TestCredentials(seetingsGen.GetSettings()); apiResponse.isSucess = true; apiResponse.ErrorSource = CCError.CCErrorSource.None; apiResponse.Messages = null; } catch (V2.CCProcessingException e) { apiResponse.ErrorSource = CCError.CCErrorSource.ProcessingCenter; apiResponse.isSucess = false; if (apiResponse.Messages.Keys.Contains("Exception")) { apiResponse.Messages["Exception"] = e.Message; } else { apiResponse.Messages.Add("Exception", e.Message); } } }
private void CheckWebhook() { V2SettingsGenerator seetingsGen = new V2SettingsGenerator(_provider); if (!CCProcessingFeatureHelper.IsFeatureSupported(_plugin.GetType(), CCProcessingFeature.WebhookManagement)) { PXTrace.WriteInformation("Skip check webhook. Plugin doesn't implement this feature."); return; } V2.ICCWebhookProcessor processor = _plugin.CreateProcessor <V2.ICCWebhookProcessor>(seetingsGen.GetSettings()); if (!processor.WebhookEnabled) { PXTrace.WriteInformation("Skip check webhook. This feature is disabled."); return; } string eCompanyName = V2.CCServiceEndpointHelper.EncodeUrlSegment(CompanyName); string eProcCenter = V2.CCServiceEndpointHelper.EncodeUrlSegment(ProcessingCenterId); string url = V2.CCServiceEndpointHelper.GetEndpointUrl(eCompanyName, eProcCenter); if (url == null || url.Contains("localhost")) { PXTrace.WriteInformation($"Skip check webhook. Not valid Url: {url}"); return; } bool result = checkUrl.IsMatch(url); if (!result) { PXTrace.WriteInformation($"Skip check webhook. Not valid Url: {url}"); return; } IEnumerable <V2.Webhook> list = processor.GetAttachedWebhooks(); V2.Webhook res = list.Where(i => i.Url == url).FirstOrDefault(); if (res == null) { string name = "AcumaticaWebhook"; PXTrace.WriteInformation($"Webhook not found. Performing add webhook with name = {name}, url = {url}"); V2.Webhook webhook = new V2.Webhook(); webhook.Enable = true; webhook.Events = new List <V2.WebhookEvent>() { V2.WebhookEvent.CreateAuthTran, V2.WebhookEvent.CreateAuthCaptureTran, }; webhook.Name = name; webhook.Url = url; processor.AddWebhook(webhook); } }
private V2.ICCProfileProcessor GetProcessor() { V2SettingsGenerator settingsGen = new V2SettingsGenerator(_provider); V2.ICCProfileProcessor processor = _plugin.CreateProcessor <V2.ICCProfileProcessor>(settingsGen.GetSettings()); if (processor == null) { string errorMessage = PXMessages.LocalizeFormatNoPrefixNLA( Messages.FeatureNotSupportedByProcessing, CCProcessingFeature.ProfileManagement); throw new PXException(errorMessage); } return(processor); }
private T GetProcessor <T>() where T : class { V2SettingsGenerator seetingsGen = new V2SettingsGenerator(_provider); T processor = _plugin.CreateProcessor <T>(seetingsGen.GetSettings()); if (processor == null) { string errorMessage = PXMessages.LocalizeFormatNoPrefixNLA( Messages.FeatureNotSupportedByProcessing, CCProcessingFeature.ExtendedProfileManagement); throw new PXException(errorMessage); } return(processor); }
public void TestCredentials(V1.APIResponse apiResponse) { V2SettingsGenerator seetingsGen = new V2SettingsGenerator(_provider); try { _plugin.TestCredentials(seetingsGen.GetSettings()); V1ProcessingDTOGenerator.ApiResponseSetSuccess(apiResponse); } catch (V2.CCProcessingException e) { V1ProcessingDTOGenerator.ApiResponseSetError(apiResponse, e); } }
private V2.ICCHostedFormProcessor GetProcessor() { if (HttpContext.Current.Request.UrlReferrer != null && HttpContext.Current.Request.UrlReferrer.Scheme != System.Uri.UriSchemeHttps) { throw new PXException(CCProcessingBase.Messages.MustUseHttps); } V2SettingsGenerator seetingsGen = new V2SettingsGenerator(_provider); V2.ICCHostedFormProcessor processor = _plugin.CreateProcessor <V2.ICCHostedFormProcessor>(seetingsGen.GetSettings()); if (processor == null) { string errorMessage = PXMessages.LocalizeFormatNoPrefixNLA( Messages.FeatureNotSupportedByProcessing, CCProcessingFeature.HostedForm); throw new PXException(errorMessage); } return(processor); }
public V1.ProcessingResult DoTransaction(V1.CCTranType aTranType, V1.ProcessingInput inputData) { V2SettingsGenerator seetingsGen = new V2SettingsGenerator(_provider); V2.ICCTransactionProcessor processor = _plugin.CreateProcessor <V2.ICCTransactionProcessor>(seetingsGen.GetSettings()); V1.ProcessingResult result = null; if (processor == null) { string errorMessage = PXMessages.LocalizeFormatNoPrefixNLA( Messages.FeatureNotSupportedByProcessing, CCProcessingFeature.Base); result = V1ProcessingDTOGenerator.GetProcessingResult(errorMessage); return(result); } var inputGenerator = new V2ProcessingInputGenerator(_provider); var processingInput = inputGenerator.GetProcessingInput(aTranType, inputData); V2.ProcessingResult v2Result = processor.DoTransaction(processingInput); result = V1ProcessingDTOGenerator.GetProcessingResult(v2Result); return(result); }