Skip to content

Commit

Permalink
fix: up to .net8 version in allinone
Browse files Browse the repository at this point in the history
  • Loading branch information
tingwei628 committed Jan 8, 2025
1 parent 758ce78 commit 9b5216a
Show file tree
Hide file tree
Showing 51 changed files with 2,924 additions and 0 deletions.
408 changes: 408 additions & 0 deletions .gitignore

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions Unofficial_ECPayAIO_Net/ECPay.Payment.Integration/ActionType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace ECPay.Payment.Integration
{
public enum ActionType
{
C,
R,
E,
N
}
}
887 changes: 887 additions & 0 deletions Unofficial_ECPayAIO_Net/ECPay.Payment.Integration/AllInOne.cs

Large diffs are not rendered by default.

490 changes: 490 additions & 0 deletions Unofficial_ECPayAIO_Net/ECPay.Payment.Integration/AllInOneMetadata.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace ECPay.Payment.Integration
{
public enum AllocateState
{
ALL = 9,
NoAppropriations = 0,
Appropriations = 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;

namespace ECPay.Payment.Integration.Attributes
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public class TextAttribute : Attribute
{
public string? Name { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ECPay.Payment.Integration
{
public enum BindingCardType
{
Yes = 1,
No = 0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace ECPay.Payment.Integration
{
public enum CharSetState : byte
{
Default,
Big5,
UTF8
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
using System;
using System.ComponentModel.DataAnnotations;

namespace ECPay.Payment.Integration
{
public abstract class CommonMetadata
{
public abstract class BaseQueryArguments
{
[Required(ErrorMessage = "{0} is required.")]
[StringLength(20, ErrorMessage = "{0} max langth as {1}.")]
public string? MerchantTradeNo { get; set; }

[Required(ErrorMessage = "{0} is required.")]
public int TimeStamp { get; private set; }

public BaseQueryArguments()
{
TimeStamp = Convert.ToInt32((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000L) / 10000000);
}
}

public abstract class BaseSendArguments
{
internal string _ItemName = string.Empty;

internal string _ItemURL = string.Empty;

[Required(ErrorMessage = "{0} is required.")]
[StringLength(20, ErrorMessage = "{0} max langth as {1}.")]
public string? MerchantTradeNo { get; set; }

[Required(ErrorMessage = "{0} is required.")]
public string? MerchantTradeDate { get; set; }

[Required(ErrorMessage = "{0} is required.")]
[StringLength(20, ErrorMessage = "{0} max langth as {1}.")]
public string? PaymentType { get; protected set; }

[Required(ErrorMessage = "{0} is required.")]
public decimal TotalAmount { get; set; }

[StringLength(200, ErrorMessage = "{0} max langth as {1}.")]
[Required(ErrorMessage = "{0} is required.")]
public string? TradeDesc { get; set; }

public string? ItemName => _ItemName;

[Required(ErrorMessage = "{0} is required.")]
public ItemCollection Items { get; set; } = new ItemCollection();

[RegularExpression("^(?:http|https|ftp)://[a-zA-Z0-9\\.\\-]+(?:\\:\\d{1,5})?(?:[A-Za-z0-9\\.\\;\\:\\@\\&\\=\\+\\-\\$\\,\\?/_]|%u[0-9A-Fa-f]{4}|%[0-9A-Fa-f]{2})*$", ErrorMessage = "{0} is not correct URL.")]
[StringLength(200, ErrorMessage = "{0} max langth as {1}.")]
public string? ItemURL { get; set; }

[StringLength(100, ErrorMessage = "{0} max langth as {1}.")]
public string? Remark { get; set; }

[Required(ErrorMessage = "{0} is required.")]
[RegularExpression("^(?:http|https|ftp)://[a-zA-Z0-9\\.\\-]+(?:\\:\\d{1,5})?(?:[A-Za-z0-9\\.\\;\\:\\@\\&\\=\\+\\-\\$\\,\\?/_]|%u[0-9A-Fa-f]{4}|%[0-9A-Fa-f]{2})*$", ErrorMessage = "{0} is not correct URL.")]
[StringLength(200, ErrorMessage = "{0} max langth as {1}.")]
public string? ReturnURL { get; set; }

[RegularExpression("^(?:http|https|ftp)://[a-zA-Z0-9\\.\\-]+(?:\\:\\d{1,5})?(?:[A-Za-z0-9\\.\\;\\:\\@\\&\\=\\+\\-\\$\\,\\?/_]|%u[0-9A-Fa-f]{4}|%[0-9A-Fa-f]{2})*$", ErrorMessage = "{0} is not correct URL.")]
[StringLength(200, ErrorMessage = "{0} max langth as {1}.")]
public string? ClientBackURL { get; set; }

public BaseSendArguments()
{
Items = new ItemCollection();
}
}

[StringLength(200, ErrorMessage = "{0} max langth as {1}.")]
[Required(ErrorMessage = "{0} is required.")]
[RegularExpression("^(?:http|https|ftp)://[a-zA-Z0-9\\.\\-]+(?:\\:\\d{1,5})?(?:[A-Za-z0-9\\.\\;\\:\\@\\&\\=\\+\\-\\$\\,\\?/_]|%u[0-9A-Fa-f]{4}|%[0-9A-Fa-f]{2})*$", ErrorMessage = "{0} is not correct URL.")]
public string? ServiceURL { get; set; }

[Required(ErrorMessage = "{0} is required.")]
public HttpMethod ServiceMethod { get; set; }

[Required(ErrorMessage = "{0} is required.")]
public string? HashKey { get; set; }

[Required(ErrorMessage = "{0} is required.")]
public string? HashIV { get; set; }

[Required(ErrorMessage = "{0} is required.")]
[StringLength(10, ErrorMessage = "{0} max langth as {1}.")]
public string? MerchantID { get; set; }

public CommonMetadata()
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;

namespace ECPay.Payment.Integration
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = true)]
public class CompareByPaymentMethodAttribute : RequiredAttribute
{
public PaymentMethod PaymentMethod { get; set; }

public string ConfirmPropertyNames { get; set; }

public CompareByPaymentMethodAttribute(PaymentMethod paymentMethod, string confirmPropertyNames)
{
PaymentMethod = paymentMethod;
ConfirmPropertyNames = confirmPropertyNames ?? throw new ArgumentNullException("confirmPropertyNames is null.");
}

public override bool IsValid(object? value)
{
object[]? array = value as object[];
_ = array?[0];
object? obj2 = array?[1];
object? component = array?[2];
_ = array?[3];
string[] array2 = ConfirmPropertyNames.Split('/');
PropertyDescriptorCollection propertyDescriptorCollection = TypeDescriptor.GetProperties(component);
var value2 = propertyDescriptorCollection.Find("_PaymentMethod", ignoreCase: true).GetValue(component);
if (PaymentMethod.Equals(value2) && IsValid(obj2) && !PeriodType.None.Equals(obj2))
{
string[] array3 = array2;
foreach (string name in array3)
{
var value3 = propertyDescriptorCollection.Find(name, ignoreCase: true).GetValue(component);
if (!PeriodType.None.Equals(value3) && null != value3)
{
return false;
}
}
}
return true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace ECPay.Payment.Integration
{
public enum CustomsClearance
{
None,
CustomsExport,
ECACustomsExport
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace ECPay.Payment.Integration
{
public enum DeviceType
{
PC,
Mobile,
None
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace ECPay.Payment.Integration
{
public enum DonatedInvoice
{
None,
Yes,
No
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<PackageId>Unofficial_ECPayAIO_Net</PackageId>
<Version>1.0.0</Version>
<Authors>tingwei628</Authors>
<Description>Unofficial_ECPayAIO_Net</Description>
<PackageLicenseExpression>GPLv2</PackageLicenseExpression>
<RepositoryUrl>https://github.com/0xc0dec0ffeelab/Unofficial_ECPayAIO_Net</RepositoryUrl>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.1.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.ComponentModel.DataAnnotations;

namespace ECPay.Payment.Integration
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = true)]
public class EqualsByPaymentMethodAttribute : ValidationAttribute
{
public override bool IsValid(object? value)
{
object[]? array = value as object[];
_ = array?[0];
object? obj2 = array?[1];
_ = array?[2];
_ = array?[3];
string? text = obj2?.ToString();
if (!string.IsNullOrEmpty(text))
{
string[] array2 = text.Split('#');
string[] array3 = array2;
foreach (string value2 in array3)
{
try
{
if ((PaymentMethod)Enum.Parse(typeof(PaymentMethod), value2) == PaymentMethod.ALL)
{
return false;
}
}
catch
{
return false;
}
}
}
return true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ECPay.Payment.Integration
{
public enum ExtraPaymentInfo
{
Yes = 1,
No = 0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Text;

namespace ECPay.Payment.Integration.Helpers
{
public class CharSetHelper
{
public static Encoding GetCharSet(CharSetState CharSet)
{
return CharSet switch
{
CharSetState.Big5 => Encoding.GetEncoding("Big5"),
CharSetState.UTF8 => Encoding.UTF8,
_ => Encoding.Default,
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ECPay.Payment.Integration
{
public enum HoldTradeType
{
Yes = 1,
No = 0
}
}
10 changes: 10 additions & 0 deletions Unofficial_ECPayAIO_Net/ECPay.Payment.Integration/HttpMethod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace ECPay.Payment.Integration
{
public enum HttpMethod
{
HttpGET,
HttpPOST,
ServerPOST
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ECPay.Payment.Integration
{
public enum InvoiceState
{
Yes = 1,
No = 0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace ECPay.Payment.Integration
{
public enum InvoiceVehicleType
{
None,
Member,
NaturalPersonEvidence,
PhoneBarcode
}
}
26 changes: 26 additions & 0 deletions Unofficial_ECPayAIO_Net/ECPay.Payment.Integration/Item.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace ECPay.Payment.Integration
{
public class Item
{
public string? Name { get; set; }

public decimal Price { get; set; }

public string? Currency { get; set; }

public int Quantity { get; set; }

[RequiredByInvoiceMark(ErrorMessage = "{0} is required.")]
public string? Unit { get; set; }

[RequiredByInvoiceMark(ErrorMessage = "{0} is required.")]
public TaxationType TaxType { get; set; }

public string? URL { get; set; }

public Item()
{
TaxType = TaxationType.None;
}
}
}
Loading

0 comments on commit 9b5216a

Please sign in to comment.