private ValidationResult ReadyToCreateOrder(long shopifyOrderId) { var output = new CreateOrderValidation(); var orderRecord = _syncOrderRepository.RetrieveShopifyOrderWithNoTracking(shopifyOrderId); var order = _shopifyJsonService.RetrieveOrder(shopifyOrderId); var settings = _settingsRepository.RetrieveSettings(); // If the Starting Shopify Order weren't populated, we would not be here i.e. // ... the Shopify Order would not have been pulled from API // output.SettingsStartingOrderId = settings.ShopifyOrderId.Value; output.ShopifyOrderRecord = orderRecord; output.ShopifyOrder = order; BuildLineItemValidations(output, settings); output.ShopifyShippingRateName = order.MaybeShippingRateTitle; output.HasValidShippingRate = _settingsRepository.RateMappingExists(order.MaybeShippingRateTitle); if (orderRecord.HasPayment()) { output.ShopifyPaymentGatewayId = orderRecord.PaymentTransaction().ShopifyGateway; output.HasValidGateway = _settingsRepository.GatewayExistsInConfig(output.ShopifyPaymentGatewayId); } return(output.Result()); }
private PaymentValidationContext BuildContext(ShopifyTransaction currentTransaction) { var output = new PaymentValidationContext(); output.CurrentTransaction = currentTransaction; output.ValidPaymentGateway = _settingsRepository.GatewayExistsInConfig(currentTransaction.ShopifyGateway); return(output); }