1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-20 11:04:31 -05:00

get key from Request.Query

This commit is contained in:
Kyle Spearrin 2019-02-22 22:59:31 -05:00
parent 78fa990b1f
commit 246fcda1f7

View File

@ -160,14 +160,16 @@ namespace Bit.Billing.Controllers
} }
[HttpPost("ipn")] [HttpPost("ipn")]
public async Task<IActionResult> PostIpn([FromQuery] string key) public async Task<IActionResult> PostIpn()
{ {
if(key != _billingSettings.PayPal.WebhookKey) if(HttpContext?.Request?.Query == null)
{ {
return new BadRequestResult(); return new BadRequestResult();
} }
if(HttpContext?.Request == null) var key = HttpContext.Request.Query.ContainsKey("key") ?
HttpContext.Request.Query["key"].ToString() : null;
if(key != _billingSettings.PayPal.WebhookKey)
{ {
return new BadRequestResult(); return new BadRequestResult();
} }
@ -327,7 +329,7 @@ namespace Bit.Billing.Controllers
await _transactionRepository.ReplaceAsync(parentTransaction); await _transactionRepository.ReplaceAsync(parentTransaction);
await _transactionRepository.CreateAsync(new Transaction await _transactionRepository.CreateAsync(new Transaction
{ {
Amount = ipnTransaction.McGross, Amount = refundAmount,
CreationDate = ipnTransaction.PaymentDate, CreationDate = ipnTransaction.PaymentDate,
OrganizationId = ids.Item1, OrganizationId = ids.Item1,
UserId = ids.Item2, UserId = ids.Item2,