Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<!-- Npgsql.EntityFrameworkCore.PostgreSQL 11.0.0-rc.3 pins EF Core to 11.0.0-rc.3 exactly; move all of these to 11.0.0 once Npgsql 11.0.0 ships. -->
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="11.0.0-rc.3" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="11.0.0-rc.3.26522.148" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="11.0.0-rc.3.26522.148" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="11.0.0-rc.3.26522.148" />
<PackageVersion Include="NSubstitute" Version="6.2.0" />
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.17" />
Expand Down Expand Up @@ -89,4 +90,4 @@
<!-- Before license change -->
<PackageVersion Include="MediatR" Version="13.1.0" />
</ItemGroup>
</Project>
</Project>
7 changes: 0 additions & 7 deletions src/ClientApp/Models/Orders/CardType.cs

This file was deleted.

11 changes: 2 additions & 9 deletions src/ClientApp/Models/Orders/Order.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,8 @@ public Order()

[JsonPropertyName("zipCode")] public string ShippingZipCode { get; set; }

public int CardTypeId { get; set; }

public string CardNumber { get; set; }

public string CardHolderName { get; set; }

public DateTime CardExpiration { get; set; }

public string CardSecurityNumber { get; set; }
[JsonPropertyName("paymentToken")]
public string PaymentToken { get; set; }

[JsonPropertyName("items")]
public List<OrderItem> OrderItems { get; set; }
Expand Down
12 changes: 1 addition & 11 deletions src/ClientApp/Models/Orders/OrderCheckout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,7 @@ public class OrderCheckout

public string ZipCode { get; set; }
[Required]
public string CardNumber { get; set; }
[Required]
public string CardHolderName { get; set; }

[Required]
public DateTime CardExpiration { get; set; }

[Required]
public string CardSecurityNumber { get; set; }

public int CardTypeId { get; set; }
public string PaymentToken { get; set; }

public string Buyer { get; set; }

Expand Down
15 changes: 0 additions & 15 deletions src/ClientApp/Models/User/PaymentInfo.cs

This file was deleted.

7 changes: 0 additions & 7 deletions src/ClientApp/Models/User/UserInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ public class UserInfo

[JsonPropertyName("last_name")] public string LastName { get; set; }

[JsonPropertyName("card_number")] public string CardNumber { get; set; }

[JsonPropertyName("card_holder")] public string CardHolder { get; set; }

[JsonPropertyName("card_security_number")]
public string CardSecurityNumber { get; set; }

[JsonPropertyName("address_city")] public string Address { get; set; }

[JsonPropertyName("address_country")] public string Country { get; set; }
Expand Down
3 changes: 0 additions & 3 deletions src/ClientApp/Services/Identity/IdentityMockService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ public Task<UserInfo> GetUserInfoAsync()
PreferredUsername = "sampleUser",
Name = "Sample",
LastName = "User",
CardNumber = "XXXXXXXXXXXX3456",
CardHolder = "Sample User",
CardSecurityNumber = "123",
Address = "123 Sample Street",
Country = "USA",
State = "Washington",
Expand Down
4 changes: 0 additions & 4 deletions src/ClientApp/Services/Identity/IdentityService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ public async Task<UserInfo> GetUserInfoAsync()
userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "preferred_username")?.Value,
Name = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "name")?.Value,
LastName = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "last_name")?.Value,
CardNumber = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "card_number")?.Value,
CardHolder = userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "card_holder")?.Value,
CardSecurityNumber =
userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "card_security_number")?.Value,
PhoneNumberVerified =
bool.Parse(userInfoWithClaims.Claims.FirstOrDefault(c => c.Type == "phone_number_verified")
?.Value ?? "false"),
Expand Down
49 changes: 6 additions & 43 deletions src/ClientApp/Services/Order/OrderMockService.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using eShop.ClientApp.Models.Basket;
using eShop.ClientApp.Models.Orders;
using eShop.ClientApp.Models.User;

namespace eShop.ClientApp.Services.Order;

public class OrderMockService : IOrderService
{
private static readonly DateTime MockExpirationDate = DateTime.Now.AddYears(5);
private const string MockPaymentToken = "pm_mock_mobile";

private static readonly Address MockAdress = new()
{
Expand All @@ -22,22 +21,6 @@ public class OrderMockService : IOrderService
ZipCode = "98101"
};

private static readonly PaymentInfo MockPaymentInfo = new()
{
Id = Guid.NewGuid(),
CardHolderName = "American Express",
CardNumber = "XXXXXXXXXXXX0005",
CardType = new CardType
{
Id = 3,
Name = "MasterCard"
},
Expiration = MockExpirationDate.ToString(),
ExpirationMonth = MockExpirationDate.Month,
ExpirationYear = MockExpirationDate.Year,
SecurityNumber = "123"
};

private static readonly List<OrderItem> MockOrderItems = new()
{
new OrderItem
Expand All @@ -64,11 +47,7 @@ public class OrderMockService : IOrderService

private static readonly OrderCheckout MockOrderCheckout = new()
{
CardExpiration = DateTime.UtcNow,
CardHolderName = "FakeCardHolderName",
CardNumber = "XXXXXXXXXXXX3224",
CardSecurityNumber = "1234",
CardTypeId = 1,
PaymentToken = MockPaymentToken,
City = "FakeCity",
Country = "FakeCountry",
ZipCode = "FakeZipCode",
Expand All @@ -84,11 +63,7 @@ public class OrderMockService : IOrderService
OrderDate = DateTime.Now,
OrderStatus = "Submitted",
OrderItems = MockOrderItems,
CardTypeId = MockPaymentInfo.CardType.Id,
CardHolderName = MockPaymentInfo.CardHolderName,
CardNumber = MockPaymentInfo.CardNumber,
CardSecurityNumber = MockPaymentInfo.SecurityNumber,
CardExpiration = new DateTime(MockPaymentInfo.ExpirationYear, MockPaymentInfo.ExpirationMonth, 1),
PaymentToken = MockPaymentToken,
ShippingCity = MockAdress.City,
ShippingState = MockAdress.State,
ShippingCountry = MockAdress.Country,
Expand All @@ -102,11 +77,7 @@ public class OrderMockService : IOrderService
OrderDate = DateTime.Now,
OrderStatus = "Paid",
OrderItems = MockOrderItems,
CardTypeId = MockPaymentInfo.CardType.Id,
CardHolderName = MockPaymentInfo.CardHolderName,
CardNumber = MockPaymentInfo.CardNumber,
CardSecurityNumber = MockPaymentInfo.SecurityNumber,
CardExpiration = new DateTime(MockPaymentInfo.ExpirationYear, MockPaymentInfo.ExpirationMonth, 1),
PaymentToken = MockPaymentToken,
ShippingCity = MockAdress.City,
ShippingState = MockAdress.State,
ShippingCountry = MockAdress.Country,
Expand All @@ -120,11 +91,7 @@ public class OrderMockService : IOrderService
OrderDate = DateTime.Now,
OrderStatus = "Cancelled",
OrderItems = MockOrderItems,
CardTypeId = MockPaymentInfo.CardType.Id,
CardHolderName = MockPaymentInfo.CardHolderName,
CardNumber = MockPaymentInfo.CardNumber,
CardSecurityNumber = MockPaymentInfo.SecurityNumber,
CardExpiration = new DateTime(MockPaymentInfo.ExpirationYear, MockPaymentInfo.ExpirationMonth, 1),
PaymentToken = MockPaymentToken,
ShippingCity = MockAdress.City,
ShippingState = MockAdress.State,
ShippingCountry = MockAdress.Country,
Expand All @@ -138,11 +105,7 @@ public class OrderMockService : IOrderService
OrderDate = DateTime.Now,
OrderStatus = "Shipped",
OrderItems = MockOrderItems,
CardTypeId = MockPaymentInfo.CardType.Id,
CardHolderName = MockPaymentInfo.CardHolderName,
CardNumber = MockPaymentInfo.CardNumber,
CardSecurityNumber = MockPaymentInfo.SecurityNumber,
CardExpiration = new DateTime(MockPaymentInfo.ExpirationYear, MockPaymentInfo.ExpirationMonth, 1),
PaymentToken = MockPaymentToken,
ShippingCity = MockAdress.City,
ShippingState = MockAdress.State,
ShippingCountry = MockAdress.Country,
Expand Down
6 changes: 1 addition & 5 deletions src/ClientApp/Services/Order/OrderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ public OrderCheckout MapOrderToBasket(Models.Orders.Order order)
{
return new OrderCheckout
{
CardExpiration = order.CardExpiration,
CardHolderName = order.CardHolderName,
CardNumber = order.CardNumber,
CardSecurityNumber = order.CardSecurityNumber,
CardTypeId = order.CardTypeId,
PaymentToken = order.PaymentToken,
City = order.ShippingCity,
State = order.ShippingState,
Country = order.ShippingCountry,
Expand Down
15 changes: 1 addition & 14 deletions src/ClientApp/ViewModels/CheckoutViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,6 @@ await IsBusyFor(
City = userInfo?.Address
};

// Create Payment Info
var paymentInfo = new PaymentInfo
{
CardNumber = userInfo?.CardNumber,
CardHolderName = userInfo?.CardHolder,
CardType = new CardType {Id = 3, Name = "MasterCard"},
SecurityNumber = userInfo?.CardSecurityNumber
};

var orderItems = CreateOrderItems(basketItems);

// Create new Order
Expand All @@ -76,11 +67,7 @@ await IsBusyFor(
OrderItems = orderItems,
OrderStatus = "Submitted",
OrderDate = DateTime.Now,
CardHolderName = paymentInfo.CardHolderName,
CardNumber = paymentInfo.CardNumber,
CardSecurityNumber = paymentInfo.SecurityNumber,
CardExpiration = DateTime.UtcNow.AddYears(5),
CardTypeId = paymentInfo.CardType.Id,
PaymentToken = "pm_sample_mobile",
ShippingState = ShippingAddress.State,
ShippingCountry = ShippingAddress.Country,
ShippingStreet = ShippingAddress.Street,
Expand Down
Loading