74 lines
3.0 KiB
C#
74 lines
3.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using Newtonsoft.Json;
|
|
using Sockeye.Biz;
|
|
|
|
namespace Sockeye.Models
|
|
{
|
|
public class Purchase : ICoreBizObjectModel
|
|
{
|
|
public long Id { get; set; }
|
|
public uint Concurrency { get; set; }
|
|
public long? CustomerId { get; set; }
|
|
public long? LicenseId { get; set; }//when null and also when pgroup is a licenseable type means it shoudl be processed by SockBotProcessPurchases license gen
|
|
[NotMapped]
|
|
public string CustomerViz { get; set; }
|
|
[Required]
|
|
public long VendorId { get; set; }
|
|
[NotMapped]
|
|
public string VendorViz { get; set; }
|
|
public long? ProductId { get; set; }//When null means it's new and should be processed by SockbotProcessPurchases job into proper purchase record
|
|
[Required]
|
|
public ProductGroup PGroup { get; set; }
|
|
[NotMapped]
|
|
public string ProductViz { get; set; }
|
|
public string SalesOrderNumber { get; set; }
|
|
|
|
/*
|
|
"accounting": {
|
|
"currency": "USD",
|
|
"product_net": 577.5,
|
|
"discount": 0.0,
|
|
"product_vat": 75.08,
|
|
"shipping": 0.0,
|
|
"shipping_vat": 0.0,
|
|
"eu_vat": -75.08,
|
|
"margin_net": -29.05,
|
|
"your_revenue": 548.45
|
|
*/
|
|
public string Currency { get; set; }//All values sb US dollars, but just in case
|
|
public decimal ProductNet { get; set; } = 0;//total billed for the product before taxes
|
|
public decimal Discount { get; set; } = 0;
|
|
public decimal VendorFee { get; set; } = 0;//margin_net charged by myCommerce; their fee for processing the order
|
|
public decimal Revenue { get; set; } = 0;//amount we are paid for the order (product net - discount - vendorfee)
|
|
|
|
|
|
|
|
[Required]
|
|
public DateTime PurchaseDate { get; set; }
|
|
public DateTime? ExpireDate { get; set; }
|
|
public DateTime? CancelDate { get; set; }
|
|
public string CouponCode { get; set; }
|
|
public string Notes { get; set; }
|
|
public bool RenewNoticeSent { get; set; } = false;
|
|
public int Quantity { get; set; } = 1;
|
|
public string VendorData { get; set; }
|
|
public bool Processed { get; set; } = false;//indicates it was fully processed and need not be processed by purchase or license generating jobs (all imported data set to processed)
|
|
public string Wiki { get; set; }
|
|
public List<string> Tags { get; set; }
|
|
//workaround for notification
|
|
[NotMapped, JsonIgnore]
|
|
public string Name { get; set; }
|
|
|
|
public Purchase()
|
|
{
|
|
Tags = new List<string>();
|
|
}
|
|
|
|
[NotMapped, JsonIgnore]
|
|
public SockType SType { get => SockType.Purchase; }
|
|
}//eoc
|
|
}//eons
|