forked from btcpayserver/btcpayserver
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
84 changed files
with
2,343 additions
and
682 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
|
||
namespace BTCPayServer.Data; | ||
|
||
public class PendingTransaction: IHasBlob<PendingTransactionBlob> | ||
{ | ||
public string TransactionId { get; set; } | ||
public string CryptoCode { get; set; } | ||
public string StoreId { get; set; } | ||
public StoreData Store { get; set; } | ||
public DateTimeOffset? Expiry { get; set; } | ||
public PendingTransactionState State { get; set; } | ||
public string[] OutpointsUsed { get; set; } | ||
|
||
[NotMapped][Obsolete("Use Blob2 instead")] | ||
public byte[] Blob { get; set; } | ||
|
||
public string Blob2 { get; set; } | ||
|
||
|
||
internal static void OnModelCreating(ModelBuilder builder, DatabaseFacade databaseFacade) | ||
{ | ||
builder.Entity<PendingTransaction>() | ||
.HasOne(o => o.Store) | ||
.WithMany(i => i.PendingTransactions) | ||
.HasForeignKey(i => i.StoreId) | ||
.OnDelete(DeleteBehavior.Cascade); | ||
|
||
builder.Entity<PendingTransaction>().HasKey(transaction => new {transaction.CryptoCode, transaction.TransactionId}); | ||
|
||
builder.Entity<PendingTransaction>() | ||
.Property(o => o.Blob2) | ||
.HasColumnType("JSONB"); | ||
builder.Entity<PendingTransaction>() | ||
.Property(o => o.OutpointsUsed) | ||
.HasColumnType("text[]"); | ||
} | ||
} | ||
public enum PendingTransactionState | ||
{ | ||
Pending, | ||
Cancelled, | ||
Expired, | ||
Invalidated, | ||
Signed, | ||
Broadcast | ||
} | ||
|
||
public class PendingTransactionBlob | ||
{ | ||
public string PSBT { get; set; } | ||
public List<CollectedSignature> CollectedSignatures { get; set; } = new(); | ||
} | ||
|
||
public class CollectedSignature | ||
{ | ||
public DateTimeOffset Timestamp { get; set; } | ||
public string ReceivedPSBT { get; set; } | ||
} |
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
53 changes: 53 additions & 0 deletions
53
BTCPayServer.Data/Migrations/20241029163147_AddingPendingTransactionsTable.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,53 @@ | ||
using System; | ||
using BTCPayServer.Data; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace BTCPayServer.Migrations | ||
{ | ||
[DbContext(typeof(ApplicationDbContext))] | ||
[Migration("20241029163147_AddingPendingTransactionsTable")] | ||
public partial class AddingPendingTransactionsTable : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "PendingTransactions", | ||
columns: table => new | ||
{ | ||
TransactionId = table.Column<string>(type: "text", nullable: false), | ||
CryptoCode = table.Column<string>(type: "text", nullable: false), | ||
StoreId = table.Column<string>(type: "text", nullable: true), | ||
Expiry = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true), | ||
State = table.Column<int>(type: "integer", nullable: false), | ||
OutpointsUsed = table.Column<string[]>(type: "text[]", nullable: true), | ||
Blob2 = table.Column<string>(type: "JSONB", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_PendingTransactions", x => new { x.CryptoCode, x.TransactionId }); | ||
table.ForeignKey( | ||
name: "FK_PendingTransactions_Stores_StoreId", | ||
column: x => x.StoreId, | ||
principalTable: "Stores", | ||
principalColumn: "Id", | ||
onDelete: ReferentialAction.Cascade); | ||
}); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_PendingTransactions_StoreId", | ||
table: "PendingTransactions", | ||
column: "StoreId"); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "PendingTransactions"); | ||
} | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,7 +95,6 @@ public async Task CanUseForms() | |
|
||
s.Driver.FindElement(By.CssSelector("button[type='submit']")).Click(); | ||
|
||
Assert.Contains("Enter your email", s.Driver.PageSource); | ||
s.Driver.FindElement(By.Name("buyerEmail")).SendKeys("[email protected]"); | ||
s.Driver.FindElement(By.CssSelector("input[type='submit']")).Click(); | ||
|
||
|
@@ -2904,6 +2903,16 @@ public async Task CanUsePOSKeypad() | |
// Unauthenticated user can't access recent transactions | ||
s.GoToUrl(keypadUrl); | ||
s.Driver.ElementDoesNotExist(By.Id("RecentTransactionsToggle")); | ||
|
||
// But they can generate invoices | ||
s.Driver.FindElement(By.CssSelector(".keypad [data-key='1']")).Click(); | ||
s.Driver.FindElement(By.CssSelector(".keypad [data-key='2']")).Click(); | ||
s.Driver.FindElement(By.CssSelector(".keypad [data-key='3']")).Click(); | ||
s.Driver.FindElement(By.Id("pay-button")).Click(); | ||
s.Driver.WaitUntilAvailable(By.Id("Checkout")); | ||
s.Driver.FindElement(By.Id("DetailsToggle")).Click(); | ||
s.Driver.WaitForElement(By.Id("PaymentDetails-TotalFiat")); | ||
Assert.Contains("1,23 €", s.Driver.FindElement(By.Id("PaymentDetails-TotalFiat")).Text); | ||
} | ||
|
||
[Fact] | ||
|
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
Oops, something went wrong.