1
0
mirror of https://github.com/bitwarden/server synced 2025-12-31 07:33:43 +00:00

handle transactions on paypal webhook

This commit is contained in:
Kyle Spearrin
2019-02-01 22:22:08 -05:00
parent f3b5068aba
commit 44630e9728
11 changed files with 211 additions and 8 deletions

View File

@@ -2,6 +2,7 @@
using Bit.Core.Models.Table;
using System.Collections.Generic;
using System.Threading.Tasks;
using Bit.Core.Enums;
namespace Bit.Core.Repositories
{
@@ -9,5 +10,6 @@ namespace Bit.Core.Repositories
{
Task<ICollection<Transaction>> GetManyByUserIdAsync(Guid userId);
Task<ICollection<Transaction>> GetManyByOrganizationIdAsync(Guid organizationId);
Task<Transaction> GetByGatewayIdAsync(GatewayType gatewayType, string gatewayId);
}
}

View File

@@ -6,6 +6,7 @@ using Dapper;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using Bit.Core.Enums;
namespace Bit.Core.Repositories.SqlServer
{
@@ -44,5 +45,18 @@ namespace Bit.Core.Repositories.SqlServer
return results.ToList();
}
}
public async Task<Transaction> GetByGatewayIdAsync(GatewayType gatewayType, string gatewayId)
{
using(var connection = new SqlConnection(ConnectionString))
{
var results = await connection.QueryAsync<Transaction>(
$"[{Schema}].[Transaction_ReadByGatewayId]",
new { Gateway = gatewayType, GatewayId = gatewayId },
commandType: CommandType.StoredProcedure);
return results.SingleOrDefault();
}
}
}
}