-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3aff731
commit 1fc7721
Showing
6 changed files
with
76 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
Marqeta.Core.Sdk.Tests/MarqetaClientTests/TransactionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using AutoFixture; | ||
using Marqeta.Core.Sdk.Models; | ||
using Marqeta.Core.Sdk.Tests.MarqetaClientTests.Factories; | ||
using Marqeta.Core.Sdk.Tests.MarqetaClientTests.Helpers; | ||
using Marqeta.Core.Sdk.Transactions.Authorizationreversal; | ||
using Xunit; | ||
|
||
namespace Marqeta.Core.Sdk.Tests.MarqetaClientTests | ||
{ | ||
public class TransactionTests : BaseTests | ||
{ | ||
[Fact] | ||
public async void Ensure_velocity_control_lifetime_is_honoured() | ||
{ | ||
// Get client / fixture | ||
var client = TestMarqetaClientFactory.Create(); | ||
var fixture = new Fixture(); | ||
|
||
// NB: Responses from other test classes have already had assertions run against them | ||
// | ||
// Get card product | ||
var cardProductResponse = await CardProductHelper.CreateCardProduct(); | ||
|
||
// Create a program funding source | ||
var programFundingSourceResponse = await ProgramFundingHelper.CreateProgramFundingSource(); | ||
|
||
// Create user account | ||
var cardHolderResponse = await UserHelper.CreateUser(); | ||
|
||
// Create / activate card | ||
var cardResponse = await CardTests.CreateCard(cardHolderResponse.Token, cardProductResponse.Token); | ||
|
||
// Fund user account | ||
const double fundingAmount = 1000; | ||
await GpaOrderHelper.FundUserAccount(cardHolderResponse.Token, programFundingSourceResponse.Token, fundingAmount); | ||
|
||
// Transaction that will be pending and reversed | ||
var authRequest1 = new Auth_request_model | ||
{ | ||
Amount = 1500, | ||
Mid = fixture.Create<string>(), | ||
CardToken = cardResponse.Token, | ||
}; | ||
var simulateResponse1 = await client.Simulate.Authorization.PostAsync(authRequest1); | ||
Assert.NotNull(simulateResponse1); | ||
Assert.Equal(Transaction_model_state.PENDING, simulateResponse1.Transaction.State); | ||
|
||
// Attempt reversal | ||
var reversalRequest = new AuthorizationreversalPostRequestBody | ||
{ | ||
OriginalTransactionToken = simulateResponse1.Transaction.Token | ||
}; | ||
|
||
var updatedResponse = await client.Transactions.Authorizationreversal.PostAsync(reversalRequest); | ||
|
||
Assert.NotNull(updatedResponse); | ||
Assert.Equal(Transaction_model_state.COMPLETION, updatedResponse.State); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 0 additions & 62 deletions
62
...Authorizationreversal/AuthorizationreversalPostRequestBody_reverse_authorization_model.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters