与第三方支付提供商集成的设计架构

问题描述 投票:0回答:1

我的团队正在尝试设计一个事件驱动的微服务架构,允许最终用户从我们的网站选择订阅类型(例如:专业版、企业版)并为此购买最多 5 个许可证 订阅。付款和结账管理将由第三方提供商处理。它可以通过 webhook 发送 API 事件。该系统需要与我们现有的后端系统集成。可扩展性和安全性具有高优先级。

这就是我们现有的公司和用户模型的样子

public class Company
{
    public string? CompanyId { get; set; }
    public string ContactPersonName { get; set; }
    public string? Email { get; set; }
    public DateTime LicenseExpirationDate { get; set; }
    public string? SelectedPackage { get; set; }
    public int? NumberOfLicenses { get; set; }
}

public class User
{
    public string? UserId { get; set; }
    public string? UserName { get; set; }
    public string? Email { get; set; }
    public string? DeviceIdentifier { get; set; } // unique PK
    public string CompanyId { get; set; }
}

我们还想将许可证保存到 Azure blob 存储。每当许可证即将到期时,系统应通知客户。

我们的计划是添加 Azure API 管理以及 Azure 负载均衡器,以提高可扩展性和安全性(尽管我不确定这是否是最佳实践)。

我需要为这些系统创建什么样的服务(例如:SubscriptionService、PaymentService、UserService、LicenseService),还是将每个服务设计为 Azure 功能更好?

这些服务相互通信的最佳方法或设计实践是什么?(例如:Azure 事件网格或 Azure 服务总线)

如何让系统更加安全、可扩展?

azure architecture azure-functions azure-servicebus-queues system-design
1个回答
0
投票

Azure Functions 是一个有效的选择,并且通过对大多数 Azure 服务的绑定支持,可以大大简化您的开发。但如果您愿意,您始终可以使用自己的框架/语言,并使用 Azure Container Apps 部署每个服务。

绝对建议使用 Azure API 管理来隐藏您的微服务并实现常见的 API 要求,例如身份验证、缓存、速率限制等。

对于服务之间的通信,Azure 服务总线可能是最合适的,但Azure 事件中心也是一个选项,特别是当您需要快速接受来自最终用户的事件(数百万)时。

所有这些 Azure 服务都支持扩展,并且根据您的场景,您必须选择正确的层。

为了安全起见,请确保所有服务在 VNET 内都受到保护,并且通信主要通过 APIM 进行。此外,在可能的情况下,利用托管身份完全消除对安全字符串的处理。

© www.soinside.com 2019 - 2024. All rights reserved.