Skip to content

Instantly share code, notes, and snippets.

@pierregorce
Last active December 20, 2017 13:18
Show Gist options
  • Save pierregorce/b43ee8431430c506609fd43ed0b59f26 to your computer and use it in GitHub Desktop.
Save pierregorce/b43ee8431430c506609fd43ed0b59f26 to your computer and use it in GitHub Desktop.
Enovalp - IExternalHandlerAppService
using Nova.Application.Services.Base;
using Nova.Application.Services.External.Dto;
namespace Nova.Application.Services.External
{
/// <summary>
/// Website REST API
/// </summary>
public interface IExternalHandlerAppService : IApplicationService
{
BaseApplicationOutput<ExternalDocument> PostDocument(ExternalDocument postDocumentInput);
BaseApplicationOutput<ExternalUser> PostUser(ExternalUser postUserInput);
BaseApplicationOutput ProcessPayment(ProcessPaymentInput processPaymentInput);
BaseApplicationOutput<ExternalMarket> PostMarket(ExternalMarket postMarketInput);
ExternalUser GetUser(string webId);
ExternalDocument GetDocument(string webId);
}
}
using Nova.Application.Services.Base;
using Nova.Application.Services.External.Dto;
namespace Nova.Application.Services.External
{
/// <summary>
/// Api de gestion, get uniquement pour vérification
/// implémentée en REST par CDI.
/// implémentée en consoleApp pour ADL. / Get pas possible.
/// </summary>
public interface IExternalNovaAppService : IApplicationService
{
BaseApplicationOutput<ExternalDocument> PostDocument(ExternalDocument postDocumentInput);
BaseApplicationOutput<ExternalUser> PostUser(ExternalUser postUserInput);
ExternalUser GetUser(string externalId);
ExternalDocument GetDocument(string externalId);
ExternalMarket GetMarket(string externalId);
}
}
using Nova.Application.Services.Base;
using Nova.Core.Entities.Documents;
using Nova.Core.Entities.Payments;
using System.Collections.Generic;
namespace Nova.Application.Services.External.Dto
{
public class ExternalDocument : EntityDto
{
public string WebId { get; set; }
public string ExternalId { get; set; }
public ExternalUser ExternalUser { get; set; }
public string DiscountCouponCodeApplied { get; set; }
public bool IsGift { get; set; }
public string GiftComment { get; set; }
public string DocumentComment { get; set; }
public DocumentType DocumentType { get; set; }
public ICollection<ExternalDocumentRelated> ExternalDocumentRelateds = new List<ExternalDocumentRelated>();
// ---
public DocumentStatus Status { get; set; }
public ExternalAddress BillingAddress { get; set; }
public ExternalAddress ShippingAddress { get; set; }
public string ShippingMethodName { get; set; }
public string PaymentMethodName { get; set; }
public PaymentStatus PaymentStatus { get; set; }
public ICollection<ExternalDocumentItem> ExternalDocumentItems { get; set; } = new List<ExternalDocumentItem>();
public bool IsDeleted { get; set; }
//--- Amounts
public bool HasTax { get; set; }
public decimal? SubTotalDiscountPercent { get; set; }
public decimal? SubTotalDiscountAmount { get; set; }
public decimal? ShippingDiscountPercent { get; set; }
public decimal? ShippingDiscountAmount { get; set; }
public decimal ShippingPriceWithTax { get; set; }
public decimal ShippingPriceNoTax { get; set; }
public decimal ShippingPriceWithTaxIncludeDiscount { get; set; }
public decimal ShippingPriceNoTaxIncludeDiscount { get; set; }
}
}
using Nova.Core.Entities.Documents;
using System.Collections.Generic;
namespace Nova.Application.Services.External.Dto
{
public class ExternalDocumentItem
{
public string WebId { get; set; }
public string ExternalId { get; set; }
public ICollection<DocumentItemRelated> DocumentRelateds = new List<DocumentItemRelated>();
public string ProductExternalId { get; set; }
public string Ean { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string Availability { get; set; }
public string DocumentItemComment { get; set; }
public DocumentItemStatus DocumentItemStatus { get; set; }
public int Quantity { get; set; }
public int? DisplayOrder { get; set; }
// --- Amount Unit
public decimal UnitPriceWithTax { get; set; }
public decimal[] UnitPriceNoTax { get; set; }
public decimal[] UnitPriceTaxRates { get; set; }
public bool HasTax { get; set; }
public decimal[] UnitPriceTaxAmount { get; set; }
public decimal? DiscountPercent { get; set; }
public decimal? DiscountAmount { get; set; }
// + dispo fournisseur
}
}
using Nova.Application.Services.Base;
using Nova.Application.Services.External.Dto;
namespace Nova.Application.Services.External
{
/// <summary>
/// Website REST API
/// </summary>
public interface IExternalHandlerAppService : IApplicationService
{
BaseApplicationOutput<ExternalDocument> PostDocument(ExternalDocument postDocumentInput);
BaseApplicationOutput<ExternalUser> PostUser(ExternalUser postUserInput);
BaseApplicationOutput ProcessPayment(ProcessPaymentInput processPaymentInput);
BaseApplicationOutput<ExternalMarket> PostMarket(ExternalMarket postMarketInput);
ExternalUser GetUser(string webId);
ExternalDocument GetDocument(string webId);
}
}
using System.Collections.Generic;
using Nova.Application.Services.Base;
namespace Nova.Application.Services.External.Dto
{
public class ProcessPaymentInput : EntityDto
{
public string ExternalDocumentId { get; set; }
public string WebDocumentId { get; set; }
public IList<ProcessPaymentInputItem> ProcessPaymentInputItems { get; set; } = new List<ProcessPaymentInputItem>();
}
public class ProcessPaymentInputItem : EntityDto
{
public string ExternalProductId { get; set; }
public int Quantity { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment