mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
[AC-1800] PayPal IPN Refactor (#3619)
* Add more logging to PayPal IPN webhook * Add PayPalIPNClient tests * Add PayPalControllerTests --------- Co-authored-by: aelinton <95626935+aelinton@users.noreply.github.com>
This commit is contained in:
37
test/Billing.Test/Utilities/PayPalTestIPN.cs
Normal file
37
test/Billing.Test/Utilities/PayPalTestIPN.cs
Normal file
@ -0,0 +1,37 @@
|
||||
namespace Bit.Billing.Test.Utilities;
|
||||
|
||||
public enum IPNBody
|
||||
{
|
||||
SuccessfulPayment,
|
||||
ECheckPayment,
|
||||
TransactionMissingEntityIds,
|
||||
NonUSDPayment,
|
||||
SuccessfulPaymentForOrganizationCredit,
|
||||
UnsupportedTransactionType,
|
||||
SuccessfulRefund,
|
||||
RefundMissingParentTransaction,
|
||||
SuccessfulPaymentForUserCredit
|
||||
}
|
||||
|
||||
public static class PayPalTestIPN
|
||||
{
|
||||
public static async Task<string> GetAsync(IPNBody ipnBody)
|
||||
{
|
||||
var fileName = ipnBody switch
|
||||
{
|
||||
IPNBody.ECheckPayment => "echeck-payment.txt",
|
||||
IPNBody.NonUSDPayment => "non-usd-payment.txt",
|
||||
IPNBody.RefundMissingParentTransaction => "refund-missing-parent-transaction.txt",
|
||||
IPNBody.SuccessfulPayment => "successful-payment.txt",
|
||||
IPNBody.SuccessfulPaymentForOrganizationCredit => "successful-payment-org-credit.txt",
|
||||
IPNBody.SuccessfulRefund => "successful-refund.txt",
|
||||
IPNBody.SuccessfulPaymentForUserCredit => "successful-payment-user-credit.txt",
|
||||
IPNBody.TransactionMissingEntityIds => "transaction-missing-entity-ids.txt",
|
||||
IPNBody.UnsupportedTransactionType => "unsupported-transaction-type.txt"
|
||||
};
|
||||
|
||||
var content = await EmbeddedResourceReader.ReadAsync("IPN", fileName);
|
||||
|
||||
return content.Replace("\n", string.Empty);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user