├── .deployment ├── module │ ├── argoDeploy.json │ └── cloudDeploy.json └── samples │ └── argoDeploy.json ├── .editorconfig ├── .gitattributes ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE.md ├── pull_request_template.md └── workflows │ ├── deploy-pr.yml │ ├── deploy.yml │ ├── module-ci.yml │ ├── module-release-hotfix.yml │ ├── msteams.yml │ ├── publish-nugets.yml │ └── release.yml ├── .gitignore ├── .nuke └── parameters.json ├── .swagger-codegen-ignore ├── CONTRIBUTING.md ├── Directory.Build.props ├── LICENSE ├── README.md ├── VirtoCommerce.OrdersModule.sln ├── VirtoCommerce.OrdersModule.sln.DotSettings ├── docs ├── How-to extend validation.md ├── index.md ├── media │ ├── diagram-add-roles-and-permissions.png │ ├── diagram-assign-role-with-permissions.png │ ├── diagram-db-model.png │ ├── diagram-order-module-structure.png │ ├── entity-data-model.png │ ├── screen-assign-permissions-to-order-manager.png │ ├── screen-assign-permissions.png │ ├── screen-cancel-order-notification.png │ ├── screen-control-items.png │ ├── screen-create-order-notification.png │ ├── screen-customer-orders.png │ ├── screen-fullfilment-center.png │ ├── screen-invoice-for-customer-order.png │ ├── screen-line-items.png │ ├── screen-new-order-status-notification.png │ ├── screen-order-details.png │ ├── screen-order-documents1.png │ ├── screen-order-number-template.png │ ├── screen-order-paid-notification.png │ ├── screen-order-payment-number-template.png │ ├── screen-order-sent-notification.png │ ├── screen-order-shipment-document-widgets.png │ ├── screen-order-shipment-number-template.png │ ├── screen-order-widgets.png │ ├── screen-payment-document-details.png │ ├── screen-payment-document-widgets.png │ ├── screen-permission-name.png │ ├── screen-select-bounded-scope.png │ ├── screen-select-stores.png │ ├── screen-shipment-details.png │ └── screen-shipment-document.png ├── order-details.md ├── order-documents.md ├── order-module-notification-types.md ├── order-widgets.md └── roles-and-permissions-scenarios.md ├── mkdocs.yml ├── module.ignore ├── samples ├── README.md └── VirtoCommerce.OrdersModule2.Web │ ├── Authorization │ ├── CustomOrderAuthorizationHandler.cs │ ├── Extensions │ │ └── PermissionExtensions.cs │ └── OrderSelectedStatusScope.cs │ ├── Content │ └── logo.png │ ├── Extensions │ └── ServiceCollectionExtension.cs │ ├── Localizations │ ├── en.VirtoCommerce.Orders2.json │ └── ru.VirtoCommerce.Orders2.json │ ├── Migrations │ ├── 20200324130250_InitialOrders2.Designer.cs │ ├── 20200324130250_InitialOrders2.cs │ ├── 20230920143534_UpdateInvoice.Designer.cs │ ├── 20230920143534_UpdateInvoice.cs │ └── Order2DbContextModelSnapshot.cs │ ├── Model │ ├── CustomerOrder2.cs │ ├── CustomerOrder2Entity.cs │ ├── Invoice.cs │ ├── InvoiceEntity.cs │ └── LineItem2Entity.cs │ ├── Module.cs │ ├── ModuleConstants.cs │ ├── Properties │ └── launchSettings.json │ ├── Repositories │ ├── DesignTimeDbContextFactory.cs │ ├── Order2DbContext.cs │ └── OrderRepository2.cs │ ├── Scripts │ ├── blades │ │ ├── invoice-detail.js │ │ └── invoice-detail.tpl.html │ ├── order2.js │ └── tree-template.html │ ├── Validation │ └── LineItemValidator.cs │ ├── VirtoCommerce.OrdersModule2.Web.csproj │ ├── _module.manifest │ ├── package-lock.json │ ├── package.json │ └── webpack.config.js ├── src ├── VirtoCommerce.OrdersModule.Core │ ├── Events │ │ ├── OrderChangeEvent.cs │ │ ├── OrderChangedEvent.cs │ │ ├── PaymentChangeEvent.cs │ │ ├── PaymentChangedEvent.cs │ │ ├── ShipmentChangeEvent.cs │ │ └── ShipmentChangedEvent.cs │ ├── Extensions │ │ └── ConfigurationExtensions.cs │ ├── Model │ │ ├── Address.cs │ │ ├── AuditableAttribute.cs │ │ ├── CancelledState.cs │ │ ├── Capture.cs │ │ ├── CaptureItem.cs │ │ ├── CaptureOrderPaymentRequest.cs │ │ ├── CaptureOrderPaymentResult.cs │ │ ├── CaptureStatus.cs │ │ ├── ConfigurationItem.cs │ │ ├── ConfigurationItemFile.cs │ │ ├── CustomerOrder.cs │ │ ├── CustomerOrderResponseGroup.cs │ │ ├── DashboardStatisticsResult.cs │ │ ├── FeeDetail.cs │ │ ├── HtmlToPdfOptions.cs │ │ ├── IHasFeesDetalization.cs │ │ ├── LineItem.cs │ │ ├── OrderOperation.cs │ │ ├── OrderOperationStatusChangedEntry.cs │ │ ├── OrderPaymentInfo.cs │ │ ├── OrderPaymentRequest.cs │ │ ├── OrderPaymentResult.cs │ │ ├── PaymentDistributedLockOptions.cs │ │ ├── PaymentErrorDescriber.cs │ │ ├── PaymentFlowErrorCodes.cs │ │ ├── PaymentGatewayTransaction.cs │ │ ├── PaymentIn.cs │ │ ├── PurchasedProduct.cs │ │ ├── PurchasedProductsGroupedRequest.cs │ │ ├── PurchasedProductsRequest.cs │ │ ├── PurchasedProductsResult.cs │ │ ├── Refund.cs │ │ ├── RefundItem.cs │ │ ├── RefundOrderPaymentRequest.cs │ │ ├── RefundOrderPaymentResult.cs │ │ ├── RefundReasonCode.cs │ │ ├── Search │ │ │ ├── CustomerOrderHistorySearchCriteria.cs │ │ │ ├── CustomerOrderIndexedSearchCriteria.cs │ │ │ ├── CustomerOrderIndexedSearchResult.cs │ │ │ ├── CustomerOrderSearchCriteria.cs │ │ │ ├── CustomerOrderSearchResult.cs │ │ │ ├── OrderAggregation.cs │ │ │ ├── OrderAggregationItem.cs │ │ │ ├── OrderAggregationLabel.cs │ │ │ ├── OrderOperationSearchCriteriaBase.cs │ │ │ ├── PaymentSearchCriteria.cs │ │ │ ├── PaymentSearchResult.cs │ │ │ ├── ShipmentSearchCriteria.cs │ │ │ └── ShipmentSearchResult.cs │ │ ├── Shipment.cs │ │ ├── ShipmentItem.cs │ │ └── ShipmentPackage.cs │ ├── ModuleConstants.cs │ ├── Notifications │ │ ├── CancelOrderEmailNotification.cs │ │ ├── InvoiceEmailNotification.cs │ │ ├── NewOrderStatusEmailNotification.cs │ │ ├── OrderCreateEmailNotification.cs │ │ ├── OrderEmailNotificationBase.cs │ │ ├── OrderPaidEmailNotification.cs │ │ ├── OrderSentEmailNotification.cs │ │ ├── PaymentStatusChangedEmailNotification.cs │ │ └── ShipmentStatusChangedEmailNotification.cs │ ├── Search │ │ └── Indexed │ │ │ └── IIndexedCustomerOrderSearchService.cs │ ├── Services │ │ ├── ICustomerOrderBuilder.cs │ │ ├── ICustomerOrderSearchService.cs │ │ ├── ICustomerOrderService.cs │ │ ├── ICustomerOrderStatisticService.cs │ │ ├── ICustomerOrderTotalsCalculator.cs │ │ ├── IMemberOrdersService.cs │ │ ├── IPaymentFlowService.cs │ │ ├── IPaymentSearchService.cs │ │ ├── IPaymentService.cs │ │ ├── IPurchasedProductsService.cs │ │ ├── IShipmentSearchService.cs │ │ └── IShipmentService.cs │ └── VirtoCommerce.OrdersModule.Core.csproj ├── VirtoCommerce.OrdersModule.Data.MySql │ ├── CaptureEntityConfiguration.cs │ ├── CustomerOrderEntityConfiguration.cs │ ├── DiscountEntityConfiguration.cs │ ├── FeeDetailEntityConfiguration.cs │ ├── LineItemEntityConfiguration.cs │ ├── Migrations │ │ ├── 20230221142500_Initial.Designer.cs │ │ ├── 20230221142500_Initial.cs │ │ ├── 20230329093626_AddRefunds.Designer.cs │ │ ├── 20230329093626_AddRefunds.cs │ │ ├── 20230329093732_AddOrderTimestamp.Designer.cs │ │ ├── 20230329093732_AddOrderTimestamp.cs │ │ ├── 20230406145631_AddOrderLineItemStatus.Designer.cs │ │ ├── 20230406145631_AddOrderLineItemStatus.cs │ │ ├── 20230417134455_SetProductNameLength1024.Designer.cs │ │ ├── 20230417134455_SetProductNameLength1024.cs │ │ ├── 20230504164555_AddTransactionId.Designer.cs │ │ ├── 20230504164555_AddTransactionId.cs │ │ ├── 20230510123916_ChangeOrderRefundDeleteBehavior.Designer.cs │ │ ├── 20230510123916_ChangeOrderRefundDeleteBehavior.cs │ │ ├── 20230713073621_AddCaptures.Designer.cs │ │ ├── 20230713073621_AddCaptures.cs │ │ ├── 20230725060649_AddShipmentItemStatus.Designer.cs │ │ ├── 20230725060649_AddShipmentItemStatus.cs │ │ ├── 20230911181734_AddProductOuterId.Designer.cs │ │ ├── 20230911181734_AddProductOuterId.cs │ │ ├── 20231018130044_IsAnonymous.Designer.cs │ │ ├── 20231018130044_IsAnonymous.cs │ │ ├── 20231204102834_CloseTransaction.Designer.cs │ │ ├── 20231204102834_CloseTransaction.cs │ │ ├── 20240531125743_ResizeAddressFields.Designer.cs │ │ ├── 20240531125743_ResizeAddressFields.cs │ │ ├── 20240610080959_AddressDescription.Designer.cs │ │ ├── 20240610080959_AddressDescription.cs │ │ ├── 20241104115901_RemoveRequiredFromAddressFields.Designer.cs │ │ ├── 20241104115901_RemoveRequiredFromAddressFields.cs │ │ ├── 20241108155732_OrderPromotionName.Designer.cs │ │ ├── 20241108155732_OrderPromotionName.cs │ │ ├── 20241121125717_AddConfigurationItems.Designer.cs │ │ ├── 20241121125717_AddConfigurationItems.cs │ │ ├── 20241205094730_AddIsDiscountAmountRounded.Designer.cs │ │ ├── 20241205094730_AddIsDiscountAmountRounded.cs │ │ ├── 20250213093006_AddOrderConfigurationItemTypeAndText.Designer.cs │ │ ├── 20250213093006_AddOrderConfigurationItemTypeAndText.cs │ │ ├── 20250303124409_AddOrderConfigurationItemFile.Designer.cs │ │ ├── 20250303124409_AddOrderConfigurationItemFile.cs │ │ ├── 20250428174804_AddAddressMiddleName.Designer.cs │ │ ├── 20250428174804_AddAddressMiddleName.cs │ │ ├── 20250519151138_AddIndexForOuterId.Designer.cs │ │ ├── 20250519151138_AddIndexForOuterId.cs │ │ └── OrderDbContextModelSnapshot.cs │ ├── MySqlDataAssemblyMarker.cs │ ├── MySqlDbContextFactory.cs │ ├── PaymentGatewayTransactionEntityConfiguration.cs │ ├── PaymentInEntityConfiguration.cs │ ├── Readme.md │ ├── RefundEntityConfiguration.cs │ ├── ShipmentEntityConfiguration.cs │ ├── TaxDetailEntityConfiguration.cs │ └── VirtoCommerce.OrdersModule.Data.MySql.csproj ├── VirtoCommerce.OrdersModule.Data.PostgreSql │ ├── CustomerOrderEntityConfiguration.cs │ ├── Migrations │ │ ├── 20230221142522_Initial.Designer.cs │ │ ├── 20230221142522_Initial.cs │ │ ├── 20230329093543_AddRefunds.Designer.cs │ │ ├── 20230329093543_AddRefunds.cs │ │ ├── 20230329093838_AddOrderTimestamp.Designer.cs │ │ ├── 20230329093838_AddOrderTimestamp.cs │ │ ├── 20230406145645_AddOrderLineItemStatus.Designer.cs │ │ ├── 20230406145645_AddOrderLineItemStatus.cs │ │ ├── 20230417134541_SetProductNameLength1024.Designer.cs │ │ ├── 20230417134541_SetProductNameLength1024.cs │ │ ├── 20230504163400_AddTransactionId.Designer.cs │ │ ├── 20230504163400_AddTransactionId.cs │ │ ├── 20230510124005_ChangeOrderRefundDeleteBehavior.Designer.cs │ │ ├── 20230510124005_ChangeOrderRefundDeleteBehavior.cs │ │ ├── 20230516181949_AddCaptures.Designer.cs │ │ ├── 20230516181949_AddCaptures.cs │ │ ├── 20230620095341_FixRowVersion.Designer.cs │ │ ├── 20230620095341_FixRowVersion.cs │ │ ├── 20230725060727_AddShipmentItemStatus.Designer.cs │ │ ├── 20230725060727_AddShipmentItemStatus.cs │ │ ├── 20230911181748_AddProductOuterId.Designer.cs │ │ ├── 20230911181748_AddProductOuterId.cs │ │ ├── 20231018130007_IsAnonymous.Designer.cs │ │ ├── 20231018130007_IsAnonymous.cs │ │ ├── 20231204102736_CloseTransaction.Designer.cs │ │ ├── 20231204102736_CloseTransaction.cs │ │ ├── 20240531125842_ResizeAddressFields.Designer.cs │ │ ├── 20240531125842_ResizeAddressFields.cs │ │ ├── 20240610081022_AddressDescription.Designer.cs │ │ ├── 20240610081022_AddressDescription.cs │ │ ├── 20241104115928_RemoveRequiredFromAddressFields.Designer.cs │ │ ├── 20241104115928_RemoveRequiredFromAddressFields.cs │ │ ├── 20241108155806_OrderPromotionName.Designer.cs │ │ ├── 20241108155806_OrderPromotionName.cs │ │ ├── 20241121125805_AddConfigurationItems.Designer.cs │ │ ├── 20241121125805_AddConfigurationItems.cs │ │ ├── 20241205094652_AddIsDiscountAmountRounded.Designer.cs │ │ ├── 20241205094652_AddIsDiscountAmountRounded.cs │ │ ├── 20250213093142_AddOrderConfigurationItemTypeAndText.Designer.cs │ │ ├── 20250213093142_AddOrderConfigurationItemTypeAndText.cs │ │ ├── 20250303124454_AddOrderConfigurationItemFile.Designer.cs │ │ ├── 20250303124454_AddOrderConfigurationItemFile.cs │ │ ├── 20250428174852_AddAddressMiddleName.Designer.cs │ │ ├── 20250428174852_AddAddressMiddleName.cs │ │ ├── 20250519151116_AddIndexForOuterId.Designer.cs │ │ ├── 20250519151116_AddIndexForOuterId.cs │ │ └── OrderDbContextModelSnapshot.cs │ ├── PostgreSqlCustomerOrderStatisticService.cs │ ├── PostgreSqlDataAssemblyMarker.cs │ ├── PostgreSqlDbContextFactory.cs │ ├── Readme.md │ └── VirtoCommerce.OrdersModule.Data.PostgreSql.csproj ├── VirtoCommerce.OrdersModule.Data.SqlServer │ ├── Migrations │ │ ├── 20000000000000_UpdateOrdersV2.Designer.cs │ │ ├── 20000000000000_UpdateOrdersV2.cs │ │ ├── 20190530163834_InitialOrders.Designer.cs │ │ ├── 20190530163834_InitialOrders.cs │ │ ├── 20190613201702_AddOrderOuterId.Designer.cs │ │ ├── 20190613201702_AddOrderOuterId.cs │ │ ├── 20190715095225_AddOrderDynamicPropertyObjectValue.Designer.cs │ │ ├── 20190715095225_AddOrderDynamicPropertyObjectValue.cs │ │ ├── 20200409175753_AddOrderAddressName.Designer.cs │ │ ├── 20200409175753_AddOrderAddressName.cs │ │ ├── 20200901081052_PurchaseOrderNumber.Designer.cs │ │ ├── 20200901081052_PurchaseOrderNumber.cs │ │ ├── 20210512162446_AddOrderFulfillmentCenterId.Designer.cs │ │ ├── 20210512162446_AddOrderFulfillmentCenterId.cs │ │ ├── 20210911072238_AddAddressOuterId.Designer.cs │ │ ├── 20210911072238_AddAddressOuterId.cs │ │ ├── 20210915122904_AddCancelledStatae.Designer.cs │ │ ├── 20210915122904_AddCancelledStatae.cs │ │ ├── 20220112135938_AddFees.Designer.cs │ │ ├── 20220112135938_AddFees.cs │ │ ├── 20220408123000_ParentOperationId.Designer.cs │ │ ├── 20220408123000_ParentOperationId.cs │ │ ├── 20220614122254_AddShipmentTrackingInformation.Designer.cs │ │ ├── 20220614122254_AddShipmentTrackingInformation.cs │ │ ├── 20220626054330_AddFeeDetail.Designer.cs │ │ ├── 20220626054330_AddFeeDetail.cs │ │ ├── 20220629152654_AddFeeFields.Designer.cs │ │ ├── 20220629152654_AddFeeFields.cs │ │ ├── 20220929143342_ChangeDecimalsPrecision.Designer.cs │ │ ├── 20220929143342_ChangeDecimalsPrecision.cs │ │ ├── 20221223154901_ChangeProductIdLength.Designer.cs │ │ ├── 20221223154901_ChangeProductIdLength.cs │ │ ├── 20221226121725_ChangeSkuLength.Designer.cs │ │ ├── 20221226121725_ChangeSkuLength.cs │ │ ├── 20221229153308_AddVendorId.Designer.cs │ │ ├── 20221229153308_AddVendorId.cs │ │ ├── 20230124135725_AddLineItemVendorId.Designer.cs │ │ ├── 20230124135725_AddLineItemVendorId.cs │ │ ├── 20230221142849_RenameIndex.Designer.cs │ │ ├── 20230221142849_RenameIndex.cs │ │ ├── 20230313002724_AddRefunds.Designer.cs │ │ ├── 20230313002724_AddRefunds.cs │ │ ├── 20230327230730_AddOrderTimestamp.Designer.cs │ │ ├── 20230327230730_AddOrderTimestamp.cs │ │ ├── 20230406145524_AddOrderLineItemStatus.Designer.cs │ │ ├── 20230406145524_AddOrderLineItemStatus.cs │ │ ├── 20230417134611_SetProductNameLength1024.Designer.cs │ │ ├── 20230417134611_SetProductNameLength1024.cs │ │ ├── 20230504162915_AddTransactionId.Designer.cs │ │ ├── 20230504162915_AddTransactionId.cs │ │ ├── 20230510122621_ChangeOrderRefundDeleteBehavior.Designer.cs │ │ ├── 20230510122621_ChangeOrderRefundDeleteBehavior.cs │ │ ├── 20230516115524_AddCaptures.Designer.cs │ │ ├── 20230516115524_AddCaptures.cs │ │ ├── 20230714115506_AddShipmentItemStatus.Designer.cs │ │ ├── 20230714115506_AddShipmentItemStatus.cs │ │ ├── 20230911181802_AddProductOuterId.Designer.cs │ │ ├── 20230911181802_AddProductOuterId.cs │ │ ├── 20231018125853_IsAnonymous.Designer.cs │ │ ├── 20231018125853_IsAnonymous.cs │ │ ├── 20231204102652_CloseTransaction.Designer.cs │ │ ├── 20231204102652_CloseTransaction.cs │ │ ├── 20240531125923_ResizeAddressFields.Designer.cs │ │ ├── 20240531125923_ResizeAddressFields.cs │ │ ├── 20240610080923_AddressDescription.Designer.cs │ │ ├── 20240610080923_AddressDescription.cs │ │ ├── 20241104115949_RemoveRequiredFromAddressFields.Designer.cs │ │ ├── 20241104115949_RemoveRequiredFromAddressFields.cs │ │ ├── 20241108155834_OrderPromotionName.Designer.cs │ │ ├── 20241108155834_OrderPromotionName.cs │ │ ├── 20241121082404_AddConfigurationItems.Designer.cs │ │ ├── 20241121082404_AddConfigurationItems.cs │ │ ├── 20241205094527_AddIsDiscountAmountRounded.Designer.cs │ │ ├── 20241205094527_AddIsDiscountAmountRounded.cs │ │ ├── 20250213093447_AddOrderConfigurationItemTypeAndText.Designer.cs │ │ ├── 20250213093447_AddOrderConfigurationItemTypeAndText.cs │ │ ├── 20250303124512_AddOrderConfigurationItemFile.Designer.cs │ │ ├── 20250303124512_AddOrderConfigurationItemFile.cs │ │ ├── 20250428174920_AddAddressMiddleName.Designer.cs │ │ ├── 20250428174920_AddAddressMiddleName.cs │ │ ├── 20250519151045_AddIndexForOuterId.Designer.cs │ │ ├── 20250519151045_AddIndexForOuterId.cs │ │ └── OrderDbContextModelSnapshot.cs │ ├── Readme.md │ ├── SqlServerDataAssemblyMarker.cs │ ├── SqlServerDbContextFactory.cs │ └── VirtoCommerce.OrdersModule.Data.SqlServer.csproj ├── VirtoCommerce.OrdersModule.Data │ ├── Authorization │ │ ├── OnlyOrderResponsibleScope.cs │ │ ├── OrderAuthorizationRequirement.cs │ │ └── OrderSelectedStoreScope.cs │ ├── Caching │ │ ├── OrderCacheRegion.cs │ │ └── OrderSearchCacheRegion.cs │ ├── ExportImport │ │ └── OrderExportImport.cs │ ├── Extensions │ │ └── OperationExtensions.cs │ ├── Handlers │ │ ├── AdjustInventoryOrderChangedEventHandler.cs │ │ ├── CancelPaymentOrderChangedEventHandler.cs │ │ ├── IndexCustomerOrderChangedEventHandler.cs │ │ ├── IndexPurchasedProductsCustomerOrderChangedEventHandler.cs │ │ ├── LogChangesOrderChangedEventHandler.cs │ │ ├── PurchasedProductIndexationSettingChangedEventHandler.cs │ │ └── SendNotificationsOrderChangedEventHandler.cs │ ├── Model │ │ ├── AddressEntity.cs │ │ ├── CaptureEntity.cs │ │ ├── CaptureItemEntity.cs │ │ ├── ConfigurationItemEntity.cs │ │ ├── ConfigurationItemFileEntity.cs │ │ ├── CustomerOrderEntity.cs │ │ ├── DiscountEntity.cs │ │ ├── FeeDetailEntity.cs │ │ ├── ISupportPartialPriceUpdate.cs │ │ ├── LineItemEntity.cs │ │ ├── OperationEntity.cs │ │ ├── OrderDynamicPropertyObjectValueEntity.cs │ │ ├── PaymentGatewayTransactionEntity.cs │ │ ├── PaymentInEntity.cs │ │ ├── RefundEntity.cs │ │ ├── RefundItemEntity.cs │ │ ├── ShipmentEntity.cs │ │ ├── ShipmentItemEntity.cs │ │ ├── ShipmentPackageEntity.cs │ │ └── TaxDetailEntity.cs │ ├── Repositories │ │ ├── IOrderRepository.cs │ │ ├── OrderDbContext.cs │ │ └── OrderRepository.cs │ ├── Search │ │ └── Indexed │ │ │ ├── CustomerOrderChangesProvider.cs │ │ │ ├── CustomerOrderDocumentBuilder.cs │ │ │ ├── CustomerOrderSearchRequestBuilder.cs │ │ │ ├── FilterHelper.cs │ │ │ ├── IndexedCustomerOrderSearchService.cs │ │ │ ├── PurchasedProductsChangesProvider.cs │ │ │ ├── PurchasedProductsDocumentBuilder.cs │ │ │ └── PurchasedProductsIndexConfigurator.cs │ ├── Services │ │ ├── CustomerOrderBuilder.cs │ │ ├── CustomerOrderSearchService.cs │ │ ├── CustomerOrderService.cs │ │ ├── CustomerOrderStatisticService.cs │ │ ├── DefaultCustomerOrderTotalsCalculator.cs │ │ ├── PaymentFlowService.cs │ │ ├── PaymentSearchService.cs │ │ ├── PaymentService.cs │ │ ├── PurchasedProductsService.cs │ │ ├── ShipmentSearchService.cs │ │ └── ShipmentService.cs │ ├── Validators │ │ └── PaymentRequestValidator.cs │ └── VirtoCommerce.OrdersModule.Data.csproj └── VirtoCommerce.OrdersModule.Web │ ├── Authorization │ └── OrderAuthorizationHandler.cs │ ├── Content │ ├── css │ │ └── orderModule.css │ ├── logo.png │ └── order-statistic.svg │ ├── Controllers │ └── Api │ │ ├── OrderModuleController.cs │ │ ├── OrderModulePaymentsController.cs │ │ └── OrderModuleShipmentsController.cs │ ├── Extensions │ └── ServiceCollectionExtensions.cs │ ├── JsonConverters │ └── PolymorphicOperationJsonConverter.cs │ ├── Localizations │ ├── de.VirtoCommerce.Orders.json │ ├── en.VirtoCommerce.Orders.json │ ├── es.VirtoCommerce.Orders.json │ ├── fr.VirtoCommerce.Orders.json │ ├── it.VirtoCommerce.Orders.json │ ├── ja.VirtoCommerce.Orders.json │ ├── pl.VirtoCommerce.Orders.json │ ├── pt.VirtoCommerce.Orders.json │ ├── ru.VirtoCommerce.Orders.json │ └── zh.VirtoCommerce.Orders.json │ ├── Model │ ├── KeyValuePair.cs │ └── PaymentCallbackParameters.cs │ ├── Module.cs │ ├── NotificationTemplates │ ├── CancelOrderEmailNotification_body.html │ ├── CancelOrderEmailNotification_sample.json │ ├── CancelOrderEmailNotification_subject.txt │ ├── InvoiceEmailNotification_body.html │ ├── InvoiceEmailNotification_sample.json │ ├── InvoiceEmailNotification_subject.txt │ ├── NewOrderStatusEmailNotification_body.html │ ├── NewOrderStatusEmailNotification_sample.json │ ├── NewOrderStatusEmailNotification_subject.txt │ ├── OrderCreateEmailNotification_body.html │ ├── OrderCreateEmailNotification_sample.json │ ├── OrderCreateEmailNotification_subject.txt │ ├── OrderPaidEmailNotification_body.html │ ├── OrderPaidEmailNotification_sample.json │ ├── OrderPaidEmailNotification_subject.txt │ ├── OrderSentEmailNotification_body.html │ ├── OrderSentEmailNotification_sample.json │ ├── OrderSentEmailNotification_subject.txt │ ├── PaymentStatusChangedEmailNotification_body.html │ ├── PaymentStatusChangedEmailNotification_subject.txt │ ├── ShipmentStatusChangedEmailNotification_body.html │ └── ShipmentStatusChangedEmailNotification_subject.txt │ ├── Properties │ └── launchSettings.json │ ├── Scripts │ ├── blades │ │ ├── addresses │ │ │ ├── address-details.js │ │ │ ├── address-details.tpl.html │ │ │ ├── address-list.js │ │ │ └── address-list.tpl.html │ │ ├── capture-add.html │ │ ├── capture-add.js │ │ ├── capture-detail.html │ │ ├── capture-detail.js │ │ ├── customerOrder-change-log.js │ │ ├── customerOrder-change-log.tpl.html │ │ ├── customerOrder-detail.js │ │ ├── customerOrder-detail.tpl.html │ │ ├── customerOrder-item-configuration-files.js │ │ ├── customerOrder-item-configuration-files.tpl.html │ │ ├── customerOrder-item-configuration-products.js │ │ ├── customerOrder-item-configuration-products.tpl.html │ │ ├── customerOrder-item-configuration-texts.js │ │ ├── customerOrder-item-configuration-texts.tpl.html │ │ ├── customerOrder-item-configuration.js │ │ ├── customerOrder-item-configuration.tpl.html │ │ ├── customerOrder-item-detail.js │ │ ├── customerOrder-item-detail.tpl.html │ │ ├── customerOrder-item-dicsounts.js │ │ ├── customerOrder-item-dicsounts.tpl.html │ │ ├── customerOrder-items-select.js │ │ ├── customerOrder-items-select.tpl.html │ │ ├── customerOrder-items.js │ │ ├── customerOrder-items.tpl.html │ │ ├── customerOrder-list.js │ │ ├── customerOrder-list.tpl.html │ │ ├── filter-detail.js │ │ ├── filter-detail.tpl.html │ │ ├── operation-comment.js │ │ ├── operation-comment.tpl.html │ │ ├── operation-detail.js │ │ ├── payment-detail.js │ │ ├── payment-detail.tpl.html │ │ ├── payment-transactions-detail.js │ │ ├── payment-transactions-detail.tpl.html │ │ ├── payment-transactions-list.js │ │ ├── payment-transactions-list.tpl.html │ │ ├── refund-add.html │ │ ├── refund-add.js │ │ ├── refund-detail.html │ │ ├── refund-detail.js │ │ ├── shipment-detail.js │ │ ├── shipment-detail.tpl.html │ │ ├── shipment-items.js │ │ └── shipment-items.tpl.html │ ├── dialogs │ │ └── cancelOperation-dialog.tpl.html │ ├── directives │ │ └── maskMoney.js │ ├── order.js │ ├── resources │ │ ├── customerOrders.js │ │ └── fulfillmentCenters.js │ ├── services │ │ ├── refundReasons.js │ │ ├── showPriceFilter.js │ │ └── statusTranslation.js │ ├── widgets │ │ ├── customerOrder-address-widget.js │ │ ├── customerOrder-address-widget.tpl.html │ │ ├── customerOrder-change-log-widget.js │ │ ├── customerOrder-change-log-widget.tpl.html │ │ ├── customerOrder-item-configuration-widget.js │ │ ├── customerOrder-item-configuration-widget.tpl.html │ │ ├── customerOrder-item-discounts-widget.js │ │ ├── customerOrder-item-discounts-widget.tpl.html │ │ ├── customerOrder-items-widget.js │ │ ├── customerOrder-items-widget.tpl.html │ │ ├── customerOrder-list-widget.js │ │ ├── customerOrder-list-widget.tpl.html │ │ ├── customerOrder-totals-widget.js │ │ ├── customerOrder-totals-widget.tpl.html │ │ ├── dashboard │ │ │ ├── statistics-templates.html │ │ │ └── statistics-widget.js │ │ ├── notificationsLogWidget.js │ │ ├── notificationsLogWidget.tpl.html │ │ ├── operation-comment-widget.js │ │ ├── operation-comment-widget.tpl.html │ │ ├── operation-tree-widget.js │ │ ├── operation-tree-widget.tpl.html │ │ ├── payment-address-widget.js │ │ ├── payment-address-widget.tpl.html │ │ ├── payment-totals-widget.js │ │ ├── payment-totals-widget.tpl.html │ │ ├── payment-transactions-widget.js │ │ ├── payment-transactions-widget.tpl.html │ │ ├── shipment-address-widget.js │ │ ├── shipment-address-widget.tpl.html │ │ ├── shipment-items-widget.js │ │ ├── shipment-items-widget.tpl.html │ │ ├── shipment-totals-widget.js │ │ └── shipment-totals-widget.tpl.html │ └── wizards │ │ └── newOperation │ │ ├── newOperation-wizard.js │ │ └── newOperation-wizard.tpl.html │ ├── Validation │ ├── CustomerOrderValidator.cs │ └── PaymentInValidator.cs │ ├── VirtoCommerce.OrdersModule.Web.csproj │ ├── module.manifest │ ├── package-lock.json │ ├── package.json │ └── webpack.config.js └── tests └── VirtoCommerce.OrdersModule.Tests ├── CancelPaymentOrderTests.cs ├── CheckingResponseGroup.cs ├── CustomerOrderBuilderUnitTests.cs ├── CustomerOrderServiceImplIntegrationTests.cs ├── CustomerOrderServiceUnitTests.cs ├── CustomerOrderTests.cs ├── LogChangesOrderTests.cs ├── MigrationScenarios.cs ├── OrderOperationPricePatchingTests.cs ├── OrderTotalsCalculationTest.cs ├── SequencesScenarios.cs ├── VirtoCommerce.OrdersModule.Tests.csproj └── ZeroPrices.cs /.deployment/module/argoDeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "artifactKey": "VirtoCommerce.Orders", 3 | "deployRepo": "vc-deploy-dev", 4 | "cmPath": "platform-dev/resources/deployment-cm.yaml", 5 | "dev": { 6 | "deployAppName": "vcplatform-dev", 7 | "deployBranch": "dev", 8 | "environmentId": "dev", 9 | "environmentName": "Development", 10 | "environmentType": "staging", 11 | "environmentUrl": "https://vcplatform-platform.dev.govirto.com/" 12 | }, 13 | "qa": { 14 | "deployAppName": "vcplatform-qa", 15 | "deployBranch": "qa", 16 | "environmentId": "qa", 17 | "environmentName": "QA", 18 | "environmentType": "testing", 19 | "environmentUrl": "https://vcplatform-platform.qa.govirto.com/" 20 | }, 21 | "prod": { 22 | "deployAppName": "vcplatform-demo", 23 | "deployBranch": "demo", 24 | "environmentId": "prod", 25 | "environmentName": "Demo", 26 | "environmentType": "production", 27 | "environmentUrl": "https://vcplatform-platform.demo.govirto.com/" 28 | } 29 | } -------------------------------------------------------------------------------- /.deployment/module/cloudDeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "artifactKey": "VirtoCommerce.Orders", 3 | "deployRepo": "vc-deploy-dev", 4 | "cmPath": "backend/packages.json", 5 | "dev": { 6 | "deployAppName": "vcptcore-dev", 7 | "deployBranch": "vcptcore-dev", 8 | "environmentId": "dev", 9 | "environmentName": "Development", 10 | "environmentType": "staging", 11 | "environmentUrl": "https://vcptcore-dev.govirto.com/" 12 | }, 13 | "qa": { 14 | "deployAppName": "vcptcore-qa", 15 | "deployBranch": "vcptcore-qa", 16 | "environmentId": "qa", 17 | "environmentName": "QA", 18 | "environmentType": "testing", 19 | "environmentUrl": "https://vcptcore-qa.govirto.com/" 20 | }, 21 | "prod": { 22 | "deployAppName": "vcptcore-demo", 23 | "deployBranch": "vcptcore-demo", 24 | "environmentId": "prod", 25 | "environmentName": "Demo", 26 | "environmentType": "production", 27 | "environmentUrl": "https://vcptcore-demo.govirto.com/" 28 | } 29 | } -------------------------------------------------------------------------------- /.deployment/samples/argoDeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "artifactKey": "VirtoCommerce.OrdersSample", 3 | "deployRepo": "vc-deploy-dev", 4 | "cmPath": "platform-dev/resources/deployment-cm.yaml", 5 | "dev": { 6 | "deployAppName": "vcplatform-dev", 7 | "deployBranch": "dev", 8 | "environmentId": "dev", 9 | "environmentName": "Development", 10 | "environmentType": "development", 11 | "environmentUrl": "https://vcplatform-platform.dev.govirto.com/" 12 | }, 13 | "qa": { 14 | "deployAppName": "vcplatform-qa", 15 | "deployBranch": "qa", 16 | "environmentId": "qa", 17 | "environmentName": "QA", 18 | "environmentType": "testing", 19 | "environmentUrl": "https://vcplatform-platform.qa.govirto.com/" 20 | }, 21 | "prod": { 22 | "deployAppName": "vcplatform-demo", 23 | "deployBranch": "master", 24 | "environmentId": "prod", 25 | "environmentName": "Demo", 26 | "environmentType": "production", 27 | "environmentUrl": "https://vcplatform-platform.demo.govirto.com/" 28 | } 29 | } -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Common settings 2 | 3 | .github/* @VirtoCommerce/platform 4 | .gitignore @VirtoCommerce/platform 5 | .dockerignore @VirtoCommerce/platform 6 | 7 | # Main Code and Tests 8 | 9 | src/* @VirtoCommerce/platform 10 | tests/* @VirtoCommerce/platform 11 | .editorconfig @VirtoCommerce/platform 12 | 3rd-party-components.md @VirtoCommerce/platform 13 | VirtoCommerce.Platform.sln @VirtoCommerce/platform 14 | 15 | # Docs 16 | docs/* @VirtoCommerce/platform 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Please provide detailed information about your issue, thank you! 2 | 3 | Version info: 4 | - Browser version: 5 | - Platform version: 6 | - Module version: 7 | 8 | ### Expected behavior 9 | 10 | ### Actual behavior 11 | 12 | ### Steps to reproduce 13 | 1. 14 | 2. 15 | 3. 16 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | ## References 4 | ### QA-test: 5 | ### Jira-link: 6 | ### Artifact URL: 7 | -------------------------------------------------------------------------------- /.github/workflows/publish-nugets.yml: -------------------------------------------------------------------------------- 1 | # v3.800.12 2 | # https://virtocommerce.atlassian.net/browse/VCST-2469 3 | name: Publish nuget 4 | 5 | on: 6 | workflow_dispatch: 7 | inputs: 8 | publishAlpha: 9 | description: 'Publish nuget as alpha version.' 10 | required: true 11 | default: true 12 | type: boolean 13 | 14 | jobs: 15 | test: 16 | uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.800.12 17 | secrets: 18 | sonarToken: ${{ secrets.SONAR_TOKEN }} 19 | 20 | build: 21 | uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.800.12 22 | with: 23 | uploadPackage: 'true' 24 | uploadDocker: 'false' 25 | forceVersionSuffix: ${{ github.event.inputs.publishAlpha }} 26 | secrets: 27 | envPAT: ${{ secrets.REPO_TOKEN }} 28 | 29 | publish-nuget: 30 | needs: 31 | [build, test] 32 | uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.800.12 33 | with: 34 | fullKey: ${{ needs.build.outputs.packageFullKey }} 35 | forceGithub: false 36 | forceBlob: true 37 | secrets: 38 | envPAT: ${{ secrets.GITHUB_TOKEN }} 39 | nugetKey: ${{ secrets.NUGET_KEY }} 40 | BLOB_TOKEN: ${{ secrets.BLOB_TOKEN }} 41 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | # v3.800.12 2 | # https://virtocommerce.atlassian.net/browse/VCST-2469 3 | name: Release 4 | 5 | on: 6 | workflow_dispatch: 7 | 8 | jobs: 9 | release: 10 | uses: VirtoCommerce/.github/.github/workflows/release.yml@v3.800.12 11 | secrets: 12 | envPAT: ${{ secrets.REPO_TOKEN }} -------------------------------------------------------------------------------- /.nuke/parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./build.schema.json", 3 | "Solution": "VirtoCommerce.OrdersModule.sln" 4 | } -------------------------------------------------------------------------------- /.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen 3 | 4 | # Use this file to prevent files from being overwritten by the generator. 5 | # The patterns follow closely to .gitignore or .dockerignore. 6 | 7 | # As an example, the C# client generator defines ApiClient.cs. 8 | # You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: 9 | #ApiClient.cs 10 | 11 | # You can match any string of characters against a directory, file or extension with a single asterisk (*): 12 | #foo/*/qux 13 | # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux 14 | 15 | # You can recursively match patterns against a directory, file or extension with a double asterisk (**): 16 | #foo/**/qux 17 | # Thsi matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux 18 | 19 | # You can also negate patterns with an exclamation (!). 20 | # For example, you can ignore all files in a docs folder with the file extension .md: 21 | #docs/*.md 22 | # Then explicitly reverse the ignore rule for a single file: 23 | #!docs/README.md 24 | 25 | VirtoCommerce.CoreModule.Client/Properties/AssemblyInfo.cs 26 | VirtoCommerce.CoreModule.Client/VirtoCommerce.CoreModule.Client.csproj 27 | VirtoCommerce.CoreModule.Client/VirtoCommerce.CoreModule.Client.nuspec 28 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing 2 | ----------- 3 | We welcome & recognize contributors to Virto Commerce. There are many benefits available for our contributers, from special licensing to project involvement and access to private repositories. Follow the guide below to contribute: 4 | 5 | 1. Before starting work on a new contribution, take a moment and search the commits and issues for similar proposals. 6 | 2. Fork the Virto Commerce repository into your account according to GitHub Fork a Repo document. 7 | 3. Make your changes. Use `dev` branch because it contains the latest stable code. We also recommend you test your code before contributing. 8 | 4. Once ready to commit your changes, create a pull request to `dev` branch according to GitHub Create a Pull Request. 9 | 5. Once received, the Virto Commerce development team will review your contribution and if approved, will pull your request to the appropriate branch. 10 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 3.852.0 6 | 7 | 8 | $(VersionSuffix)-$(BuildNumber) 9 | 10 | 11 | true 12 | 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Virto Solutions LTD.  All rights reserved. 2 | 3 | Licensed under the Virto Commerce Open Software License (the "License"); you 4 | may not use this file except in compliance with the License. You may 5 | obtain a copy of the License at 6 | 7 | https://virtocommerce.com/open-source-license 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | implied. 13 | -------------------------------------------------------------------------------- /VirtoCommerce.OrdersModule.sln.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | True 3 | True 4 | True 5 | True 6 | True 7 | True 8 | 9 | -------------------------------------------------------------------------------- /docs/How-to extend validation.md: -------------------------------------------------------------------------------- 1 | # How-to extend validation 2 | ## 1. Create a Validator 3 | ![image](https://user-images.githubusercontent.com/42555001/126116829-21993389-1938-467c-851d-d1be1f05ad17.png) 4 | ## 2. Register it with the DI container 5 | ![image](https://user-images.githubusercontent.com/42555001/126116923-74d48d5f-5e14-4c63-8ffc-a3ecbe18d70e.png) 6 | ![image](https://user-images.githubusercontent.com/42555001/126117263-99ea65b7-26d9-45e6-b35a-d52b9f1dcde7.png) 7 | -------------------------------------------------------------------------------- /docs/media/diagram-add-roles-and-permissions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/diagram-add-roles-and-permissions.png -------------------------------------------------------------------------------- /docs/media/diagram-assign-role-with-permissions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/diagram-assign-role-with-permissions.png -------------------------------------------------------------------------------- /docs/media/diagram-db-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/diagram-db-model.png -------------------------------------------------------------------------------- /docs/media/diagram-order-module-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/diagram-order-module-structure.png -------------------------------------------------------------------------------- /docs/media/entity-data-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/entity-data-model.png -------------------------------------------------------------------------------- /docs/media/screen-assign-permissions-to-order-manager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-assign-permissions-to-order-manager.png -------------------------------------------------------------------------------- /docs/media/screen-assign-permissions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-assign-permissions.png -------------------------------------------------------------------------------- /docs/media/screen-cancel-order-notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-cancel-order-notification.png -------------------------------------------------------------------------------- /docs/media/screen-control-items.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-control-items.png -------------------------------------------------------------------------------- /docs/media/screen-create-order-notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-create-order-notification.png -------------------------------------------------------------------------------- /docs/media/screen-customer-orders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-customer-orders.png -------------------------------------------------------------------------------- /docs/media/screen-fullfilment-center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-fullfilment-center.png -------------------------------------------------------------------------------- /docs/media/screen-invoice-for-customer-order.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-invoice-for-customer-order.png -------------------------------------------------------------------------------- /docs/media/screen-line-items.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-line-items.png -------------------------------------------------------------------------------- /docs/media/screen-new-order-status-notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-new-order-status-notification.png -------------------------------------------------------------------------------- /docs/media/screen-order-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-order-details.png -------------------------------------------------------------------------------- /docs/media/screen-order-documents1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-order-documents1.png -------------------------------------------------------------------------------- /docs/media/screen-order-number-template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-order-number-template.png -------------------------------------------------------------------------------- /docs/media/screen-order-paid-notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-order-paid-notification.png -------------------------------------------------------------------------------- /docs/media/screen-order-payment-number-template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-order-payment-number-template.png -------------------------------------------------------------------------------- /docs/media/screen-order-sent-notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-order-sent-notification.png -------------------------------------------------------------------------------- /docs/media/screen-order-shipment-document-widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-order-shipment-document-widgets.png -------------------------------------------------------------------------------- /docs/media/screen-order-shipment-number-template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-order-shipment-number-template.png -------------------------------------------------------------------------------- /docs/media/screen-order-widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-order-widgets.png -------------------------------------------------------------------------------- /docs/media/screen-payment-document-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-payment-document-details.png -------------------------------------------------------------------------------- /docs/media/screen-payment-document-widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-payment-document-widgets.png -------------------------------------------------------------------------------- /docs/media/screen-permission-name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-permission-name.png -------------------------------------------------------------------------------- /docs/media/screen-select-bounded-scope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-select-bounded-scope.png -------------------------------------------------------------------------------- /docs/media/screen-select-stores.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-select-stores.png -------------------------------------------------------------------------------- /docs/media/screen-shipment-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-shipment-details.png -------------------------------------------------------------------------------- /docs/media/screen-shipment-document.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/docs/media/screen-shipment-document.png -------------------------------------------------------------------------------- /docs/order-details.md: -------------------------------------------------------------------------------- 1 | # Order Details 2 | 3 | Once the order is created by customer on client side, the details will immediately appear on admin side. 4 | ![Fig.Customer Orders](media/screen-order-details.png) 5 | 6 | The admin side displays the following order details: 7 | 8 | 1. Approved: Yes/No button 9 | 1. Assigned to: displays the name of the assignee. The admin can select the assignee from the drop-down list 10 | 1. Customer order Number: generated automatically by the system. The order number template can be specified by user 11 | 1. The user navigates to settings->Orders->General 12 | 1. The system opens the General Settings screen 13 | 1. The user specifies the Order number template 14 | ![Fig.Customer Orders](media/screen-order-number-template.png) 15 | 1. From – date of creation 16 | 1. Status 17 | 1. Customer Name 18 | 1. Discount 19 | 1. Store 20 | -------------------------------------------------------------------------------- /docs/order-widgets.md: -------------------------------------------------------------------------------- 1 | # Widgets 2 | 3 | ![Fig.Customer Orders](media/screen-order-widgets.png) 4 | 5 | 1. Notification feed widget displays all notifications related to customer order. 6 | 1. Line Items widget display the list of selected items with details: 7 | 1. Item; 8 | 1. Quantity; 9 | 1. Avail; 10 | 1. Unit price (excl. taxes); 11 | 1. Unit price (incl. taxes); 12 | 1. Discount (excl. taxes); 13 | 1. Discount (incl. taxes); 14 | 1. Tax; 15 | 1. Line items. 16 | ![Fig.Customer Orders](media/screen-line-items.png) 17 | 1. Changes widget displays the order changes history (logs). 18 | 1. Addresses widget displays the shipment addresses specified by customer. 19 | 1. Comments widget displays all comments related to customer order. 20 | 1. Dynamic properties. 21 | 1. Open Subscription. 22 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Authorization/Extensions/PermissionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using VirtoCommerce.Platform.Core.Security; 4 | 5 | namespace VirtoCommerce.OrdersModule2.Web.Authorization.Extensions 6 | { 7 | public static class PermissionExtensions 8 | { 9 | public static IEnumerable GetAllowedStatuses(this Permission permission) where T : PermissionScope 10 | { 11 | return permission.AssignedScopes.OfType().Select(x => x.Scope).Distinct(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Authorization/OrderSelectedStatusScope.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.Platform.Core.Security; 2 | 3 | namespace VirtoCommerce.OrdersModule2.Web.Authorization 4 | { 5 | public sealed class OrderSelectedStatusScope : PermissionScope 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Content/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/samples/VirtoCommerce.OrdersModule2.Web/Content/logo.png -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Extensions/ServiceCollectionExtension.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using VirtoCommerce.OrdersModule.Core.Model; 4 | using VirtoCommerce.OrdersModule2.Web.Validation; 5 | 6 | namespace VirtoCommerce.OrdersModule2.Web.Extensions 7 | { 8 | public static class ServiceCollectionExtension 9 | { 10 | public static void AddValidators(this IServiceCollection serviceCollection) 11 | { 12 | serviceCollection.AddTransient, LineItemValidator>(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Localizations/en.VirtoCommerce.Orders2.json: -------------------------------------------------------------------------------- 1 | { 2 | "orders": { 3 | "blades": { 4 | "customerOrder-list": { 5 | "labels": { 6 | "newField": "New field" 7 | } 8 | } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Localizations/ru.VirtoCommerce.Orders2.json: -------------------------------------------------------------------------------- 1 | { 2 | "orders": { 3 | "blades": { 4 | "customerOrder-list": { 5 | "labels": { 6 | "newField": "Новое поле" 7 | } 8 | } 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Migrations/20230920143534_UpdateInvoice.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule2.Web.Migrations 6 | { 7 | public partial class UpdateInvoice : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "CancelledState", 13 | table: "OrderInvoice", 14 | type: "nvarchar(32)", 15 | maxLength: 32, 16 | nullable: true); 17 | 18 | migrationBuilder.AddColumn( 19 | name: "ParentOperationId", 20 | table: "OrderInvoice", 21 | type: "nvarchar(128)", 22 | maxLength: 128, 23 | nullable: true); 24 | } 25 | 26 | protected override void Down(MigrationBuilder migrationBuilder) 27 | { 28 | migrationBuilder.DropColumn( 29 | name: "CancelledState", 30 | table: "OrderInvoice"); 31 | 32 | migrationBuilder.DropColumn( 33 | name: "ParentOperationId", 34 | table: "OrderInvoice"); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Model/CustomerOrder2.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using VirtoCommerce.OrdersModule.Core.Model; 3 | 4 | namespace VirtoCommerce.OrdersModule2.Web.Model 5 | { 6 | public class CustomerOrder2 : CustomerOrder 7 | { 8 | public CustomerOrder2() 9 | { 10 | Invoices = new List(); 11 | } 12 | public string NewField { get; set; } 13 | public ICollection Invoices { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Model/Invoice.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.OrdersModule.Core.Model; 2 | 3 | namespace VirtoCommerce.OrdersModule2.Web.Model 4 | { 5 | public class Invoice : OrderOperation 6 | { 7 | public string CustomerId { get; set; } 8 | public string CustomerName { get; set; } 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Model/InvoiceEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using VirtoCommerce.OrdersModule.Data.Model; 3 | 4 | namespace VirtoCommerce.OrdersModule2.Web.Model 5 | { 6 | public class InvoiceEntity : OperationEntity 7 | { 8 | public string CustomerId { get; set; } 9 | public string CustomerName { get; set; } 10 | 11 | 12 | public CustomerOrder2Entity CustomerOrder2 { get; set; } 13 | public string CustomerOrder2Id { get; set; } 14 | 15 | public override void Patch(OperationEntity operation) 16 | { 17 | base.Patch(operation); 18 | 19 | var target = operation as InvoiceEntity; 20 | if (target == null) 21 | throw new NullReferenceException("target"); 22 | 23 | target.CustomerId = this.CustomerId; 24 | target.CustomerName = this.CustomerName; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Model/LineItem2Entity.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.OrdersModule.Core.Model; 2 | using VirtoCommerce.OrdersModule.Data.Model; 3 | using VirtoCommerce.Platform.Core.Common; 4 | 5 | namespace VirtoCommerce.OrdersModule2.Web.Model 6 | { 7 | public class LineItem2Entity : LineItemEntity 8 | { 9 | public override LineItem ToModel(LineItem lineItem) 10 | { 11 | return base.ToModel(lineItem); 12 | } 13 | 14 | public override LineItemEntity FromModel(LineItem lineItem, PrimaryKeyResolvingMap pkMap) 15 | { 16 | return base.FromModel(lineItem, pkMap); 17 | } 18 | 19 | public override void Patch(LineItemEntity target) 20 | { 21 | base.Patch(target); 22 | var lineItem2 = target as LineItem2Entity; 23 | lineItem2.OuterId = OuterId; 24 | 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/ModuleConstants.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using VirtoCommerce.Platform.Core.Settings; 3 | 4 | namespace VirtoCommerce.OrdersModule2.Web 5 | { 6 | public class ModuleConstants 7 | { 8 | public static class Settings 9 | { 10 | public static class General 11 | { 12 | public static SettingDescriptor InvoiceStatus = new SettingDescriptor 13 | { 14 | Name = "Invoice.Status", 15 | ValueType = SettingValueType.ShortText, 16 | GroupName = "Orders|General", 17 | IsDictionary = true, 18 | DefaultValue = "New", 19 | AllowedValues = new[] { "New", "Pending", "Authorized", "Cancelled", "Sample2", "Sample3" } 20 | }; 21 | 22 | public static IEnumerable AllSettings 23 | { 24 | get 25 | { 26 | yield return InvoiceStatus; 27 | } 28 | } 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:34241/", 7 | "sslPort": 44392 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "VirtoCommerce.OrdersModule2.Web": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "https://localhost:5001;http://localhost:5000" 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Repositories/DesignTimeDbContextFactory.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Design; 3 | 4 | namespace VirtoCommerce.OrdersModule2.Web.Repositories 5 | { 6 | public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory 7 | { 8 | public Order2DbContext CreateDbContext(string[] args) 9 | { 10 | var builder = new DbContextOptionsBuilder(); 11 | 12 | builder.UseSqlServer("Data Source=(local);Initial Catalog=VirtoCommerce3;Persist Security Info=True;User ID=virto;Password=virto;MultipleActiveResultSets=True;Connect Timeout=30"); 13 | 14 | return new Order2DbContext(builder.Options); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Repositories/Order2DbContext.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using VirtoCommerce.OrdersModule.Data.Repositories; 3 | using VirtoCommerce.OrdersModule2.Web.Model; 4 | 5 | namespace VirtoCommerce.OrdersModule2.Web.Repositories 6 | { 7 | public class Order2DbContext : OrderDbContext 8 | { 9 | public Order2DbContext(DbContextOptions builderOptions) : base(builderOptions) 10 | { 11 | } 12 | 13 | protected override void OnModelCreating(ModelBuilder modelBuilder) 14 | { 15 | #region CustomerOrder2 16 | modelBuilder.Entity(); 17 | #endregion 18 | 19 | #region OrderInvoice 20 | modelBuilder.Entity().ToTable("OrderInvoice").HasKey(x => x.Id); 21 | modelBuilder.Entity().Property(x => x.Id).HasMaxLength(128).ValueGeneratedOnAdd(); 22 | 23 | modelBuilder.Entity().HasOne(m => m.CustomerOrder2).WithMany(m => m.Invoices) 24 | .HasForeignKey(m => m.CustomerOrder2Id).OnDelete(DeleteBehavior.Cascade); 25 | #endregion 26 | 27 | base.OnModelCreating(modelBuilder); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Repositories/OrderRepository2.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | using Microsoft.EntityFrameworkCore; 5 | using VirtoCommerce.OrdersModule.Data.Model; 6 | using VirtoCommerce.OrdersModule.Data.Repositories; 7 | using VirtoCommerce.OrdersModule2.Web.Model; 8 | using VirtoCommerce.Platform.Core.Domain; 9 | 10 | namespace VirtoCommerce.OrdersModule2.Web.Repositories 11 | { 12 | public class OrderRepository2 : OrderRepository 13 | { 14 | public OrderRepository2(Order2DbContext dbContext, IUnitOfWork unitOfWork = null) 15 | : base(dbContext, unitOfWork) 16 | { 17 | } 18 | 19 | public IQueryable CustomerOrders2 => DbContext.Set(); 20 | public IQueryable Invoices => DbContext.Set(); 21 | 22 | public override async Task> GetCustomerOrdersByIdsAsync(IList ids, string responseGroup = null) 23 | { 24 | var retVal = await base.GetCustomerOrdersByIdsAsync(ids, responseGroup); 25 | var query = Invoices.Where(x => ids.Contains(x.CustomerOrder2Id)); 26 | await query.LoadAsync(); 27 | return retVal; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Scripts/tree-template.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/Validation/LineItemValidator.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using VirtoCommerce.OrdersModule.Core.Model; 3 | 4 | namespace VirtoCommerce.OrdersModule2.Web.Validation 5 | { 6 | public class LineItemValidator : AbstractValidator 7 | { 8 | public LineItemValidator() 9 | { 10 | RuleFor(item => item.Name).NotEmpty().NotNull().MaximumLength(128); 11 | RuleFor(item => item.Quantity).LessThan(100).NotNull(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/VirtoCommerce.OrdersModule2.Web.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | false 5 | Library 6 | 7 | 8 | 9 | all 10 | runtime; build; native; contentfiles; analyzers; buildtransitive 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/_module.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | VirtoCommerce.Orders2 4 | 3.800.0 5 | demo 6 | 3.800.0 7 | 8 | 9 | 10 | 11 | Order extension sample module 12 | Extension with simple property and complex children collection property added. 13 | 14 | Oleg Zhuk 15 | 16 | 17 | Virto Commerce 18 | 19 | http://virtocommerce.com/ 20 | Modules/$(VirtoCommerce.Orders)/Content/logo.png 21 | First version. 22 | Copyright © 2011-2024 Virto Commerce. All rights reserved 23 | orders 24 | 25 | VirtoCommerce.OrdersModule2.Web.dll 26 | VirtoCommerce.OrdersModule2.Web.Module, VirtoCommerce.OrdersModule2.Web 27 | 28 | -------------------------------------------------------------------------------- /samples/VirtoCommerce.OrdersModule2.Web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.0", 3 | "name": "vc-module", 4 | "private": true, 5 | "scripts": { 6 | "webpack:dev": "webpack --mode=development", 7 | "webpack:watch": "webpack --watch --mode=development", 8 | "webpack:build": "webpack --mode=production" 9 | }, 10 | "devDependencies": { 11 | "clean-webpack-plugin": "^4.0.0", 12 | "css-loader": "^6.5.1", 13 | "mini-css-extract-plugin": "^2.5.1", 14 | "webpack": "^5.68.0", 15 | "webpack-cli": "^4.10.0" 16 | }, 17 | "webpack": { 18 | "stats": "verbose" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Events/OrderChangeEvent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using VirtoCommerce.OrdersModule.Core.Model; 3 | using VirtoCommerce.Platform.Core.Events; 4 | 5 | namespace VirtoCommerce.OrdersModule.Core.Events 6 | { 7 | public class OrderChangeEvent : GenericChangedEntryEvent 8 | { 9 | public OrderChangeEvent(IEnumerable> changedEntries) 10 | : base(changedEntries) 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Events/OrderChangedEvent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Newtonsoft.Json; 3 | using VirtoCommerce.OrdersModule.Core.Model; 4 | using VirtoCommerce.Platform.Core.Events; 5 | 6 | namespace VirtoCommerce.OrdersModule.Core.Events 7 | { 8 | public class OrderChangedEvent : GenericChangedEntryEvent 9 | { 10 | [JsonConstructor] 11 | public OrderChangedEvent(IEnumerable> changedEntries) 12 | : base(changedEntries) 13 | { 14 | } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Events/PaymentChangeEvent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using VirtoCommerce.OrdersModule.Core.Model; 3 | using VirtoCommerce.Platform.Core.Events; 4 | 5 | namespace VirtoCommerce.OrdersModule.Core.Events 6 | { 7 | public class PaymentChangeEvent : GenericChangedEntryEvent 8 | { 9 | public PaymentChangeEvent(IEnumerable> changedEntries) 10 | : base(changedEntries) 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Events/PaymentChangedEvent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Newtonsoft.Json; 3 | using VirtoCommerce.OrdersModule.Core.Model; 4 | using VirtoCommerce.Platform.Core.Events; 5 | 6 | namespace VirtoCommerce.OrdersModule.Core.Events 7 | { 8 | public class PaymentChangedEvent : GenericChangedEntryEvent 9 | { 10 | [JsonConstructor] 11 | public PaymentChangedEvent(IEnumerable> changedEntries) 12 | : base(changedEntries) 13 | { 14 | } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Events/ShipmentChangeEvent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using VirtoCommerce.OrdersModule.Core.Model; 3 | using VirtoCommerce.Platform.Core.Events; 4 | 5 | namespace VirtoCommerce.OrdersModule.Core.Events 6 | { 7 | public class ShipmentChangeEvent : GenericChangedEntryEvent 8 | { 9 | public ShipmentChangeEvent(IEnumerable> changedEntries) 10 | : base(changedEntries) 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Events/ShipmentChangedEvent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using VirtoCommerce.OrdersModule.Core.Model; 3 | using VirtoCommerce.Platform.Core.Events; 4 | 5 | namespace VirtoCommerce.OrdersModule.Core.Events 6 | { 7 | public class ShipmentChangedEvent : GenericChangedEntryEvent 8 | { 9 | public ShipmentChangedEvent(IEnumerable> changedEntries) 10 | : base(changedEntries) 11 | { 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Extensions/ConfigurationExtensions.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Configuration; 2 | using VirtoCommerce.Platform.Core.Common; 3 | 4 | namespace VirtoCommerce.OrdersModule.Core.Extensions 5 | { 6 | public static class ConfigurationExtensions 7 | { 8 | public static bool IsOrderFullTextSearchEnabled(this IConfiguration configuration) 9 | { 10 | var value = configuration["Search:OrderFullTextSearchEnabled"]; 11 | return value.TryParse(false); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/Address.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.Platform.Core.Swagger; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model 4 | { 5 | [SwaggerSchemaId("OrderAddress")] 6 | public class Address : CoreModule.Core.Common.Address 7 | { 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/AuditableAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model 4 | { 5 | public class AuditableAttribute : Attribute { } 6 | } 7 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/CancelledState.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model 2 | { 3 | public enum CancelledState 4 | { 5 | Undefined, 6 | Requested, 7 | Completed, 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/Capture.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model 4 | { 5 | public class Capture : OrderOperation 6 | { 7 | public override string ObjectType { get; set; } = typeof(Capture).FullName; 8 | 9 | public decimal Amount { get; set; } 10 | 11 | public string VendorId { get; set; } 12 | 13 | public string TransactionId { get; set; } 14 | 15 | public string CustomerOrderId { get; set; } 16 | 17 | public string PaymentId { get; set; } 18 | 19 | public virtual ICollection Items { get; set; } 20 | 21 | public bool CloseTransaction { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/CaptureItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using VirtoCommerce.Platform.Core.Common; 3 | 4 | namespace VirtoCommerce.OrdersModule.Core.Model 5 | { 6 | public class CaptureItem : AuditableEntity, IHasOuterId, ICloneable 7 | { 8 | public int Quantity { get; set; } 9 | 10 | public string LineItemId { get; set; } 11 | public LineItem LineItem { get; set; } 12 | 13 | public string CaptureId { get; set; } 14 | 15 | public string OuterId { get; set; } 16 | 17 | public virtual object Clone() 18 | { 19 | var result = MemberwiseClone() as CaptureItem; 20 | 21 | result.LineItem = LineItem?.Clone() as LineItem; 22 | 23 | return result; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/CaptureOrderPaymentRequest.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model 2 | { 3 | public class CaptureOrderPaymentRequest : OrderPaymentRequest 4 | { 5 | /// 6 | /// Provides information about the charge that customers see on their statements. If Seller provides this information, a payment provider can implement it. 7 | /// 8 | public string CaptureDetails { get; set; } 9 | 10 | /// 11 | /// Set to True to close a transaction, restricting future capture operations against this order; otherwise, set to False. By default, False. 12 | /// 13 | public bool CloseTransaction { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/CaptureOrderPaymentResult.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model 2 | { 3 | public class CaptureOrderPaymentResult : OrderPaymentResult 4 | { 5 | public string PaymentStatus { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/CaptureStatus.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model; 2 | 3 | public enum CaptureStatus 4 | { 5 | Pending, 6 | Processed, 7 | Rejected, 8 | } 9 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/ConfigurationItem.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using VirtoCommerce.Platform.Core.Common; 4 | using VirtoCommerce.Platform.Core.Swagger; 5 | 6 | namespace VirtoCommerce.OrdersModule.Core.Model; 7 | 8 | [SwaggerSchemaId("OrderConfigurationItem")] 9 | public class ConfigurationItem : AuditableEntity 10 | { 11 | public string LineItemId { get; set; } 12 | 13 | public string ProductId { get; set; } 14 | 15 | public string Name { get; set; } 16 | 17 | public string Sku { get; set; } 18 | 19 | public int Quantity { get; set; } 20 | 21 | public string ImageUrl { get; set; } 22 | 23 | public string CatalogId { get; set; } 24 | 25 | public string CategoryId { get; set; } 26 | 27 | public string Type { get; set; } 28 | 29 | public string CustomText { get; set; } 30 | 31 | public IList Files { get; set; } 32 | 33 | public object Clone() 34 | { 35 | var result = (ConfigurationItem)MemberwiseClone(); 36 | 37 | result.Files = Files?.Select(x => x.CloneTyped()).ToList(); 38 | 39 | return result; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/ConfigurationItemFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using VirtoCommerce.Platform.Core.Common; 3 | using VirtoCommerce.Platform.Core.Swagger; 4 | 5 | namespace VirtoCommerce.OrdersModule.Core.Model; 6 | 7 | [SwaggerSchemaId("OrderConfigurationItemFile")] 8 | public class ConfigurationItemFile : AuditableEntity, ICloneable 9 | { 10 | public string Name { get; set; } 11 | public string Url { get; set; } 12 | public string ContentType { get; set; } 13 | public long Size { get; set; } 14 | public string ConfigurationItemId { get; set; } 15 | 16 | public object Clone() 17 | { 18 | return MemberwiseClone(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/CustomerOrderResponseGroup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model 4 | { 5 | [Flags] 6 | public enum CustomerOrderResponseGroup 7 | { 8 | Default = 0, 9 | WithItems = 1, 10 | WithInPayments = 1 << 1, 11 | WithShipments = 1 << 2, 12 | WithAddresses = 1 << 3, 13 | WithDiscounts = 1 << 4, 14 | WithPrices = 1 << 5, 15 | WithDynamicProperties = 1 << 6, 16 | WithRefunds = 1 << 7, 17 | WithCaptures = 1 << 8, 18 | Full = WithItems | WithInPayments | WithShipments | WithAddresses | WithDiscounts | WithPrices | WithDynamicProperties | WithRefunds | WithCaptures 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/FeeDetail.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.Platform.Core.Common; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model 4 | { 5 | public class FeeDetail : ValueObject 6 | { 7 | public string FeeId { get; set; } 8 | public string Currency { get; set; } 9 | public decimal Amount { get; set; } 10 | public string Description { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/HtmlToPdfOptions.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model 2 | { 3 | public class HtmlToPdfOptions 4 | { 5 | public string ViewportSize { get; set; } = "1920x1080"; 6 | public int? DPI { get; set; } = 300; 7 | public string DefaultEncoding { get; set; } = "utf-8"; 8 | public int? MinimumFontSize { get; set; } = 10; 9 | public string PaperSize { get; set; } = "A4"; 10 | //use for wkhtmltox's process 11 | public string Arguments { get; set; } = "--dpi 300 --print-media-type --page-size A4 --encoding \"utf - 8\" --viewport-size \"1920x1080\" "; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/IHasFeesDetalization.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model 4 | { 5 | public interface IHasFeesDetalization 6 | { 7 | public ICollection FeeDetails { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/OrderOperationStatusChangedEntry.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model 2 | { 3 | public class OrderOperationStatusChangedEntry 4 | { 5 | public string Number { get; set; } 6 | public string OldStatus { get; set; } 7 | public string NewStatus { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/OrderPaymentInfo.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.StoreModule.Core.Model; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model 4 | { 5 | public class OrderPaymentInfo 6 | { 7 | public CustomerOrder CustomerOrder { get; set; } 8 | 9 | public PaymentIn Payment { get; set; } 10 | 11 | public Store Store { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/OrderPaymentRequest.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.Platform.Core.Common; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model 4 | { 5 | public class OrderPaymentRequest : IHasOuterId 6 | { 7 | public string OrderId { get; set; } 8 | 9 | public string PaymentId { get; set; } 10 | 11 | public string TransactionId { get; set; } 12 | 13 | public string OuterId { get; set; } 14 | 15 | public decimal? Amount { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/OrderPaymentResult.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model 2 | { 3 | public class OrderPaymentResult 4 | { 5 | public bool Succeeded { get; set; } 6 | 7 | /// 8 | /// ECommerce Flow Relaied Type: 9 | /// INVALID_REQUEST_ERROR: Invalid request errors arise when your request has invalid parameters or the payment provider doesn’t support the operation 10 | /// PAYMENT_PROVIDER_UNAVAILABLE: The payment provider is currently unavailable. Please try again later or contact customer support if the issue persists. 11 | /// Payment Provider Errors: 12 | /// PAYMENT_FAILED: Payment capture failed. Please try again later or contact customer support if the issue persists. 13 | /// 14 | public string ErrorCode { get; set; } 15 | 16 | public string ErrorMessage { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/PaymentDistributedLockOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model 4 | { 5 | public class PaymentDistributedLockOptions 6 | { 7 | /// 8 | /// The maximum duration the resource will be locked. Default: 30 seconds. 9 | /// 10 | public TimeSpan LockTimeout { get; set; } = TimeSpan.FromMinutes(30); 11 | /// 12 | /// The duration to attempt acquiring the locked resource. Default: 30 seconds. 13 | /// 14 | public TimeSpan TryLockTimeout { get; set; } = TimeSpan.FromSeconds(30); 15 | /// 16 | /// The interval between lock acquisition retries. Default: 1 second. 17 | /// 18 | public TimeSpan RetryInterval { get; set; } = TimeSpan.FromSeconds(1); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/PaymentErrorDescriber.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.PaymentModule.Core.Model; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model 4 | { 5 | public static class PaymentErrorDescriber 6 | { 7 | public static string InvalidStatus(PaymentStatus status) 8 | { 9 | return $"Unable to process due to invalid payment status: {status}"; 10 | } 11 | 12 | public static string OrderNotFound() 13 | { 14 | return $"Can't find customer order"; 15 | } 16 | 17 | public static string PaymentNotFound() 18 | { 19 | return $"Can't find payment in order"; 20 | } 21 | 22 | public static string PaymentMethodNotFound(string gatewayCode) 23 | { 24 | return $"Can't find payment method with code: '{gatewayCode ?? "null"}'"; 25 | } 26 | 27 | public static string StoreNotFound() 28 | { 29 | return $"Can't find a store"; 30 | } 31 | 32 | public static string NotCapturable() 33 | { 34 | return $"Payment method does not support payment capture"; 35 | } 36 | 37 | public static string NotRefundable() 38 | { 39 | return $"Payment method does not support refund"; 40 | } 41 | 42 | public static string PaymentMethodError() 43 | { 44 | return $"Internal payment method error"; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/PaymentFlowErrorCodes.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model 2 | { 3 | public static class PaymentFlowErrorCodes 4 | { 5 | /// 6 | /// Invalid request errors arise when your request has invalid parameters or the payment provider doesn’t support the operation 7 | /// 8 | public const string InvalidRequestError = "INVALID_REQUEST_ERROR"; 9 | 10 | /// 11 | /// The payment provider is currently unavailable. Please try again later or contact customer support if the issue persists. 12 | /// 13 | public const string PaymentProviderUnavailable = "PAYMENT_PROVIDER_UNAVAILABLE"; 14 | 15 | /// 16 | /// Payment failed. Please try again later or contact customer support if the issue persists. 17 | /// 18 | public const string PaymentFailed = "PAYMENT_FAILED"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/PurchasedProduct.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model 2 | { 3 | public class PurchasedProduct 4 | { 5 | public string ProductId { get; set; } 6 | 7 | public string StoreId { get; set; } 8 | 9 | public string UserId { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/PurchasedProductsGroupedRequest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model 4 | { 5 | public class PurchasedProductsGroupedRequest 6 | { 7 | public IList ProductIds { get; set; } = []; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/PurchasedProductsRequest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model 4 | { 5 | public class PurchasedProductsRequest 6 | { 7 | public string StoreId { get; set; } 8 | 9 | public string UserId { get; set; } 10 | 11 | public IList ProductIds { get; set; } = []; 12 | 13 | public int? ProductsLimit { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/PurchasedProductsResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model 4 | { 5 | public class PurchasedProductsResult 6 | { 7 | public IList ProductIds { get; set; } = []; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/Refund.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using VirtoCommerce.PaymentModule.Core.Model; 3 | 4 | namespace VirtoCommerce.OrdersModule.Core.Model 5 | { 6 | public class Refund : OrderOperation 7 | { 8 | public override string ObjectType { get; set; } = typeof(Refund).FullName; 9 | 10 | public decimal Amount { get; set; } 11 | 12 | public RefundReasonCode ReasonCode { get; set; } 13 | 14 | public RefundStatus RefundStatus { get; set; } 15 | 16 | public string ReasonMessage { get; set; } 17 | 18 | public string RejectReasonMessage { get; set; } 19 | 20 | public string VendorId { get; set; } 21 | 22 | public string TransactionId { get; set; } 23 | 24 | public string CustomerOrderId { get; set; } 25 | 26 | public string PaymentId { get; set; } 27 | 28 | public virtual ICollection Items { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/RefundItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using VirtoCommerce.Platform.Core.Common; 3 | 4 | namespace VirtoCommerce.OrdersModule.Core.Model 5 | { 6 | public class RefundItem : AuditableEntity, IHasOuterId, ICloneable 7 | { 8 | // The quantity to refund. 9 | public int Quantity { get; set; } 10 | 11 | public string LineItemId { get; set; } 12 | public LineItem LineItem { get; set; } 13 | 14 | public string RefundId { get; set; } 15 | 16 | public string OuterId { get; set; } 17 | 18 | public virtual object Clone() 19 | { 20 | var result = MemberwiseClone() as RefundItem; 21 | 22 | result.LineItem = LineItem?.Clone() as LineItem; 23 | 24 | return result; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/RefundOrderPaymentRequest.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model 2 | { 3 | public class RefundOrderPaymentRequest : OrderPaymentRequest 4 | { 5 | public string ReasonCode { get; set; } 6 | 7 | public string ReasonMessage { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/RefundOrderPaymentResult.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model 2 | { 3 | public class RefundOrderPaymentResult : OrderPaymentResult 4 | { 5 | public string RefundStatus { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/RefundReasonCode.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model 2 | { 3 | public enum RefundReasonCode 4 | { 5 | Duplicate, 6 | Fraudulent, 7 | RequestedByCustomer, 8 | Other 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/Search/CustomerOrderHistorySearchCriteria.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.Platform.Core.Common; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model.Search 4 | { 5 | public class CustomerOrderHistorySearchCriteria : SearchCriteriaBase 6 | { 7 | public string OrderId { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/Search/CustomerOrderIndexedSearchCriteria.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model.Search 2 | { 3 | public class CustomerOrderIndexedSearchCriteria : CustomerOrderSearchCriteria 4 | { 5 | public string Facet { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/Search/CustomerOrderIndexedSearchResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model.Search 4 | { 5 | public class CustomerOrderIndexedSearchResult : CustomerOrderSearchResult 6 | { 7 | public virtual IList Aggregations { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/Search/CustomerOrderSearchResult.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.Platform.Core.Common; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model.Search 4 | { 5 | public class CustomerOrderSearchResult : GenericSearchResult 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/Search/OrderAggregation.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model.Search 4 | { 5 | public class OrderAggregation 6 | { 7 | /// 8 | /// Gets or sets the value of the aggregation type 9 | /// 10 | /// 11 | /// "Attribute", "Range" 12 | /// 13 | public string AggregationType { get; set; } 14 | 15 | /// 16 | /// Gets or sets the value of the aggregation field 17 | /// 18 | public string Field { get; set; } 19 | 20 | /// 21 | /// Gets or sets the collection of the aggregation labels 22 | /// 23 | public IList Labels { get; set; } 24 | 25 | /// 26 | /// Gets or sets the collection of the aggregation items 27 | /// 28 | public IList Items { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/Search/OrderAggregationLabel.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model.Search 2 | { 3 | public class OrderAggregationLabel 4 | { 5 | public string Language { get; set; } 6 | public string Label { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/Search/PaymentSearchCriteria.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model.Search 4 | { 5 | public class PaymentSearchCriteria : OrderOperationSearchCriteriaBase 6 | { 7 | /// 8 | /// It used to limit search within a customer order id 9 | /// 10 | public string OrderId { get; set; } 11 | /// 12 | /// It used to limit search within a customer order number 13 | /// 14 | public string OrderNumber { get; set; } 15 | 16 | /// 17 | /// Filter payments by customer 18 | /// 19 | public string CustomerId { get; set; } 20 | 21 | public DateTime? CapturedStartDate { get; set; } 22 | public DateTime? CapturedEndDate { get; set; } 23 | 24 | public DateTime? AuthorizedStartDate { get; set; } 25 | public DateTime? AuthorizedEndDate { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/Search/PaymentSearchResult.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.Platform.Core.Common; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model.Search 4 | { 5 | public class PaymentSearchResult : GenericSearchResult 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/Search/ShipmentSearchCriteria.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Model.Search 2 | { 3 | public class ShipmentSearchCriteria : OrderOperationSearchCriteriaBase 4 | { 5 | /// 6 | /// It used to limit search within a customer order id 7 | /// 8 | public string OrderId { get; set; } 9 | /// 10 | /// It used to limit search within a customer order number 11 | /// 12 | public string OrderNumber { get; set; } 13 | 14 | public string FulfillmentCenterId { get; set; } 15 | 16 | public string ShipmentMethodCode { get; set; } 17 | 18 | public string ShipmentMethodOption { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/Search/ShipmentSearchResult.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.Platform.Core.Common; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Model.Search 4 | { 5 | public class ShipmentSearchResult : GenericSearchResult 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/ShipmentItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using VirtoCommerce.Platform.Core.Common; 3 | using VirtoCommerce.Platform.Core.Swagger; 4 | 5 | namespace VirtoCommerce.OrdersModule.Core.Model 6 | { 7 | [SwaggerSchemaId("OrderShipmentItem")] 8 | public class ShipmentItem : AuditableEntity, IHasOuterId, ICloneable 9 | { 10 | public ShipmentItem() 11 | { 12 | } 13 | 14 | public ShipmentItem(LineItem lineItem) 15 | { 16 | LineItem = lineItem; 17 | LineItemId = lineItem.Id; 18 | 19 | Quantity = lineItem.Quantity; 20 | } 21 | 22 | public string LineItemId { get; set; } 23 | public LineItem LineItem { get; set; } 24 | 25 | public string BarCode { get; set; } 26 | 27 | public int Quantity { get; set; } 28 | 29 | public string OuterId { get; set; } 30 | 31 | public string Status { get; set; } 32 | 33 | #region ICloneable members 34 | 35 | public virtual object Clone() 36 | { 37 | var result = MemberwiseClone() as ShipmentItem; 38 | 39 | result.LineItem = LineItem?.Clone() as LineItem; 40 | 41 | return result; 42 | } 43 | 44 | #endregion 45 | 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Model/ShipmentPackage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using VirtoCommerce.CoreModule.Core.Common; 5 | using VirtoCommerce.Platform.Core.Common; 6 | 7 | namespace VirtoCommerce.OrdersModule.Core.Model 8 | { 9 | public class ShipmentPackage : AuditableEntity, IHasDimension, ICloneable 10 | { 11 | public string BarCode { get; set; } 12 | public string PackageType { get; set; } 13 | 14 | public ICollection Items { get; set; } 15 | 16 | #region IHaveDimension Members 17 | public string WeightUnit { get; set; } 18 | public decimal? Weight { get; set; } 19 | 20 | public string MeasureUnit { get; set; } 21 | public decimal? Height { get; set; } 22 | public decimal? Length { get; set; } 23 | public decimal? Width { get; set; } 24 | #endregion 25 | 26 | #region ICloneable members 27 | 28 | public virtual object Clone() 29 | { 30 | var result = MemberwiseClone() as ShipmentPackage; 31 | 32 | result.Items = Items?.Select(x => x.Clone()).OfType().ToList(); 33 | 34 | return result; 35 | } 36 | 37 | #endregion 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Notifications/CancelOrderEmailNotification.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Notifications 2 | { 3 | public class CancelOrderEmailNotification : OrderEmailNotificationBase 4 | { 5 | public CancelOrderEmailNotification() : base(nameof(CancelOrderEmailNotification)) 6 | { 7 | 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Notifications/InvoiceEmailNotification.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.OrdersModule.Core.Model; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Notifications 4 | { 5 | public class InvoiceEmailNotification : OrderEmailNotificationBase 6 | { 7 | public InvoiceEmailNotification() : base(nameof(InvoiceEmailNotification)) 8 | { 9 | 10 | } 11 | 12 | public CustomerOrder Order => CustomerOrder; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Notifications/NewOrderStatusEmailNotification.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Notifications 2 | { 3 | public class NewOrderStatusEmailNotification : OrderEmailNotificationBase 4 | { 5 | public NewOrderStatusEmailNotification() : base(nameof(NewOrderStatusEmailNotification)) 6 | { 7 | 8 | } 9 | 10 | public string OldStatus { get; set; } 11 | public string NewStatus { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Notifications/OrderCreateEmailNotification.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Notifications 2 | { 3 | public class OrderCreateEmailNotification : OrderEmailNotificationBase 4 | { 5 | public OrderCreateEmailNotification() : base(nameof(OrderCreateEmailNotification)) 6 | { 7 | 8 | } 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Notifications/OrderEmailNotificationBase.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.CustomerModule.Core.Model; 2 | using VirtoCommerce.NotificationsModule.Core.Model; 3 | using VirtoCommerce.OrdersModule.Core.Model; 4 | 5 | namespace VirtoCommerce.OrdersModule.Core.Notifications 6 | { 7 | public abstract class OrderEmailNotificationBase : EmailNotification 8 | { 9 | protected OrderEmailNotificationBase(string type) 10 | : base(type) 11 | { 12 | } 13 | 14 | public virtual string CustomerOrderId { get; set; } 15 | public virtual CustomerOrder CustomerOrder { get; set; } 16 | public virtual Member Customer { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Notifications/OrderPaidEmailNotification.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Notifications 2 | { 3 | public class OrderPaidEmailNotification : OrderEmailNotificationBase 4 | { 5 | public OrderPaidEmailNotification() : base(nameof(OrderPaidEmailNotification)) 6 | { 7 | 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Notifications/OrderSentEmailNotification.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Notifications 2 | { 3 | public class OrderSentEmailNotification : OrderEmailNotificationBase 4 | { 5 | public OrderSentEmailNotification() : base(nameof(OrderSentEmailNotification)) 6 | { 7 | 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Notifications/PaymentStatusChangedEmailNotification.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using VirtoCommerce.OrdersModule.Core.Model; 3 | 4 | namespace VirtoCommerce.OrdersModule.Core.Notifications 5 | { 6 | public class PaymentStatusChangedEmailNotification : OrderEmailNotificationBase 7 | { 8 | public PaymentStatusChangedEmailNotification() 9 | : base(nameof(PaymentStatusChangedEmailNotification)) 10 | { 11 | } 12 | 13 | public IList Entries { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Notifications/ShipmentStatusChangedEmailNotification.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using VirtoCommerce.OrdersModule.Core.Model; 3 | 4 | namespace VirtoCommerce.OrdersModule.Core.Notifications 5 | { 6 | public class ShipmentStatusChangedEmailNotification : OrderEmailNotificationBase 7 | { 8 | public ShipmentStatusChangedEmailNotification() 9 | : base(nameof(ShipmentStatusChangedEmailNotification)) 10 | { 11 | } 12 | 13 | public IList Entries { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Search/Indexed/IIndexedCustomerOrderSearchService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using VirtoCommerce.OrdersModule.Core.Model.Search; 3 | 4 | namespace VirtoCommerce.OrdersModule.Core.Search.Indexed 5 | { 6 | public interface IIndexedCustomerOrderSearchService 7 | { 8 | Task SearchCustomerOrdersAsync(CustomerOrderIndexedSearchCriteria criteria); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Services/ICustomerOrderBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using VirtoCommerce.CartModule.Core.Model; 3 | using VirtoCommerce.OrdersModule.Core.Model; 4 | 5 | namespace VirtoCommerce.OrdersModule.Core.Services 6 | { 7 | public interface ICustomerOrderBuilder 8 | { 9 | Task PlaceCustomerOrderFromCartAsync(ShoppingCart cart); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Services/ICustomerOrderSearchService.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.OrdersModule.Core.Model; 2 | using VirtoCommerce.OrdersModule.Core.Model.Search; 3 | using VirtoCommerce.Platform.Core.GenericCrud; 4 | 5 | namespace VirtoCommerce.OrdersModule.Core.Services 6 | { 7 | public interface ICustomerOrderSearchService : ISearchService 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Services/ICustomerOrderService.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.OrdersModule.Core.Model; 2 | using VirtoCommerce.Platform.Core.GenericCrud; 3 | 4 | namespace VirtoCommerce.OrdersModule.Core.Services 5 | { 6 | public interface ICustomerOrderService : IOuterEntityService 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Services/ICustomerOrderStatisticService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using VirtoCommerce.OrdersModule.Core.Model; 4 | 5 | namespace VirtoCommerce.OrdersModule.Core.Services 6 | { 7 | public interface ICustomerOrderStatisticService 8 | { 9 | /// 10 | /// Calculates various order statistics for a dashboard based on the provided start and end dates. 11 | /// 12 | /// Start date 13 | /// End date 14 | /// Returns a DashboardStatisticsResult object that encapsulates the computed statistics. 15 | Task CollectStatisticsAsync(DateTime start, DateTime end); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Services/ICustomerOrderTotalsCalculator.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.OrdersModule.Core.Model; 2 | 3 | namespace VirtoCommerce.OrdersModule.Core.Services 4 | { 5 | public interface ICustomerOrderTotalsCalculator 6 | { 7 | void CalculateTotals(CustomerOrder order); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Services/IMemberOrdersService.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Core.Services 2 | { 3 | public interface IMemberOrdersService 4 | { 5 | bool IsFirstTimeBuyer(string customerId); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Services/IPaymentFlowService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using VirtoCommerce.OrdersModule.Core.Model; 3 | 4 | namespace VirtoCommerce.OrdersModule.Core.Services 5 | { 6 | public interface IPaymentFlowService 7 | { 8 | Task CapturePaymentAsync(CaptureOrderPaymentRequest request); 9 | Task RefundPaymentAsync(RefundOrderPaymentRequest request); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Services/IPaymentSearchService.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.OrdersModule.Core.Model; 2 | using VirtoCommerce.OrdersModule.Core.Model.Search; 3 | using VirtoCommerce.Platform.Core.GenericCrud; 4 | 5 | namespace VirtoCommerce.OrdersModule.Core.Services 6 | { 7 | public interface IPaymentSearchService : ISearchService 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Services/IPaymentService.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.OrdersModule.Core.Model; 2 | using VirtoCommerce.Platform.Core.GenericCrud; 3 | 4 | namespace VirtoCommerce.OrdersModule.Core.Services 5 | { 6 | public interface IPaymentService : IOuterEntityService 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Services/IPurchasedProductsService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using VirtoCommerce.OrdersModule.Core.Model; 4 | 5 | namespace VirtoCommerce.OrdersModule.Core.Services; 6 | 7 | public interface IPurchasedProductsService 8 | { 9 | Task GetPurchasedProductsAsync(PurchasedProductsRequest request); 10 | 11 | Task>> GetGroupedPurchasedProductsAsync(PurchasedProductsGroupedRequest request); 12 | } 13 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Services/IShipmentSearchService.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.OrdersModule.Core.Model; 2 | using VirtoCommerce.OrdersModule.Core.Model.Search; 3 | using VirtoCommerce.Platform.Core.GenericCrud; 4 | 5 | namespace VirtoCommerce.OrdersModule.Core.Services 6 | { 7 | public interface IShipmentSearchService : ISearchService 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Core/Services/IShipmentService.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.OrdersModule.Core.Model; 2 | using VirtoCommerce.Platform.Core.GenericCrud; 3 | 4 | namespace VirtoCommerce.OrdersModule.Core.Services 5 | { 6 | public interface IShipmentService : IOuterEntityService 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/CaptureEntityConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 3 | using VirtoCommerce.OrdersModule.Data.Model; 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql 6 | { 7 | public class CaptureEntityConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.Property(x => x.Amount).HasColumnType("decimal").HasPrecision(18, 4); 12 | 13 | builder.Property(x => x.Sum).HasColumnType("decimal").HasPrecision(18, 4); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/DiscountEntityConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 3 | using VirtoCommerce.OrdersModule.Data.Model; 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql 6 | { 7 | public class DiscountEntityConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.Property(x => x.DiscountAmount).HasColumnType("decimal").HasPrecision(18, 4); 12 | builder.Property(x => x.DiscountAmountWithTax).HasColumnType("decimal").HasPrecision(18, 4); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/FeeDetailEntityConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 3 | using VirtoCommerce.OrdersModule.Data.Model; 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql 6 | { 7 | public class FeeDetailEntityConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.Property(x => x.Amount).HasColumnType("decimal").HasPrecision(18, 4); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/LineItemEntityConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 3 | using VirtoCommerce.OrdersModule.Data.Model; 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql 6 | { 7 | public class LineItemEntityConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.Property(x => x.Price).HasColumnType("decimal").HasPrecision(18, 4); 12 | builder.Property(x => x.PriceWithTax).HasColumnType("decimal").HasPrecision(18, 4); 13 | builder.Property(x => x.DiscountAmount).HasColumnType("decimal").HasPrecision(18, 4); 14 | builder.Property(x => x.DiscountAmountWithTax).HasColumnType("decimal").HasPrecision(18, 4); 15 | builder.Property(x => x.Fee).HasColumnType("decimal").HasPrecision(18, 4); 16 | builder.Property(x => x.FeeWithTax).HasColumnType("decimal").HasPrecision(18, 4); 17 | builder.Property(x => x.TaxTotal).HasColumnType("decimal").HasPrecision(18, 4); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20230329093732_AddOrderTimestamp.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Metadata; 3 | using Microsoft.EntityFrameworkCore.Migrations; 4 | 5 | #nullable disable 6 | 7 | namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations 8 | { 9 | public partial class AddOrderTimestamp : Migration 10 | { 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "RowVersion", 15 | table: "CustomerOrder", 16 | type: "timestamp(6)", 17 | rowVersion: true, 18 | nullable: true) 19 | .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.ComputedColumn); 20 | } 21 | 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "RowVersion", 26 | table: "CustomerOrder"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20230406145631_AddOrderLineItemStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Metadata; 3 | using Microsoft.EntityFrameworkCore.Migrations; 4 | 5 | #nullable disable 6 | 7 | namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations 8 | { 9 | public partial class AddOrderLineItemStatus : Migration 10 | { 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "Status", 15 | table: "OrderLineItem", 16 | type: "varchar(64)", 17 | maxLength: 64, 18 | nullable: true) 19 | .Annotation("MySql:CharSet", "utf8mb4"); 20 | } 21 | 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "Status", 26 | table: "OrderLineItem"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20230417134455_SetProductNameLength1024.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations 6 | { 7 | public partial class SetProductNameLength1024 : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AlterColumn( 12 | name: "Name", 13 | table: "OrderLineItem", 14 | type: "varchar(1024)", 15 | maxLength: 1024, 16 | nullable: false, 17 | oldClrType: typeof(string), 18 | oldType: "varchar(256)", 19 | oldMaxLength: 256) 20 | .Annotation("MySql:CharSet", "utf8mb4") 21 | .OldAnnotation("MySql:CharSet", "utf8mb4"); 22 | 23 | } 24 | 25 | protected override void Down(MigrationBuilder migrationBuilder) 26 | { 27 | migrationBuilder.AlterColumn( 28 | name: "Name", 29 | table: "OrderLineItem", 30 | type: "varchar(256)", 31 | maxLength: 256, 32 | nullable: false, 33 | oldClrType: typeof(string), 34 | oldType: "varchar(1024)", 35 | oldMaxLength: 1024) 36 | .Annotation("MySql:CharSet", "utf8mb4") 37 | .OldAnnotation("MySql:CharSet", "utf8mb4"); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20230504164555_AddTransactionId.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations 6 | { 7 | public partial class AddTransactionId : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "TransactionId", 13 | table: "OrderRefund", 14 | type: "varchar(128)", 15 | maxLength: 128, 16 | nullable: false, 17 | defaultValue: "") 18 | .Annotation("MySql:CharSet", "utf8mb4"); 19 | 20 | migrationBuilder.Sql("UPDATE OrderRefund SET TransactionId = Id;"); 21 | 22 | migrationBuilder.CreateIndex( 23 | name: "IX_OrderRefund_TransactionId_CustomerOrderId", 24 | table: "OrderRefund", 25 | columns: new[] { "TransactionId", "CustomerOrderId" }, 26 | unique: true); 27 | } 28 | 29 | protected override void Down(MigrationBuilder migrationBuilder) 30 | { 31 | migrationBuilder.DropIndex( 32 | name: "IX_OrderRefund_TransactionId_CustomerOrderId", 33 | table: "OrderRefund"); 34 | 35 | migrationBuilder.DropColumn( 36 | name: "TransactionId", 37 | table: "OrderRefund"); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20230725060649_AddShipmentItemStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Metadata; 3 | using Microsoft.EntityFrameworkCore.Migrations; 4 | 5 | #nullable disable 6 | 7 | namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations 8 | { 9 | public partial class AddShipmentItemStatus : Migration 10 | { 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "Status", 15 | table: "OrderShipmentItem", 16 | type: "varchar(128)", 17 | maxLength: 128, 18 | nullable: true) 19 | .Annotation("MySql:CharSet", "utf8mb4"); 20 | } 21 | 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "Status", 26 | table: "OrderShipmentItem"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20230911181734_AddProductOuterId.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations 6 | { 7 | public partial class AddProductOuterId : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "ProductOuterId", 13 | table: "OrderLineItem", 14 | type: "varchar(128)", 15 | maxLength: 128, 16 | nullable: true) 17 | .Annotation("MySql:CharSet", "utf8mb4"); 18 | } 19 | 20 | protected override void Down(MigrationBuilder migrationBuilder) 21 | { 22 | migrationBuilder.DropColumn( 23 | name: "ProductOuterId", 24 | table: "OrderLineItem"); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20231018130044_IsAnonymous.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations 6 | { 7 | public partial class IsAnonymous : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "IsAnonymous", 13 | table: "CustomerOrder", 14 | type: "tinyint(1)", 15 | nullable: false, 16 | defaultValue: false); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "IsAnonymous", 23 | table: "CustomerOrder"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20231204102834_CloseTransaction.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations 6 | { 7 | public partial class CloseTransaction : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "CloseTransaction", 13 | table: "OrderCapture", 14 | type: "tinyint(1)", 15 | nullable: false, 16 | defaultValue: false); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "CloseTransaction", 23 | table: "OrderCapture"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20240610080959_AddressDescription.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations 6 | { 7 | /// 8 | public partial class AddressDescription : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "Description", 15 | table: "OrderAddress", 16 | type: "varchar(128)", 17 | maxLength: 128, 18 | nullable: true) 19 | .Annotation("MySql:CharSet", "utf8mb4"); 20 | } 21 | 22 | /// 23 | protected override void Down(MigrationBuilder migrationBuilder) 24 | { 25 | migrationBuilder.DropColumn( 26 | name: "Description", 27 | table: "OrderAddress"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241108155732_OrderPromotionName.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations 6 | { 7 | /// 8 | public partial class OrderPromotionName : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "PromotionName", 15 | table: "OrderDiscount", 16 | type: "varchar(128)", 17 | maxLength: 128, 18 | nullable: true) 19 | .Annotation("MySql:CharSet", "utf8mb4"); 20 | } 21 | 22 | /// 23 | protected override void Down(MigrationBuilder migrationBuilder) 24 | { 25 | migrationBuilder.DropColumn( 26 | name: "PromotionName", 27 | table: "OrderDiscount"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20241205094730_AddIsDiscountAmountRounded.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations 6 | { 7 | /// 8 | public partial class AddIsDiscountAmountRounded : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "IsDiscountAmountRounded", 15 | table: "OrderLineItem", 16 | type: "tinyint(1)", 17 | nullable: false, 18 | defaultValue: false); 19 | } 20 | 21 | /// 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "IsDiscountAmountRounded", 26 | table: "OrderLineItem"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/Migrations/20250428174804_AddAddressMiddleName.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql.Migrations 6 | { 7 | /// 8 | public partial class AddAddressMiddleName : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "MiddleName", 15 | table: "OrderAddress", 16 | type: "varchar(128)", 17 | maxLength: 128, 18 | nullable: true) 19 | .Annotation("MySql:CharSet", "utf8mb4"); 20 | } 21 | 22 | /// 23 | protected override void Down(MigrationBuilder migrationBuilder) 24 | { 25 | migrationBuilder.DropColumn( 26 | name: "MiddleName", 27 | table: "OrderAddress"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/MySqlDataAssemblyMarker.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Data.MySql; 2 | 3 | public class MySqlDataAssemblyMarker 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/MySqlDbContextFactory.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Design; 3 | using VirtoCommerce.OrdersModule.Data.Repositories; 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql 6 | { 7 | public class MySqlDbContextFactory : IDesignTimeDbContextFactory 8 | { 9 | public OrderDbContext CreateDbContext(string[] args) 10 | { 11 | var builder = new DbContextOptionsBuilder(); 12 | var connectionString = args.Any() ? args[0] : "server=localhost;user=root;password=virto;database=VirtoCommerce3;"; 13 | var serverVersion = args.Length >= 2 ? args[1] : null; 14 | 15 | builder.UseMySql( 16 | connectionString, 17 | ResolveServerVersion(serverVersion, connectionString), 18 | db => db 19 | .MigrationsAssembly(typeof(MySqlDataAssemblyMarker).Assembly.GetName().Name)); 20 | 21 | return new OrderDbContext(builder.Options); 22 | } 23 | 24 | private static ServerVersion ResolveServerVersion(string? serverVersion, string connectionString) 25 | { 26 | if (serverVersion == "AutoDetect") 27 | { 28 | return ServerVersion.AutoDetect(connectionString); 29 | } 30 | else if (serverVersion != null) 31 | { 32 | return ServerVersion.Parse(serverVersion); 33 | } 34 | return new MySqlServerVersion(new Version(5, 7)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/PaymentGatewayTransactionEntityConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 3 | using VirtoCommerce.OrdersModule.Data.Model; 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql 6 | { 7 | public class PaymentGatewayTransactionEntityConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.Property(x => x.Amount).HasColumnType("decimal").HasPrecision(18, 4); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/PaymentInEntityConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 3 | using VirtoCommerce.OrdersModule.Data.Model; 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql 6 | { 7 | public class PaymentInEntityConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.Property(x => x.Price).HasColumnType("decimal").HasPrecision(18, 4); 12 | builder.Property(x => x.PriceWithTax).HasColumnType("decimal").HasPrecision(18, 4); 13 | builder.Property(x => x.DiscountAmount).HasColumnType("decimal").HasPrecision(18, 4); 14 | builder.Property(x => x.DiscountAmountWithTax).HasColumnType("decimal").HasPrecision(18, 4); 15 | builder.Property(x => x.Total).HasColumnType("decimal").HasPrecision(18, 4); 16 | builder.Property(x => x.TotalWithTax).HasColumnType("decimal").HasPrecision(18, 4); 17 | builder.Property(x => x.TaxTotal).HasColumnType("decimal").HasPrecision(18, 4); 18 | 19 | builder.Property(x => x.Sum).HasColumnType("decimal").HasPrecision(18, 4); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/Readme.md: -------------------------------------------------------------------------------- 1 | # Generate Migrations 2 | 3 | ## Install CLI tools for Entity Framework Core 4 | ```cmd 5 | dotnet tool install --global dotnet-ef --version 8.0.0 6 | ``` 7 | 8 | or update 9 | 10 | ```cmd 11 | dotnet tool update --global dotnet-ef --version 8.0.0 12 | ``` 13 | 14 | ## Add Migration 15 | Select Data. folder and run following command for each provider: 16 | 17 | ```cmd 18 | dotnet ef migrations add 19 | ``` 20 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/RefundEntityConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 3 | using VirtoCommerce.OrdersModule.Data.Model; 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql 6 | { 7 | public class RefundEntityConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.Property(x => x.Amount).HasColumnType("decimal").HasPrecision(18, 4); 12 | 13 | builder.Property(x => x.Sum).HasColumnType("decimal").HasPrecision(18, 4); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/ShipmentEntityConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 3 | using VirtoCommerce.OrdersModule.Data.Model; 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql 6 | { 7 | public class ShipmentEntityConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.Property(x => x.Price).HasColumnType("decimal").HasPrecision(18, 4); 12 | builder.Property(x => x.PriceWithTax).HasColumnType("decimal").HasPrecision(18, 4); 13 | builder.Property(x => x.DiscountAmount).HasColumnType("decimal").HasPrecision(18, 4); 14 | builder.Property(x => x.DiscountAmountWithTax).HasColumnType("decimal").HasPrecision(18, 4); 15 | builder.Property(x => x.Total).HasColumnType("decimal").HasPrecision(18, 4); 16 | builder.Property(x => x.TotalWithTax).HasColumnType("decimal").HasPrecision(18, 4); 17 | builder.Property(x => x.TaxTotal).HasColumnType("decimal").HasPrecision(18, 4); 18 | builder.Property(x => x.Fee).HasColumnType("decimal").HasPrecision(18, 4); 19 | builder.Property(x => x.FeeWithTax).HasColumnType("decimal").HasPrecision(18, 4); 20 | 21 | builder.Property(x => x.Sum).HasColumnType("decimal").HasPrecision(18, 4); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/TaxDetailEntityConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 3 | using VirtoCommerce.OrdersModule.Data.Model; 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.MySql 6 | { 7 | public class TaxDetailEntityConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.Property(x => x.Amount).HasColumnType("decimal").HasPrecision(18, 4); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.MySql/VirtoCommerce.OrdersModule.Data.MySql.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | enable 5 | enable 6 | 7 | 8 | 9 | all 10 | runtime; build; native; contentfiles; analyzers; buildtransitive 11 | 12 | 13 | all 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/CustomerOrderEntityConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 3 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 4 | using VirtoCommerce.OrdersModule.Data.Model; 5 | 6 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql 7 | { 8 | public class CustomerOrderEntityConfiguration : IEntityTypeConfiguration 9 | { 10 | public void Configure(EntityTypeBuilder builder) 11 | { 12 | var converter = new ValueConverter( 13 | v => BitConverter.ToInt64(v, 0), 14 | v => BitConverter.GetBytes(v)); 15 | 16 | builder.Property(c => c.RowVersion) 17 | .HasColumnType("xid") 18 | .HasColumnName("xmin") 19 | .HasConversion(converter) 20 | .ValueGeneratedOnAddOrUpdate() 21 | .IsConcurrencyToken(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20230329093838_AddOrderTimestamp.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | #nullable disable 5 | 6 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations 7 | { 8 | public partial class AddOrderTimestamp : Migration 9 | { 10 | protected override void Up(MigrationBuilder migrationBuilder) 11 | { 12 | migrationBuilder.AddColumn( 13 | name: "RowVersion", 14 | table: "CustomerOrder", 15 | type: "bytea", 16 | rowVersion: true, 17 | nullable: true); 18 | } 19 | 20 | protected override void Down(MigrationBuilder migrationBuilder) 21 | { 22 | migrationBuilder.DropColumn( 23 | name: "RowVersion", 24 | table: "CustomerOrder"); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20230406145645_AddOrderLineItemStatus.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations 6 | { 7 | public partial class AddOrderLineItemStatus : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "Status", 13 | table: "OrderLineItem", 14 | type: "character varying(64)", 15 | maxLength: 64, 16 | nullable: true); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "Status", 23 | table: "OrderLineItem"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20230417134541_SetProductNameLength1024.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations 6 | { 7 | public partial class SetProductNameLength1024 : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AlterColumn( 12 | name: "Name", 13 | table: "OrderLineItem", 14 | type: "character varying(1024)", 15 | maxLength: 1024, 16 | nullable: false, 17 | oldClrType: typeof(string), 18 | oldType: "character varying(256)", 19 | oldMaxLength: 256); 20 | } 21 | 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.AlterColumn( 25 | name: "Name", 26 | table: "OrderLineItem", 27 | type: "character varying(256)", 28 | maxLength: 256, 29 | nullable: false, 30 | oldClrType: typeof(string), 31 | oldType: "character varying(1024)", 32 | oldMaxLength: 1024); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20230504163400_AddTransactionId.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations 6 | { 7 | public partial class AddTransactionId : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "TransactionId", 13 | table: "OrderRefund", 14 | type: "character varying(128)", 15 | maxLength: 128, 16 | nullable: false, 17 | defaultValue: ""); 18 | 19 | migrationBuilder.Sql("UPDATE \"OrderRefund\" SET \"TransactionId\" = \"Id\";"); 20 | 21 | migrationBuilder.CreateIndex( 22 | name: "IX_OrderRefund_TransactionId_CustomerOrderId", 23 | table: "OrderRefund", 24 | columns: new[] { "TransactionId", "CustomerOrderId" }, 25 | unique: true); 26 | } 27 | 28 | protected override void Down(MigrationBuilder migrationBuilder) 29 | { 30 | migrationBuilder.DropIndex( 31 | name: "IX_OrderRefund_TransactionId_CustomerOrderId", 32 | table: "OrderRefund"); 33 | 34 | migrationBuilder.DropColumn( 35 | name: "TransactionId", 36 | table: "OrderRefund"); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20230620095341_FixRowVersion.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations 6 | { 7 | public partial class FixRowVersion : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | } 12 | 13 | protected override void Down(MigrationBuilder migrationBuilder) 14 | { 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20230725060727_AddShipmentItemStatus.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations 6 | { 7 | public partial class AddShipmentItemStatus : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "Status", 13 | table: "OrderShipmentItem", 14 | type: "character varying(128)", 15 | maxLength: 128, 16 | nullable: true); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "Status", 23 | table: "OrderShipmentItem"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20230911181748_AddProductOuterId.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations 6 | { 7 | public partial class AddProductOuterId : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "ProductOuterId", 13 | table: "OrderLineItem", 14 | type: "character varying(128)", 15 | maxLength: 128, 16 | nullable: true); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "ProductOuterId", 23 | table: "OrderLineItem"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20231018130007_IsAnonymous.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations 6 | { 7 | public partial class IsAnonymous : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "IsAnonymous", 13 | table: "CustomerOrder", 14 | type: "boolean", 15 | nullable: false, 16 | defaultValue: false); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "IsAnonymous", 23 | table: "CustomerOrder"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20231204102736_CloseTransaction.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations 6 | { 7 | public partial class CloseTransaction : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "CloseTransaction", 13 | table: "OrderCapture", 14 | type: "boolean", 15 | nullable: false, 16 | defaultValue: false); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "CloseTransaction", 23 | table: "OrderCapture"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20240610081022_AddressDescription.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations 6 | { 7 | /// 8 | public partial class AddressDescription : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "Description", 15 | table: "OrderAddress", 16 | type: "character varying(128)", 17 | maxLength: 128, 18 | nullable: true); 19 | } 20 | 21 | /// 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "Description", 26 | table: "OrderAddress"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241108155806_OrderPromotionName.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations 6 | { 7 | /// 8 | public partial class OrderPromotionName : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "PromotionName", 15 | table: "OrderDiscount", 16 | type: "character varying(128)", 17 | maxLength: 128, 18 | nullable: true); 19 | } 20 | 21 | /// 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "PromotionName", 26 | table: "OrderDiscount"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20241205094652_AddIsDiscountAmountRounded.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations 6 | { 7 | /// 8 | public partial class AddIsDiscountAmountRounded : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "IsDiscountAmountRounded", 15 | table: "OrderLineItem", 16 | type: "boolean", 17 | nullable: false, 18 | defaultValue: false); 19 | } 20 | 21 | /// 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "IsDiscountAmountRounded", 26 | table: "OrderLineItem"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20250213093142_AddOrderConfigurationItemTypeAndText.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations 6 | { 7 | /// 8 | public partial class AddOrderConfigurationItemTypeAndText : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "CustomText", 15 | table: "OrderConfigurationItem", 16 | type: "character varying(255)", 17 | maxLength: 255, 18 | nullable: true); 19 | 20 | migrationBuilder.AddColumn( 21 | name: "Type", 22 | table: "OrderConfigurationItem", 23 | type: "character varying(64)", 24 | maxLength: 64, 25 | nullable: false, 26 | defaultValue: "Product"); 27 | } 28 | 29 | /// 30 | protected override void Down(MigrationBuilder migrationBuilder) 31 | { 32 | migrationBuilder.DropColumn( 33 | name: "CustomText", 34 | table: "OrderConfigurationItem"); 35 | 36 | migrationBuilder.DropColumn( 37 | name: "Type", 38 | table: "OrderConfigurationItem"); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Migrations/20250428174852_AddAddressMiddleName.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql.Migrations 6 | { 7 | /// 8 | public partial class AddAddressMiddleName : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "MiddleName", 15 | table: "OrderAddress", 16 | type: "character varying(128)", 17 | maxLength: 128, 18 | nullable: true); 19 | } 20 | 21 | /// 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "MiddleName", 26 | table: "OrderAddress"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/PostgreSqlDataAssemblyMarker.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql; 2 | 3 | public class PostgreSqlDataAssemblyMarker 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/PostgreSqlDbContextFactory.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Design; 3 | using VirtoCommerce.OrdersModule.Data.Repositories; 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.PostgreSql 6 | { 7 | public class PostgreSqlDbContextFactory : IDesignTimeDbContextFactory 8 | { 9 | public OrderDbContext CreateDbContext(string[] args) 10 | { 11 | var builder = new DbContextOptionsBuilder(); 12 | var connectionString = args.Any() ? args[0] : "User ID = postgres; Password = password; Host = localhost; Port = 5432; Database = virtocommerce3;"; 13 | 14 | builder.UseNpgsql( 15 | connectionString, 16 | db => db.MigrationsAssembly(typeof(PostgreSqlDataAssemblyMarker).Assembly.GetName().Name)); 17 | 18 | return new OrderDbContext(builder.Options); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/Readme.md: -------------------------------------------------------------------------------- 1 | # Generate Migrations 2 | 3 | ## Install CLI tools for Entity Framework Core 4 | ```cmd 5 | dotnet tool install --global dotnet-ef --version 8.0.0 6 | ``` 7 | 8 | or update 9 | 10 | ```cmd 11 | dotnet tool update --global dotnet-ef --version 8.0.0 12 | ``` 13 | 14 | ## Add Migration 15 | Select Data. folder and run following command for each provider: 16 | 17 | ```cmd 18 | dotnet ef migrations add 19 | ``` 20 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.PostgreSql/VirtoCommerce.OrdersModule.Data.PostgreSql.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | enable 5 | 6 | 7 | 8 | all 9 | runtime; build; native; contentfiles; analyzers; buildtransitive 10 | 11 | 12 | all 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20200409175753_AddOrderAddressName.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 4 | { 5 | public partial class AddOrderAddressName : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AddColumn( 10 | name: "Name", 11 | table: "OrderAddress", 12 | maxLength: 2048, 13 | nullable: true); 14 | } 15 | 16 | protected override void Down(MigrationBuilder migrationBuilder) 17 | { 18 | migrationBuilder.DropColumn( 19 | name: "Name", 20 | table: "OrderAddress"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20200901081052_PurchaseOrderNumber.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 4 | { 5 | public partial class PurchaseOrderNumber : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AddColumn( 10 | name: "PurchaseOrderNumber", 11 | table: "CustomerOrder", 12 | maxLength: 128, 13 | nullable: true); 14 | } 15 | 16 | protected override void Down(MigrationBuilder migrationBuilder) 17 | { 18 | migrationBuilder.DropColumn( 19 | name: "PurchaseOrderNumber", 20 | table: "CustomerOrder"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20210512162446_AddOrderFulfillmentCenterId.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 4 | { 5 | public partial class AddOrderFulfillmentCenterId : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AddColumn( 10 | name: "FulfillmentCenterId", 11 | table: "OrderLineItem", 12 | maxLength: 64, 13 | nullable: true); 14 | 15 | migrationBuilder.AddColumn( 16 | name: "FulfillmentCenterName", 17 | table: "OrderLineItem", 18 | maxLength: 128, 19 | nullable: true); 20 | } 21 | 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "FulfillmentCenterId", 26 | table: "OrderLineItem"); 27 | 28 | migrationBuilder.DropColumn( 29 | name: "FulfillmentCenterName", 30 | table: "OrderLineItem"); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20210911072238_AddAddressOuterId.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 4 | { 5 | public partial class AddAddressOuterId : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AddColumn( 10 | name: "OuterId", 11 | table: "OrderAddress", 12 | maxLength: 128, 13 | nullable: true); 14 | } 15 | 16 | protected override void Down(MigrationBuilder migrationBuilder) 17 | { 18 | migrationBuilder.DropColumn( 19 | name: "OuterId", 20 | table: "OrderAddress"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20221223154901_ChangeProductIdLength.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | public partial class ChangeProductIdLength : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AlterColumn( 12 | name: "ProductId", 13 | table: "OrderLineItem", 14 | type: "nvarchar(128)", 15 | maxLength: 128, 16 | nullable: false, 17 | oldClrType: typeof(string), 18 | oldType: "nvarchar(64)", 19 | oldMaxLength: 64); 20 | } 21 | 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.AlterColumn( 25 | name: "ProductId", 26 | table: "OrderLineItem", 27 | type: "nvarchar(64)", 28 | maxLength: 64, 29 | nullable: false, 30 | oldClrType: typeof(string), 31 | oldType: "nvarchar(128)", 32 | oldMaxLength: 128); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20221226121725_ChangeSkuLength.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | public partial class ChangeSkuLength : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AlterColumn( 12 | name: "Sku", 13 | table: "OrderLineItem", 14 | type: "nvarchar(128)", 15 | maxLength: 128, 16 | nullable: false, 17 | oldClrType: typeof(string), 18 | oldType: "nvarchar(64)", 19 | oldMaxLength: 64); 20 | } 21 | 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.AlterColumn( 25 | name: "Sku", 26 | table: "OrderLineItem", 27 | type: "nvarchar(64)", 28 | maxLength: 64, 29 | nullable: false, 30 | oldClrType: typeof(string), 31 | oldType: "nvarchar(128)", 32 | oldMaxLength: 128); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20221229153308_AddVendorId.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | public partial class AddVendorId : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "VendorId", 13 | table: "OrderShipment", 14 | type: "nvarchar(64)", 15 | maxLength: 64, 16 | nullable: true); 17 | 18 | migrationBuilder.AddColumn( 19 | name: "VendorId", 20 | table: "OrderPaymentIn", 21 | type: "nvarchar(64)", 22 | maxLength: 64, 23 | nullable: true); 24 | } 25 | 26 | protected override void Down(MigrationBuilder migrationBuilder) 27 | { 28 | migrationBuilder.DropColumn( 29 | name: "VendorId", 30 | table: "OrderShipment"); 31 | 32 | migrationBuilder.DropColumn( 33 | name: "VendorId", 34 | table: "OrderPaymentIn"); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20230124135725_AddLineItemVendorId.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | public partial class AddLineItemVendorId : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "VendorId", 13 | table: "OrderLineItem", 14 | type: "nvarchar(128)", 15 | maxLength: 128, 16 | nullable: true); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "VendorId", 23 | table: "OrderLineItem"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20230327230730_AddOrderTimestamp.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | #nullable disable 5 | 6 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 7 | { 8 | public partial class AddOrderTimestamp : Migration 9 | { 10 | protected override void Up(MigrationBuilder migrationBuilder) 11 | { 12 | migrationBuilder.AddColumn( 13 | name: "RowVersion", 14 | table: "CustomerOrder", 15 | type: "rowversion", 16 | rowVersion: true, 17 | nullable: true); 18 | } 19 | 20 | protected override void Down(MigrationBuilder migrationBuilder) 21 | { 22 | migrationBuilder.DropColumn( 23 | name: "RowVersion", 24 | table: "CustomerOrder"); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20230406145524_AddOrderLineItemStatus.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | public partial class AddOrderLineItemStatus : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "Status", 13 | table: "OrderLineItem", 14 | type: "nvarchar(64)", 15 | maxLength: 64, 16 | nullable: true); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "Status", 23 | table: "OrderLineItem"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20230417134611_SetProductNameLength1024.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | public partial class SetProductNameLength1024 : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AlterColumn( 12 | name: "Name", 13 | table: "OrderLineItem", 14 | type: "nvarchar(1024)", 15 | maxLength: 1024, 16 | nullable: false, 17 | oldClrType: typeof(string), 18 | oldType: "nvarchar(256)", 19 | oldMaxLength: 256); 20 | } 21 | 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.AlterColumn( 25 | name: "Name", 26 | table: "OrderLineItem", 27 | type: "nvarchar(256)", 28 | maxLength: 256, 29 | nullable: false, 30 | oldClrType: typeof(string), 31 | oldType: "nvarchar(1024)", 32 | oldMaxLength: 1024); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20230504162915_AddTransactionId.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | public partial class AddTransactionId : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "TransactionId", 13 | table: "OrderRefund", 14 | type: "nvarchar(128)", 15 | maxLength: 128, 16 | nullable: false, 17 | defaultValue: ""); 18 | 19 | migrationBuilder.Sql("UPDATE OrderRefund SET TransactionId = Id"); 20 | 21 | migrationBuilder.CreateIndex( 22 | name: "IX_OrderRefund_TransactionId_CustomerOrderId", 23 | table: "OrderRefund", 24 | columns: new[] { "TransactionId", "CustomerOrderId" }, 25 | unique: true, 26 | filter: "[CustomerOrderId] IS NOT NULL"); 27 | } 28 | 29 | protected override void Down(MigrationBuilder migrationBuilder) 30 | { 31 | migrationBuilder.DropIndex( 32 | name: "IX_OrderRefund_TransactionId_CustomerOrderId", 33 | table: "OrderRefund"); 34 | 35 | migrationBuilder.DropColumn( 36 | name: "TransactionId", 37 | table: "OrderRefund"); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20230714115506_AddShipmentItemStatus.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | public partial class AddShipmentItemStatus : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "Status", 13 | table: "OrderShipmentItem", 14 | type: "nvarchar(128)", 15 | maxLength: 128, 16 | nullable: true); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "Status", 23 | table: "OrderShipmentItem"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20230911181802_AddProductOuterId.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | public partial class AddProductOuterId : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "ProductOuterId", 13 | table: "OrderLineItem", 14 | type: "nvarchar(128)", 15 | maxLength: 128, 16 | nullable: true); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "ProductOuterId", 23 | table: "OrderLineItem"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20231018125853_IsAnonymous.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | public partial class IsAnonymous : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "IsAnonymous", 13 | table: "CustomerOrder", 14 | type: "bit", 15 | nullable: false, 16 | defaultValue: false); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "IsAnonymous", 23 | table: "CustomerOrder"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20231204102652_CloseTransaction.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | public partial class CloseTransaction : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "CloseTransaction", 13 | table: "OrderCapture", 14 | type: "bit", 15 | nullable: false, 16 | defaultValue: false); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "CloseTransaction", 23 | table: "OrderCapture"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20240610080923_AddressDescription.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | /// 8 | public partial class AddressDescription : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "Description", 15 | table: "OrderAddress", 16 | type: "nvarchar(128)", 17 | maxLength: 128, 18 | nullable: true); 19 | } 20 | 21 | /// 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "Description", 26 | table: "OrderAddress"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241108155834_OrderPromotionName.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | /// 8 | public partial class OrderPromotionName : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "PromotionName", 15 | table: "OrderDiscount", 16 | type: "nvarchar(128)", 17 | maxLength: 128, 18 | nullable: true); 19 | } 20 | 21 | /// 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "PromotionName", 26 | table: "OrderDiscount"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20241205094527_AddIsDiscountAmountRounded.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | /// 8 | public partial class AddIsDiscountAmountRounded : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "IsDiscountAmountRounded", 15 | table: "OrderLineItem", 16 | type: "bit", 17 | nullable: false, 18 | defaultValue: false); 19 | } 20 | 21 | /// 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "IsDiscountAmountRounded", 26 | table: "OrderLineItem"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20250213093447_AddOrderConfigurationItemTypeAndText.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | /// 8 | public partial class AddOrderConfigurationItemTypeAndText : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "CustomText", 15 | table: "OrderConfigurationItem", 16 | type: "nvarchar(255)", 17 | maxLength: 255, 18 | nullable: true); 19 | 20 | migrationBuilder.AddColumn( 21 | name: "Type", 22 | table: "OrderConfigurationItem", 23 | type: "nvarchar(64)", 24 | maxLength: 64, 25 | nullable: false, 26 | defaultValue: "Product"); 27 | } 28 | 29 | /// 30 | protected override void Down(MigrationBuilder migrationBuilder) 31 | { 32 | migrationBuilder.DropColumn( 33 | name: "CustomText", 34 | table: "OrderConfigurationItem"); 35 | 36 | migrationBuilder.DropColumn( 37 | name: "Type", 38 | table: "OrderConfigurationItem"); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Migrations/20250428174920_AddAddressMiddleName.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer.Migrations 6 | { 7 | /// 8 | public partial class AddAddressMiddleName : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "MiddleName", 15 | table: "OrderAddress", 16 | type: "nvarchar(128)", 17 | maxLength: 128, 18 | nullable: true); 19 | } 20 | 21 | /// 22 | protected override void Down(MigrationBuilder migrationBuilder) 23 | { 24 | migrationBuilder.DropColumn( 25 | name: "MiddleName", 26 | table: "OrderAddress"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/Readme.md: -------------------------------------------------------------------------------- 1 | # Generate Migrations 2 | 3 | ## Install CLI tools for Entity Framework Core 4 | ```cmd 5 | dotnet tool install --global dotnet-ef --version 8.0.0 6 | ``` 7 | 8 | or update 9 | 10 | ```cmd 11 | dotnet tool update --global dotnet-ef --version 8.0.0 12 | ``` 13 | 14 | ## Add Migration 15 | Select Data. folder and run following command for each provider: 16 | 17 | ```cmd 18 | dotnet ef migrations add 19 | ``` 20 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/SqlServerDataAssemblyMarker.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Data.SqlServer; 2 | 3 | public class SqlServerDataAssemblyMarker 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/SqlServerDbContextFactory.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore.Design; 3 | using VirtoCommerce.OrdersModule.Data.Repositories; 4 | 5 | namespace VirtoCommerce.OrdersModule.Data.SqlServer 6 | { 7 | public class SqlServerDbContextFactory : IDesignTimeDbContextFactory 8 | { 9 | public OrderDbContext CreateDbContext(string[] args) 10 | { 11 | var builder = new DbContextOptionsBuilder(); 12 | var connectionString = args.Any() ? args[0] : "Data Source=(local);Initial Catalog=VirtoCommerce3;Persist Security Info=True;User ID=virto;Password=virto;MultipleActiveResultSets=True;Connect Timeout=30"; 13 | 14 | builder.UseSqlServer( 15 | connectionString, 16 | db => db.MigrationsAssembly(typeof(SqlServerDataAssemblyMarker).Assembly.GetName().Name)); 17 | 18 | return new OrderDbContext(builder.Options); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data.SqlServer/VirtoCommerce.OrdersModule.Data.SqlServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | enable 5 | enable 6 | 7 | 8 | 9 | all 10 | runtime; build; native; contentfiles; analyzers; buildtransitive 11 | 12 | 13 | all 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data/Authorization/OnlyOrderResponsibleScope.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.Platform.Core.Security; 2 | 3 | namespace VirtoCommerce.OrdersModule.Data.Authorization 4 | { 5 | /// 6 | /// Restrict access rights to orders where user is assigned as responsible 7 | /// 8 | public sealed class OnlyOrderResponsibleScope : PermissionScope 9 | { 10 | public OnlyOrderResponsibleScope() 11 | { 12 | Scope = "{{userId}}"; 13 | Label = "none"; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data/Authorization/OrderAuthorizationRequirement.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.Platform.Security.Authorization; 2 | 3 | namespace VirtoCommerce.OrdersModule.Data.Authorization 4 | { 5 | public sealed class OrderAuthorizationRequirement : PermissionAuthorizationRequirement 6 | { 7 | public OrderAuthorizationRequirement(string permission) 8 | : base(permission) 9 | { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data/Authorization/OrderSelectedStoreScope.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.Platform.Core.Security; 2 | 3 | namespace VirtoCommerce.OrdersModule.Data.Authorization 4 | { 5 | /// 6 | /// Restricts access rights to orders that belong to a particular store 7 | /// 8 | public sealed class OrderSelectedStoreScope : PermissionScope 9 | { 10 | public string StoreId => Scope; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data/Caching/OrderCacheRegion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Microsoft.Extensions.Primitives; 5 | using VirtoCommerce.OrdersModule.Core.Model; 6 | using VirtoCommerce.Platform.Core.Caching; 7 | 8 | namespace VirtoCommerce.OrdersModule.Data.Caching 9 | { 10 | public class OrderCacheRegion : CancellableCacheRegion 11 | { 12 | public static IChangeToken CreateChangeToken(CustomerOrder[] orders) 13 | { 14 | if (orders == null) 15 | { 16 | throw new ArgumentNullException(nameof(orders)); 17 | } 18 | return CreateChangeToken(orders.Select(x => x.Id).ToArray()); 19 | } 20 | 21 | public static IChangeToken CreateChangeToken(string[] entityIds) 22 | { 23 | if (entityIds == null) 24 | { 25 | throw new ArgumentNullException(nameof(entityIds)); 26 | } 27 | 28 | var changeTokens = new List { CreateChangeToken() }; 29 | foreach (var entityId in entityIds) 30 | { 31 | changeTokens.Add(CreateChangeTokenForKey(entityId)); 32 | } 33 | return new CompositeChangeToken(changeTokens); 34 | } 35 | 36 | public static void ExpireOrder(CustomerOrder order) 37 | { 38 | ExpireTokenForKey(order.Id); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data/Caching/OrderSearchCacheRegion.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.Platform.Core.Caching; 2 | 3 | namespace VirtoCommerce.OrdersModule.Data.Caching 4 | { 5 | public class OrderSearchCacheRegion : CancellableCacheRegion 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data/Handlers/PurchasedProductIndexationSettingChangedEventHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | using VirtoCommerce.OrdersModule.Data.Search.Indexed; 4 | using VirtoCommerce.Platform.Core.Common; 5 | using VirtoCommerce.Platform.Core.Events; 6 | using VirtoCommerce.Platform.Core.Settings.Events; 7 | using static VirtoCommerce.OrdersModule.Core.ModuleConstants.Settings.General; 8 | 9 | namespace VirtoCommerce.OrdersModule.Data.Handlers 10 | { 11 | public class PurchasedProductIndexationSettingChangedEventHandler : IEventHandler 12 | { 13 | private readonly PurchasedProductsIndexConfigurator _configurator; 14 | 15 | public PurchasedProductIndexationSettingChangedEventHandler(PurchasedProductsIndexConfigurator configurator) 16 | { 17 | _configurator = configurator; 18 | } 19 | 20 | public virtual async Task Handle(ObjectSettingChangedEvent message) 21 | { 22 | if (message.ChangedEntries.Any(x => (x.EntryState == EntryState.Modified || x.EntryState == EntryState.Added) && 23 | x.NewEntry.Name == PurchasedProductIndexation.Name)) 24 | { 25 | await _configurator.Configure(); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data/Model/ISupportPartialPriceUpdate.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace VirtoCommerce.OrdersModule.Data.Model 4 | { 5 | public interface ISupportPartialPriceUpdate 6 | { 7 | void ResetPrices(); 8 | IEnumerable GetNonCalculatablePrices(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data/Model/OrderDynamicPropertyObjectValueEntity.cs: -------------------------------------------------------------------------------- 1 | using VirtoCommerce.Platform.Data.Model; 2 | 3 | namespace VirtoCommerce.OrdersModule.Data.Model 4 | { 5 | // because we do not have Operation table, we need to store FK for each derived class 6 | public class OrderDynamicPropertyObjectValueEntity : DynamicPropertyObjectValueEntity 7 | { 8 | #region Navigation Properties 9 | 10 | public string CustomerOrderId { get; set; } 11 | public virtual CustomerOrderEntity CustomerOrder { get; set; } 12 | 13 | public string PaymentInId { get; set; } 14 | public virtual PaymentInEntity PaymentIn { get; set; } 15 | 16 | public string ShipmentId { get; set; } 17 | public virtual ShipmentEntity Shipment { get; set; } 18 | 19 | public string LineItemId { get; set; } 20 | public virtual LineItemEntity LineItem { get; set; } 21 | 22 | public string RefundId { get; set; } 23 | public virtual RefundEntity Refund { get; set; } 24 | 25 | public string CaptureId { get; set; } 26 | public virtual CaptureEntity Capture { get; set; } 27 | 28 | #endregion 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data/Repositories/IOrderRepository.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | using VirtoCommerce.OrdersModule.Data.Model; 5 | using VirtoCommerce.Platform.Core.Common; 6 | 7 | namespace VirtoCommerce.OrdersModule.Data.Repositories 8 | { 9 | public interface IOrderRepository : IRepository 10 | { 11 | IQueryable CustomerOrders { get; } 12 | IQueryable Shipments { get; } 13 | IQueryable InPayments { get; } 14 | IQueryable Addresses { get; } 15 | IQueryable LineItems { get; } 16 | 17 | Task> GetCustomerOrdersByIdsAsync(IList ids, string responseGroup = null); 18 | Task> GetPaymentsByIdsAsync(IList ids); 19 | Task> GetShipmentsByIdsAsync(IList ids); 20 | 21 | Task RemoveOrdersByIdsAsync(IList ids); 22 | 23 | /// 24 | /// Patch RowVersion to throw DBConcurrencyException exception if someone updated order before. 25 | /// 26 | /// 27 | /// 28 | void PatchRowVersion(CustomerOrderEntity entity, byte[] rowVersion); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Data/VirtoCommerce.OrdersModule.Data.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | true 5 | 1591 6 | True 7 | true 8 | true 9 | true 10 | snupkg 11 | 12 | 13 | 14 | false 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Content/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VirtoCommerce/vc-module-order/9b0f6ddde193f979e316647beb91fa9dfaeb388b/src/VirtoCommerce.OrdersModule.Web/Content/logo.png -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Extensions/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using VirtoCommerce.OrdersModule.Core.Model; 4 | using VirtoCommerce.OrdersModule.Data.Validators; 5 | using VirtoCommerce.OrdersModule.Web.Validation; 6 | 7 | namespace VirtoCommerce.OrdersModule.Web.Extensions 8 | { 9 | public static class ServiceCollectionExtensions 10 | { 11 | public static void AddValidators(this IServiceCollection serviceCollection) 12 | { 13 | serviceCollection.AddTransient, CustomerOrderValidator>(); 14 | serviceCollection.AddTransient, PaymentInValidator>(); 15 | serviceCollection.AddTransient, PaymentRequestValidator>(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Model/KeyValuePair.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Web.Model 2 | { 3 | public class KeyValuePair 4 | { 5 | public string Key { get; set; } 6 | public string Value { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Model/PaymentCallbackParameters.cs: -------------------------------------------------------------------------------- 1 | namespace VirtoCommerce.OrdersModule.Web.Model 2 | { 3 | public class PaymentCallbackParameters 4 | { 5 | public KeyValuePair[] Parameters { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/NotificationTemplates/CancelOrderEmailNotification_subject.txt: -------------------------------------------------------------------------------- 1 | Your order {{customer_order.number}} has been canceled -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/NotificationTemplates/InvoiceEmailNotification_subject.txt: -------------------------------------------------------------------------------- 1 | Invoice for order {{ customer_order.number }} -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/NotificationTemplates/NewOrderStatusEmailNotification_subject.txt: -------------------------------------------------------------------------------- 1 | The status of your order {{customer_order.number}} has been changed -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/NotificationTemplates/OrderCreateEmailNotification_subject.txt: -------------------------------------------------------------------------------- 1 | You successfully created your order {{customer_order.number}} -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/NotificationTemplates/OrderPaidEmailNotification_subject.txt: -------------------------------------------------------------------------------- 1 | Your order {{customer_order.number}} has been fully paid -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/NotificationTemplates/OrderSentEmailNotification_subject.txt: -------------------------------------------------------------------------------- 1 | Your order {{customer_order.number}} has been sent -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/NotificationTemplates/PaymentStatusChangedEmailNotification_subject.txt: -------------------------------------------------------------------------------- 1 | Payment status changed -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/NotificationTemplates/ShipmentStatusChangedEmailNotification_subject.txt: -------------------------------------------------------------------------------- 1 | Shipment status changed -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:34240/", 7 | "sslPort": 44379 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "VirtoCommerce.OrdersModule.Web": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "https://localhost:5001;http://localhost:5000" 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/blades/addresses/address-list.tpl.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
    5 |
  • 6 | {{addressType}} 7 |
      8 |
    • 9 |
      10 |
      11 | {{getAddressName(address) | limitTo:50}} 12 | {{address.addressType}} 13 |
      14 |
      15 | Default 16 |
      17 |
      18 |
    • 19 |
    20 |
  • 21 |
22 |

{{ 'orders.blades.address-list.labels.no-addresses' | translate }}

23 |
24 |
25 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-change-log.tpl.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
13 |
14 |
15 |
{{ 'platform.list.no-data' | translate }}
16 |
17 |
18 |
19 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-configuration.tpl.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
    5 |
  • 6 | 7 | {{'orders.blades.customerOrder-item-configuration.menu.products.title' | translate}} 8 | {{'orders.blades.customerOrder-item-configuration.menu.products.description' | translate}} 9 |
  • 10 |
  • 11 | 12 | {{'orders.blades.customerOrder-item-configuration.menu.texts.title' | translate}} 13 | {{'orders.blades.customerOrder-item-configuration.menu.texts.description' | translate}} 14 |
  • 15 |
  • 16 | 17 | {{'orders.blades.customerOrder-item-configuration.menu.files.title' | translate}} 18 | {{'orders.blades.customerOrder-item-configuration.menu.files.description' | translate}} 19 |
  • 20 |
21 |
22 |
23 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-dicsounts.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.customerOrderItemDiscountController', [ 3 | '$scope', 'platformWebApp.uiGridHelper', 4 | function ($scope, uiGridHelper) { 5 | var blade = $scope.blade; 6 | blade.title = 'orders.blades.customerOrder-item-discounts.title'; 7 | blade.headIcon = 'fa fa-area-chart'; 8 | 9 | $scope.setGridOptions = function (gridOptions) { 10 | uiGridHelper.initialize($scope, gridOptions, function (gridApi) { 11 | $scope.gridApi = gridApi; 12 | }); 13 | }; 14 | 15 | function initialize() { 16 | blade.isLoading = false; 17 | } 18 | 19 | initialize(); 20 | }]); 21 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/blades/operation-comment.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.orderOperationCommentDetail', ['$scope', function ($scope) { 3 | var blade = $scope.blade; 4 | 5 | function initializeBlade() { 6 | blade.origEntity = blade.currentEntity; 7 | blade.currentEntity = angular.copy(blade.origEntity.comment); 8 | blade.isLoading = false; 9 | } 10 | 11 | $scope.cancelChanges = function () { $scope.bladeClose(); }; 12 | 13 | $scope.isValid = function () { return true; }; 14 | 15 | $scope.saveChanges = function () { 16 | blade.origEntity.comment = blade.currentEntity; 17 | $scope.bladeClose(); 18 | }; 19 | 20 | initializeBlade(); 21 | }]); -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/blades/operation-comment.tpl.html: -------------------------------------------------------------------------------- 1 | 
2 |
3 |
4 |
5 |
6 |
7 | 8 |
9 | 10 |
11 |
12 |
13 |
14 |
15 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/blades/payment-transactions-detail.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.paymentTransactionsDetailController', ['$scope', 'platformWebApp.bladeNavigationService', 'platformWebApp.dialogService', 'platformWebApp.bladeUtils', function ($scope, bladeNavigationService, dialogService) { 3 | var blade = $scope.blade; 4 | blade.isLoading = false; 5 | blade.title = 'orders.blades.transaction-detail.title'; 6 | blade.subtitle = 'orders.blades.transaction-detail.subtitle'; 7 | }]); -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/blades/payment-transactions-detail.tpl.html: -------------------------------------------------------------------------------- 1 | 
2 |
3 |
4 |
5 |
{{blade.currentEntity | json}}
6 |
7 |
8 |
9 |
10 | 11 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/blades/payment-transactions-list.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.paymentTransactionsListController', ['$scope', 'platformWebApp.bladeNavigationService', 'platformWebApp.dialogService', 'platformWebApp.bladeUtils', function ($scope, bladeNavigationService, dialogService) { 3 | var blade = $scope.blade; 4 | 5 | blade.isLoading = false; 6 | 7 | blade.title = 'orders.blades.transactions-list.title'; 8 | blade.subtitle = 'orders.blades.transactions-list.subtitle', 9 | // ui-grid 10 | $scope.setGridOptions = function (gridOptions) { 11 | // add currency filter for properties that need it 12 | Array.prototype.push.apply(gridOptions.columnDefs, _.map(["amount"], function (name) { 13 | return { name: name, cellFilter: "currency", visible: false }; 14 | })); 15 | 16 | $scope.gridOptions = gridOptions; 17 | }; 18 | 19 | $scope.selectNode = function (transaction) { 20 | 21 | var newBlade = { 22 | id: 'transactionDetail', 23 | currentEntity: transaction, 24 | controller: 'virtoCommerce.orderModule.paymentTransactionsDetailController', 25 | template: 'Modules/$(VirtoCommerce.Orders)/Scripts/blades/payment-transactions-detail.tpl.html' 26 | }; 27 | bladeNavigationService.showBlade(newBlade, blade); 28 | }; 29 | }]); -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/dialogs/cancelOperation-dialog.tpl.html: -------------------------------------------------------------------------------- 1 |  4 | 10 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/directives/maskMoney.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | // directive mask the price if value passed to directive is true 3 | .directive('maskMoney', ['showPriceFilter', function (showPriceFilter) { 4 | return { 5 | restrict: 'A', 6 | require: 'ngModel', 7 | scope: { 8 | maskMoney: '=', 9 | }, 10 | link: function (scope, el, attrs, ngModelCtrl) { 11 | var mask = scope.maskMoney; 12 | 13 | if (mask) { 14 | el.attr('readonly', true); 15 | } 16 | 17 | ngModelCtrl.$formatters.unshift(function (value) { 18 | return mask ? showPriceFilter(value, false) : value; 19 | }); 20 | } 21 | }; 22 | }]); 23 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/resources/customerOrders.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .factory('virtoCommerce.orderModule.order_res_customerOrders', ['$resource', function ($resource) { 3 | return $resource('api/order/customerOrders/:id', { id: '@Id' }, { 4 | search: { method: 'POST', url: 'api/order/customerOrders/search' }, 5 | getNewShipment: { url: 'api/order/customerOrders/:id/shipments/new' }, 6 | getNewPayment: { url: 'api/order/customerOrders/:id/payments/new' }, 7 | recalculate: { method: 'PUT', url: 'api/order/customerOrders/recalculate' }, 8 | update: { method: 'PUT', url: 'api/order/customerOrders' }, 9 | getDashboardStatistics: { url: 'api/order/dashboardStatistics' }, 10 | getOrderChanges: { method: 'GET', url: 'api/order/customerOrders/:id/changes', isArray: true }, 11 | searchOrderChanges: { method: 'POST', url: 'api/order/customerOrders/searchChanges' }, 12 | indexedSearch: { method: 'POST', url: 'api/order/customerOrders/indexed/search' }, 13 | indexedSearchEnabled: { method: 'GET', url: '/api/order/customerOrders/indexed/searchEnabled' }, 14 | capturePayment: { method: 'POST', url: 'api/order/payments/payment/capture' }, 15 | refundPayment: { method: 'POST', url: 'api/order/payments/payment/refund' } 16 | }); 17 | }]); 18 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/resources/fulfillmentCenters.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .factory('virtoCommerce.orderModule.order_res_fulfilmentCenters', ['$resource', function ($resource) { 3 | return $resource('api/fulfillment/centers'); 4 | }]); -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/services/refundReasons.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .factory('virtoCommerce.orderModule.refundReasonsService', ['$translate', function ($translate) { 3 | var refundCodes = ['Duplicate', 'Fraudulent', 'RequestedByCustomer', 'Other']; 4 | 5 | function translateCode(code) { 6 | var translateKey = 'orders.settings.reason-codes.' + code.toLowerCase(); 7 | var result = $translate.instant(translateKey); 8 | return result === translateKey ? code : result; 9 | } 10 | 11 | return { 12 | refundCodes: refundCodes, 13 | getRefundReasons: function () { 14 | return _.map(refundCodes, function (x) { 15 | return { 16 | id: x, 17 | name: translateCode(x) 18 | }; 19 | }); 20 | } 21 | }; 22 | }]) 23 | 24 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/services/showPriceFilter.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | // filter to mask the price if argument is false 3 | .filter('showPrice', function () { 4 | return function (value, show) { 5 | var regexp = /\d/g; 6 | 7 | if (regexp.test(value) && arguments.length > 1 && !show) { 8 | value = String(value).replace(regexp, '#'); 9 | } 10 | 11 | return value; 12 | }; 13 | }); 14 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/customerOrder-address-widget.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.customerOrderAddressWidgetController', ['$scope', 'platformWebApp.bladeNavigationService', function ($scope, bladeNavigationService) { 3 | $scope.operation = {}; 4 | $scope.openAddressesBlade = function () { 5 | var newBlade = { 6 | id: 'orderOperationAddresses', 7 | title: 'orders.widgets.customerOrder-address.blade-title', 8 | currentEntities: $scope.operation.addresses, 9 | controller: 'virtoCommerce.orderModule.addressListController', 10 | template: 'Modules/$(VirtoCommerce.Orders)/Scripts/blades/addresses/address-list.tpl.html' 11 | }; 12 | bladeNavigationService.showBlade(newBlade, $scope.blade); 13 | }; 14 | $scope.$watch('widget.blade.customerOrder', function (operation) { 15 | $scope.operation = operation; 16 | }); 17 | }]); 18 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/customerOrder-address-widget.tpl.html: -------------------------------------------------------------------------------- 1 | 
2 |
3 |
{{operation.addresses.length | number:0}}
4 |
{{'orders.widgets.customerOrder-address.title' | translate}}
5 |
6 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/customerOrder-change-log-widget.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.customerOrderChangeLogWidgetController', ['$scope', 'platformWebApp.bladeNavigationService', function ($scope, bladeNavigationService) { 3 | var blade = $scope.widget.blade; 4 | 5 | blade.showOrderChanges = function () { 6 | var newBlade = { 7 | id: 'customerOrderChangeLog', 8 | orderId: blade.customerOrder.id, 9 | headIcon: blade.headIcon, 10 | title: blade.title, 11 | titleValues: { customer: blade.customerOrder.customerName }, 12 | subtitle: 'platform.widgets.operations.blade-subtitle', 13 | isExpandable: true, 14 | controller: 'virtoCommerce.orderModule.customerOrderChangeLogController', 15 | template: 'Modules/$(VirtoCommerce.Orders)/Scripts/blades/customerOrder-change-log.tpl.html' 16 | }; 17 | bladeNavigationService.showBlade(newBlade, blade); 18 | }; 19 | }]); 20 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/customerOrder-change-log-widget.tpl.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
{{ 'platform.widgets.operations.title' | translate }}
4 |
5 |
6 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/customerOrder-item-configuration-widget.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.customerOrderItemConfigurationWidgetController', ['$scope', 'platformWebApp.bladeNavigationService', function ($scope, bladeNavigationService) { 3 | var blade = $scope.blade; 4 | 5 | $scope.openBlade = function () { 6 | var newBlade = { 7 | id: "itemConfiguration", 8 | controller: 'virtoCommerce.orderModule.customerOrderItemConfigurationController', 9 | template: 'Modules/$(VirtoCommerce.Orders)/Scripts/blades/customerOrder-item-configuration.tpl.html', 10 | currentEntity: blade.currentEntity, 11 | }; 12 | bladeNavigationService.showBlade(newBlade, blade); 13 | }; 14 | }]); 15 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/customerOrder-item-configuration-widget.tpl.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
{{ 'orders.widgets.configuration.title' | translate }}
5 |
6 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/customerOrder-item-discounts-widget.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.customerOrderItemDiscountWidgetController', ['$scope', 'platformWebApp.bladeNavigationService', function ($scope, bladeNavigationService) { 3 | var blade = $scope.blade; 4 | 5 | $scope.openBlade = function () { 6 | var newBlade = { 7 | id: "itemDiscounts", 8 | controller: 'virtoCommerce.orderModule.customerOrderItemDiscountController', 9 | template: 'Modules/$(VirtoCommerce.Orders)/Scripts/blades/customerOrder-item-dicsounts.tpl.html', 10 | currentEntity: blade.currentEntity, 11 | }; 12 | bladeNavigationService.showBlade(newBlade, blade); 13 | }; 14 | }]); 15 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/customerOrder-item-discounts-widget.tpl.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
{{blade.currentEntity.discounts.length | number:0}}
4 |
{{ 'orders.widgets.customerOrder-item-discounts.title' | translate }}
5 |
6 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/customerOrder-items-widget.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.customerOrderItemsWidgetController', ['$scope', 'platformWebApp.bladeNavigationService', 3 | function ($scope, bladeNavigationService) { 4 | var blade = $scope.widget.blade; 5 | 6 | $scope.$watch('widget.blade.customerOrder', function (operation) { 7 | $scope.operation = operation; 8 | }); 9 | 10 | $scope.openItemsBlade = function () { 11 | var newBlade = { 12 | id: 'customerOrderItems', 13 | currentEntity: $scope.operation, 14 | recalculateFn: blade.recalculate, 15 | parentRefresh: blade.refresh, 16 | controller: 'virtoCommerce.orderModule.customerOrderItemsController', 17 | template: 'Modules/$(VirtoCommerce.Orders)/Scripts/blades/customerOrder-items.tpl.html' 18 | }; 19 | bladeNavigationService.showBlade(newBlade, blade); 20 | }; 21 | }]); 22 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/customerOrder-items-widget.tpl.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
{{operation.items.length | number:0}}
4 |
{{'orders.widgets.customerOrder-items.title' | translate}}
5 |
{{(operation.subTotalWithTax - operation.subTotalDiscountWithTax) | currency:operation.currency}}
6 |
7 |
8 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/customerOrder-list-widget.tpl.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
{{ordersCount | number:0}}
4 |
{{'orders.widgets.customerOrder-list.title' | translate}}
5 |
6 |
7 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/customerOrder-totals-widget.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.customerOrderTotalsWidgetController', ['$scope', 'platformWebApp.bladeNavigationService', function ($scope, bladeNavigationService) { 3 | 4 | }]); 5 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/customerOrder-totals-widget.tpl.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • {{'orders.widgets.customerOrder-totals.sub-total' | translate}} {{blade.customerOrder.subTotal | currency:blade.customerOrder.currency}}
  • 3 |
  • {{'orders.widgets.customerOrder-totals.shipping-sub-total' | translate}} {{blade.customerOrder.shippingSubTotal | currency:blade.customerOrder.currency}}
  • 4 |
  • {{'orders.widgets.customerOrder-totals.payment-sub-total' | translate}} {{blade.customerOrder.paymentSubTotal | currency:blade.customerOrder.currency}}
  • 5 |
  • {{'orders.widgets.customerOrder-totals.tax-total' | translate}} {{blade.customerOrder.taxTotal | currency:blade.customerOrder.currency}}
  • 6 |
  • {{'orders.widgets.customerOrder-totals.fee-total' | translate}} {{blade.customerOrder.feeTotal | currency:blade.customerOrder.currency}}
  • 7 |
  • {{'orders.widgets.customerOrder-totals.discount-total' | translate}} {{(blade.customerOrder.discountTotal * -1) | currency:blade.customerOrder.currency}}
  • 8 |
  • {{'orders.widgets.customerOrder-totals.total' | translate}} {{blade.customerOrder.total | currency:blade.customerOrder.currency}}
  • 9 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/dashboard/statistics-widget.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.dashboard.statisticsWidgetController', ['$scope', '$localStorage', '$state', 3 | function ($scope, $localStorage, $state) { 4 | $scope.$storage = $localStorage; 5 | 6 | $scope.openBlade = function () { 7 | $state.go('workspace.orderModule'); 8 | }; 9 | }]); 10 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/notificationsLogWidget.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.notificationsLogWidgetController', ['$scope', 'platformWebApp.bladeNavigationService', function ($scope, bladeNavigationService) { 3 | var blade = $scope.widget.blade; 4 | 5 | blade.showNotificationsLog = function () { 6 | var objectId = blade.currentEntity.id; 7 | var objectTypeId = 'CustomerOrder'; 8 | var newBlade = { 9 | id: 'notificationLogWidgetChild', 10 | objectId: objectId, 11 | objectType: objectTypeId, 12 | title: 'orders.widgets.notifications.title', 13 | subtitle: 'orders.widgets.notifications.subtitle', 14 | controller: 'virtoCommerce.notificationsModule.notificationsJournalController', 15 | template: 'Modules/$(VirtoCommerce.Notifications)/Scripts/blades/notifications-journal.tpl.html' 16 | }; 17 | bladeNavigationService.showBlade(newBlade, blade); 18 | }; 19 | }]); 20 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/notificationsLogWidget.tpl.html: -------------------------------------------------------------------------------- 1 | 
2 |
3 |
{{ 'orders.widgets.notifications.title' | translate }}
4 |
5 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/operation-comment-widget.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.operationCommentWidgetController', ['$scope', 'platformWebApp.bladeNavigationService', function ($scope, bladeNavigationService) { 3 | $scope.operation = {}; 4 | 5 | $scope.openCommentBlade = function () { 6 | var newBlade = { 7 | id: 'operationComment', 8 | title: 'orders.widgets.operation-comment.blade-title', 9 | currentEntity: $scope.operation, 10 | controller: 'virtoCommerce.orderModule.orderOperationCommentDetail', 11 | template: 'Modules/$(VirtoCommerce.Orders)/Scripts/blades/operation-comment.tpl.html' 12 | }; 13 | bladeNavigationService.showBlade(newBlade, $scope.blade); 14 | }; 15 | 16 | $scope.$watch('widget.blade.currentEntity', function (operation) { 17 | $scope.operation = operation; 18 | }); 19 | }]); 20 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/operation-comment-widget.tpl.html: -------------------------------------------------------------------------------- 1 | 
2 |
3 |
{{operation.comment}}
4 |
5 |
{{'orders.widgets.operation-comment.no-comments' | translate}}
6 |
7 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/payment-address-widget.tpl.html: -------------------------------------------------------------------------------- 1 | 
2 |
3 |
{{'platform.placeholders.n-a' | translate}}
4 |
{{'orders.widgets.payment-address.title' | translate}}
5 |
6 |
7 |
{{'orders.widgets.payment-address.title' | translate}}
8 |
{{ getAddressName(operation.billingAddress) | limitTo :40 }}
9 |
10 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/payment-totals-widget.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.paymentTotalsWidgetController', ['$scope', 'platformWebApp.bladeNavigationService', function ($scope, bladeNavigationService) { 3 | $scope.blade = $scope.widget.blade; 4 | 5 | $scope.$watch('widget.blade.currentEntity', function (payment) { 6 | if (payment) { 7 | $scope.payment = payment; 8 | } 9 | }, true); 10 | }]); 11 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/payment-totals-widget.tpl.html: -------------------------------------------------------------------------------- 1 | 
    2 |
  • {{'orders.widgets.payment-totals.payment-price' | translate}} {{payment.price | currency:payment.currency}}
  • 3 |
  • {{'orders.widgets.payment-totals.discount-total' | translate}} {{(payment.discountAmount * -1) | currency:payment.currency}}
  • 4 |
  • {{'orders.widgets.payment-totals.tax-total' | translate}} {{payment.taxTotal | currency:payment.currency}}
  • 5 |
  • {{'orders.widgets.payment-totals.total' | translate}} {{payment.totalWithTax | currency:payment.currency}}
  • 6 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/payment-transactions-widget.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.paymentTransactionsWidgetController', ['$scope', '$translate', 'platformWebApp.bladeNavigationService', function ($scope, $translate, bladeNavigationService) { 3 | var blade = $scope.widget.blade; 4 | 5 | $scope.$watch('widget.blade.currentEntity', function (operation) { 6 | $scope.operation = operation; 7 | }); 8 | 9 | $scope.openItemsBlade = function () { 10 | var newBlade = { 11 | id: 'transactions', 12 | currentEntity: $scope.operation, 13 | controller: 'virtoCommerce.orderModule.paymentTransactionsListController', 14 | template: 'Modules/$(VirtoCommerce.Orders)/Scripts/blades/payment-transactions-list.tpl.html' 15 | }; 16 | bladeNavigationService.showBlade(newBlade, blade); 17 | }; 18 | }]); 19 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/payment-transactions-widget.tpl.html: -------------------------------------------------------------------------------- 1 | 
2 |
3 |
{{operation.transactions.length | number:0}}
4 |
Transactions
5 |
6 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/shipment-address-widget.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.shipmentAddressWidgetController', ['$scope', 'platformWebApp.bladeNavigationService', function ($scope, bladeNavigationService) { 3 | $scope.operation = {}; 4 | $scope.openAddressesBlade = function () { 5 | 6 | var deliveryAddress = $scope.operation.deliveryAddress; 7 | if (!deliveryAddress) { 8 | deliveryAddress = { isNew: true }; 9 | }; 10 | var newBlade = { 11 | id: 'orderOperationAddresses', 12 | title: 'orders.widgets.shipment-address.blade-title', 13 | currentEntity: deliveryAddress, 14 | controller: 'virtoCommerce.coreModule.common.coreAddressDetailController', 15 | template: 'Modules/$(VirtoCommerce.Core)/Scripts/common/blades/address-detail.tpl.html', 16 | deleteFn : function(address) 17 | { 18 | $scope.operation.deliveryAddress = null 19 | }, 20 | confirmChangesFn : function(address) 21 | { 22 | $scope.operation.deliveryAddress = address; 23 | address.isNew = false; 24 | } 25 | }; 26 | bladeNavigationService.showBlade(newBlade, $scope.blade); 27 | }; 28 | 29 | $scope.getAddressName = function (address) { 30 | var retVal = null; 31 | if (address) { 32 | retVal = [address.countryCode, address.regionName, address.city, address.line1].join(","); 33 | } 34 | return retVal; 35 | }; 36 | 37 | $scope.$watch('widget.blade.currentEntity', function (operation) { 38 | $scope.operation = operation; 39 | }); 40 | }]); 41 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/shipment-address-widget.tpl.html: -------------------------------------------------------------------------------- 1 | 
2 |
3 |
{{'platform.placeholders.n-a' | translate}}
4 |
{{'orders.widgets.shipment-address.title' | translate}}
5 |
6 |
7 |
{{'orders.widgets.shipment-address.title' | translate}}
8 |
{{ getAddressName(operation.deliveryAddress) | limitTo :40 }}
9 |
10 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/shipment-items-widget.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.shipmentItemsWidgetController', ['$scope', '$translate', 'platformWebApp.bladeNavigationService', function ($scope, $translate, bladeNavigationService) { 3 | var blade = $scope.widget.blade; 4 | 5 | $scope.$watch('widget.blade.currentEntity', function (operation) { 6 | $scope.operation = operation; 7 | }); 8 | 9 | $scope.openItemsBlade = function () { 10 | $translate('orders.blades.shipment-detail.title', { number: $scope.operation.number }).then(function (result) { 11 | var newBlade = { 12 | id: 'shipmentItems', 13 | title: 'orders.blades.shipment-items.title', 14 | titleValues: { title: result }, 15 | subtitle: 'orders.blades.shipment-items.subtitle', 16 | currentEntity: blade.currentEntity, 17 | controller: 'virtoCommerce.orderModule.shipmentItemsController', 18 | template: 'Modules/$(VirtoCommerce.Orders)/Scripts/blades/shipment-items.tpl.html' 19 | }; 20 | bladeNavigationService.showBlade(newBlade, blade); 21 | }); 22 | }; 23 | }]); 24 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/shipment-items-widget.tpl.html: -------------------------------------------------------------------------------- 1 | 
2 |
3 |
{{operation.items.length | number:0}}
4 |
{{ 'orders.widgets.shipment-items.title' | translate }}
5 |
6 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/shipment-totals-widget.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.shipmentTotalsWidgetController', ['$scope', 'platformWebApp.bladeNavigationService', function ($scope, bladeNavigationService) { 3 | $scope.blade = $scope.widget.blade; 4 | 5 | $scope.$watch('widget.blade.currentEntity', function (shipment) { 6 | if (shipment) { 7 | $scope.shipment = shipment; 8 | } 9 | }, true); 10 | }]); 11 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/widgets/shipment-totals-widget.tpl.html: -------------------------------------------------------------------------------- 1 | 
    2 |
  • {{'orders.widgets.shipment-totals.shipment-price' | translate}} {{shipment.price | currency:shipment.currency}}
  • 3 |
  • {{'orders.widgets.shipment-totals.discount-total' | translate}} {{(shipment.discountAmount * -1) | currency:shipment.currency}}
  • 4 |
  • {{'orders.widgets.shipment-totals.tax-total' | translate}} {{shipment.taxTotal | currency:shipment.currency}}
  • 5 |
  • {{'orders.widgets.shipment-totals.total' | translate}} {{shipment.totalWithTax | currency:shipment.currency}}
  • 6 |
-------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/wizards/newOperation/newOperation-wizard.js: -------------------------------------------------------------------------------- 1 | angular.module('virtoCommerce.orderModule') 2 | .controller('virtoCommerce.orderModule.newOperationWizardController', ['$scope', 'platformWebApp.bladeNavigationService', 'virtoCommerce.orderModule.knownOperations', function ($scope, bladeNavigationService, knownOperations) { 3 | var blade = $scope.blade; 4 | 5 | $scope.availableOperations = _.map(blade.availableTypes, function (type) { 6 | return knownOperations.getOperation(type); 7 | }); 8 | 9 | $scope.openDetailsBlade = function (op) { 10 | var newBlade = angular.copy(op.detailBlade); 11 | newBlade.customerOrder = blade.customerOrder; 12 | newBlade.isNew = true; 13 | 14 | bladeNavigationService.showBlade(newBlade, blade.parentBlade); 15 | }; 16 | 17 | blade.isLoading = false; 18 | }]); 19 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Scripts/wizards/newOperation/newOperation-wizard.tpl.html: -------------------------------------------------------------------------------- 1 | 
2 |
3 |
4 |
    5 |
  • 6 | 7 | {{operation.type | translate}} 8 | {{operation.description | translate}} 9 |
  • 10 |
11 |
12 |
13 |
14 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/Validation/PaymentInValidator.cs: -------------------------------------------------------------------------------- 1 | using FluentValidation; 2 | using VirtoCommerce.OrdersModule.Core.Model; 3 | 4 | namespace VirtoCommerce.OrdersModule.Web.Validation 5 | { 6 | public class PaymentInValidator : AbstractValidator 7 | { 8 | public PaymentInValidator() 9 | { 10 | SetDefaultRules(); 11 | } 12 | 13 | protected void SetDefaultRules() 14 | { 15 | RuleFor(payment => payment.OrganizationId).MaximumLength(64); 16 | RuleFor(payment => payment.OrganizationName).MaximumLength(255); 17 | RuleFor(payment => payment.CustomerId).NotNull().NotEmpty().MaximumLength(64); 18 | RuleFor(payment => payment.CustomerName).MaximumLength(255); 19 | RuleFor(payment => payment.Purpose).MaximumLength(1024); 20 | RuleFor(payment => payment.GatewayCode).MaximumLength(64); 21 | RuleFor(payment => payment.TaxType).MaximumLength(64); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/VirtoCommerce.OrdersModule.Web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.0", 3 | "name": "vc-module", 4 | "private": true, 5 | "scripts": { 6 | "webpack:dev": "webpack --mode=development", 7 | "webpack:watch": "webpack --watch --mode=development", 8 | "webpack:build": "webpack --mode=production" 9 | }, 10 | "devDependencies": { 11 | "clean-webpack-plugin": "^4.0.0", 12 | "css-loader": "^6.5.1", 13 | "mini-css-extract-plugin": "^2.5.1", 14 | "webpack": "^5.68.0", 15 | "webpack-cli": "^4.10.0" 16 | }, 17 | "webpack": { 18 | "stats": "verbose" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/VirtoCommerce.OrdersModule.Tests/MigrationScenarios.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace VirtoCommerce.OrdersModule.Tests 4 | { 5 | public class MigrationScenarios //: MigrationsTestBase 6 | { 7 | [Fact] 8 | [Trait("Category", "CI")] 9 | public void Can_create_order_new_database() 10 | { 11 | //DropDatabase(); 12 | 13 | //var migrator = CreateMigrator(); 14 | 15 | //using (var context = CreateContext()) 16 | //{ 17 | // context.Database.CreateIfNotExists(); 18 | // new SetupDatabaseInitializer().InitializeDatabase(context); 19 | // Assert.Equal(0, context.CustomerOrders.Count()); 20 | //} 21 | 22 | //// remove all migrations 23 | //migrator.Update("0"); 24 | //Assert.False(TableExists("OrderLineItem")); 25 | //var existTables = Info.Tables.Any(); 26 | //Assert.False(existTables); 27 | 28 | //DropDatabase(); 29 | } 30 | } 31 | } 32 | --------------------------------------------------------------------------------