Skip to content
Merged
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
6 changes: 6 additions & 0 deletions Application/Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Http.Abstractions">
<HintPath>C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\8.0.23\Microsoft.AspNetCore.Http.Abstractions.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
6 changes: 0 additions & 6 deletions Application/AssemblyReference.cs

This file was deleted.

2 changes: 2 additions & 0 deletions Application/Features/Appointments/DTOs/CreateAppointment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ public class CreateAppointment
public DateTime EndTime { get; set; }
[Required]
public string AppoinmentTitle { get; set; }
[Required]
public Guid TenantId { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public async Task<string> CreateAppointmentAsync(CreateAppointment dto)
throw new UnauthorizedAccessException("Not Authenticated");

var userId = _userContext.UserId;
var appointment = new Appointment(userId, dto.StartTime, dto.EndTime, dto.AppoinmentTitle);
var appointment = new Appointment(userId, dto.StartTime, dto.EndTime, dto.AppoinmentTitle,dto.TenantId);

if (!await _userRepository.IsUserExistsByIdAsync(userId))
throw new NotFoundException($"User with {userId} does not exist");
Expand Down
14 changes: 13 additions & 1 deletion Application/Features/Payment/DTOs/CreatePaymentDto.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
using Domain.Entities;

namespace Application.Features.Payment.DTOs;

public class CreatePaymentDto
{
public Guid TenantId { get; set; }
public Guid AppointmentId { get; set; }
public long Amount { get; set; }
public string PhoneNumber { get; set; }
public PaymentGateway Gateway { get; set; }

public string Description { get; set; }
public string? Mobile { get; set; }
public string? Email { get; set; }

public decimal? GatewayFee { get; set; }
public int? TokenExpiryInMinutes { get; set; }
public string? ReferrerId { get; set; }
}
14 changes: 14 additions & 0 deletions Application/Features/Payment/DTOs/Saman/SamanTokenRequestDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Text.Json.Serialization;

namespace Application.Features.Payment.DTOs.Saman;

public class SamanTokenRequestDto
{
[JsonPropertyName("Action")] public string? Action { get; set; } = "token";
[JsonPropertyName("Amount")] public long Amount { get; set; }
[JsonPropertyName("Wage")] public decimal? Wage { get; set; }
[JsonPropertyName("ResNum")] public string? ResNum { get; set; }
[JsonPropertyName("CellNumber")] public string? CellNumber { get; set; }
[JsonPropertyName("TokenExpiryInMin")] public int TokenExpiryInMinutes { get; set; }
[JsonPropertyName("HashedCardNumber")] public string? HashedCardNumber { get; set; }
}
19 changes: 19 additions & 0 deletions Application/Features/Payment/DTOs/Saman/VerifySamanPayment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

namespace Application.Features.Payment.DTOs.Saman;

public class VerifySamanPayment
{
public TransactionDetail? TransactionDetail { get; set; }
public int? ResultCode { get; set; }
public string? ResultDescription { get; set; }
public bool Success { get; set; }

}

public class TransactionDetail
{
public string? RRN { get; set; }
public string? RefNum { get; set; }
public string? MaskedPan { get; set; }
public string? HashedPan { get; set; }
}
15 changes: 15 additions & 0 deletions Application/Features/Payment/DTOs/SamanTokenResponseDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Text.Json.Serialization;

namespace Application.Features.Payment.DTOs;

public class SamanTokenResponseDto
{
[JsonPropertyName("status")]
public int Status { get; set; }
[JsonPropertyName("token")]
public string? Token { get; set; }
[JsonPropertyName("errorCode")]
public string? ErrorCode { get; set; }
[JsonPropertyName("errorDesc")]
public string? ErrorDescription { get; set; }
}
29 changes: 29 additions & 0 deletions Application/Features/Payment/DTOs/SandBoxCallBackDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
namespace Application.Features.Payment.DTOs;

public class SandBoxCallBackDto
{
public string? Authority { get; set; }
// public string? MID { get; set; }

public string? Status { get; set; }

public string? State { get; set; }

public string? RRN { get; set; }

public string? RefNum { get; set; }

public string? ResNum { get; set; }

public string? TraceNo { get; set; }

public long? Amount { get; set; }

public string? Wage { get; set; }

public string? CID { get; set; }

public string? SecurePan { get; set; }

public string? Token { get; set; }
}
12 changes: 0 additions & 12 deletions Application/Features/Payment/DTOs/SepTokenResponse.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Text.Json.Serialization;

namespace Application.Features.Payment.DTOs.ZarinPal;

public class CreateZarinPalPaymentDto
{
[JsonPropertyName("amount")]
public long Amount { get; set; }
[JsonPropertyName("description")]
public string Description { get; set; }
[JsonPropertyName("referrer_id")]
public string? ReferrerId { get; set; }

[JsonPropertyName("matadata")]
public ZarinPalMataData ZarinPalMataData { get; set; }
}

public class ZarinPalMataData
{
[JsonPropertyName("mobile")]
public string? Mobile { get; set; }
[JsonPropertyName("email")]
public string? Email { get; set; }
[JsonPropertyName("order_id")]
public string? OrderId { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Application.Features.Payment.DTOs.ZarinPal;

public class ZarinPalCallBackResponse
{
public string Authority { get; set; }
public string Status { get; set; }
}
17 changes: 17 additions & 0 deletions Application/Features/Payment/DTOs/ZarinPal/ZarinPalResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Text.Json.Serialization;

namespace Application.Features.Payment.DTOs.ZarinPal;

public class ZarinPalResponse
{
[JsonPropertyName("data")]
public ZarinPalData? Data { get; set; }
[JsonPropertyName("errors")]
public object? Error { get; set; }
}

public class ZarinPalData
{
[JsonPropertyName("authority")]
public string Authority { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Text.Json.Serialization;

namespace Application.Features.Payment.DTOs.ZarinPal;

public class ZarinPalVerifyResponse
{
public ZarinPalVerifyData Data { get; set; }
}

public class ZarinPalVerifyData
{
[JsonPropertyName("code")]
public int Code { get; set; }
[JsonPropertyName("card_pan")]
public string CardPan { get; set; }
[JsonPropertyName("ref_id")]
public int RefId { get; set; }
[JsonPropertyName("card_hash")]
public string CardHash { get; set; }
[JsonPropertyName("fee")]
public int Fee { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Application.Features.Payment.DTOs;
using Domain.Entities;
using Microsoft.AspNetCore.Http;

Check failure on line 3 in Application/Features/Payment/Interfaces/PaymentGatewayProviderContract.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

Check failure on line 3 in Application/Features/Payment/Interfaces/PaymentGatewayProviderContract.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

namespace Application.Features.Payment.Interfaces;

public interface PaymentGatewayProviderContract
{
public PaymentGateway Gateway { get;}

Task<PaymentGatewayRequestResult> RequestPaymentAsync(Domain.Entities.Payment payment, CreatePaymentDto dto);

Task<string?> HandleCallBackAsync(PaymentGateway gateway, SandBoxCallBackDto dto);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace Application.Features.Payment.Interfaces;

public class PaymentGatewayRequestResult
{
public bool IsSuccess { get; private set; }
public string? GatewayToken { get; private set; }
public string? PaymentUrl { get; private set; }
public string? ErrorCode { get; private set; }
public string? ErrorMessage { get; private set; }

public static PaymentGatewayRequestResult Success(string gatewayToken, string paymentUrl)
=> new()
{
IsSuccess = true,
GatewayToken = gatewayToken,
PaymentUrl = paymentUrl
};

public static PaymentGatewayRequestResult Failed(string? errorCode, string errorMessage)
=> new()
{
IsSuccess = false,
ErrorCode = errorCode,
ErrorMessage = errorMessage
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Domain.Entities;

namespace Application.Features.Payment.Interfaces;

public interface PaymentGatewayResolverContract
{
PaymentGatewayProviderContract Resolve(PaymentGateway gateway);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Application.Features.Payment.DTOs;

namespace Application.Features.Payment.Interfaces;

public interface PaymentRepositoryContract
{
Task CreatePaymentAsync(Domain.Entities.Payment payment);
Task SaveAsync();
Task<Domain.Entities.Payment?> GetPaymentByResNumAsync(string resNum);
Task<Domain.Entities.Payment?> GetPaymentByAuthorityAsync(string authority);
Task<bool> IsExistByRefNum(string refNum);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
using Application.Features.Payment.DTOs;
using Application.Features.Payment.DTOs.ZarinPal;
using Domain.Entities;
using Microsoft.AspNetCore.Http;

Check failure on line 4 in Application/Features/Payment/Interfaces/PaymentServiceContract.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

Check failure on line 4 in Application/Features/Payment/Interfaces/PaymentServiceContract.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

namespace Application.Features.Payment.Interfaces;

public interface PaymentServiceContract
{
Task<string> GenerateResNum();
Task<string?> CreatePaymentAsync(CreatePaymentDto dto);
Task<string?> HandleCallBackAsync(PaymentGateway gateway,SandBoxCallBackDto dto);
Task<bool> VerifyTransaction(string RefNum);
}
Loading
Loading