diff --git a/.github/workflows/sipay-integration.yml b/.github/workflows/sipay-integration.yml
new file mode 100644
index 0000000..22bd9ba
--- /dev/null
+++ b/.github/workflows/sipay-integration.yml
@@ -0,0 +1,94 @@
+name: Integration.PaymentGateways.Sipay
+
+on:
+ workflow_dispatch:
+ workflow_call:
+ push:
+ branches:
+ - main
+
+ paths:
+ - src/Integration.Hub/**
+ - src/PaymentGateways/Integration.PaymentGateways.Sipay/**
+ - .github/workflows/sipay-integration.yml
+ - .github/workflows/composite/**
+
+env:
+ #For build process
+ owner: onurkanbakirci
+ repo: Integration
+
+ project_path: ./src/PaymentGateways/Integration.PaymentGateways.Sipay/
+ nupkg_path: ./src/PaymentGateways/Integration.PaymentGateways.Sipay/bin/Release/Integration.PaymentGateways.Sipay.1.0.0.nupkg
+ nupkg_github_secret: ${{ secrets.GITHUB_TOKEN }}
+ nupkg_nuget_secret: ${{ secrets.NUGET_API_KEY }}
+ github_registry_url: https://nuget.pkg.github.com/onurkanbakirci/index.json
+ nuget_registry_url: https://api.nuget.org/v3/index.json
+
+jobs:
+ build_lib:
+ name: Build Lib
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: 8.x
+
+ - name: Restore dependencies
+ run: dotnet restore
+
+ - name: Build
+ run: |
+ cd ${{env.project_path}}
+ dotnet build --no-restore
+
+ test_lib:
+ name: Test Lib
+ runs-on: ubuntu-latest
+ needs: build_lib
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+
+ - name: Test
+ run: |
+
+ publish_lib_to_github:
+ name: Publish Lib to Github
+ runs-on: ubuntu-latest
+ needs: test_lib
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+
+ - name: Push nuget package to github registry
+ uses: ./.github/workflows/composite/publish-lib
+ with:
+ package_source: ${{ env.github_registry_url }}
+ path: ${{ env.project_path }}
+ nupkg_path: ${{ env.nupkg_path }}
+ api_key: ${{ env.nupkg_github_secret }}
+
+ publish_lib_to_nuget:
+ name: Publish Lib to Nuget
+ runs-on: ubuntu-latest
+ needs: test_lib
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+
+ - name: Push nuget package to nuget registry
+ uses: ./.github/workflows/composite/publish-lib
+ with:
+ package_source: ${{ env.nuget_registry_url }}
+ path: ${{ env.project_path }}
+ nupkg_path: ${{ env.nupkg_path }}
+ api_key: ${{ env.nupkg_nuget_secret }}
diff --git a/Integration.sln b/Integration.sln
index 92a6070..37f3efb 100644
--- a/Integration.sln
+++ b/Integration.sln
@@ -29,6 +29,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PaymentGateways", "PaymentG
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaynetIntegrationSampleConsoleApp", "samples\PaymentGateways\PaynetIntegrationSampleConsoleApp\PaynetIntegrationSampleConsoleApp.csproj", "{E9D8CC15-86F9-4BCD-903A-689112662FE8}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Integration.PaymentGateways.Sipay", "src\PaymentGateways\Integration.PaymentGateways.Sipay\Integration.PaymentGateways.Sipay.csproj", "{D881792A-2FF3-42C8-AD85-70A5F279D6DD}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SipayIntegrationSampleConsoleApp", "samples\PaymentGateways\SipayIntegrationSampleConsoleApp\SipayIntegrationSampleConsoleApp.csproj", "{E6169DA7-4B5C-49AF-90E3-57D55FA554C4}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -66,6 +70,14 @@ Global
{E9D8CC15-86F9-4BCD-903A-689112662FE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9D8CC15-86F9-4BCD-903A-689112662FE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9D8CC15-86F9-4BCD-903A-689112662FE8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D881792A-2FF3-42C8-AD85-70A5F279D6DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D881792A-2FF3-42C8-AD85-70A5F279D6DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D881792A-2FF3-42C8-AD85-70A5F279D6DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D881792A-2FF3-42C8-AD85-70A5F279D6DD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E6169DA7-4B5C-49AF-90E3-57D55FA554C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E6169DA7-4B5C-49AF-90E3-57D55FA554C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E6169DA7-4B5C-49AF-90E3-57D55FA554C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E6169DA7-4B5C-49AF-90E3-57D55FA554C4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{2E841AED-7444-4875-8D11-D756A01105FD} = {8D1AC917-32E3-4579-9A06-B6190C1B9F31}
@@ -79,5 +91,7 @@ Global
{3B5D9A6A-FA30-42C6-8C3D-7A38314B64D3} = {D54A7D33-8E81-413F-B1D5-D9DF65BA1D83}
{572AD2AF-7896-4707-8D3A-8EAFF16991C0} = {51C29F15-6693-428D-9705-1986F8C71428}
{E9D8CC15-86F9-4BCD-903A-689112662FE8} = {572AD2AF-7896-4707-8D3A-8EAFF16991C0}
+ {D881792A-2FF3-42C8-AD85-70A5F279D6DD} = {D54A7D33-8E81-413F-B1D5-D9DF65BA1D83}
+ {E6169DA7-4B5C-49AF-90E3-57D55FA554C4} = {572AD2AF-7896-4707-8D3A-8EAFF16991C0}
EndGlobalSection
EndGlobal
diff --git a/README.md b/README.md
index 9a3c7f1..1da1714 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,7 @@
+
@@ -21,6 +22,7 @@ Enhance your integration workflows by leveraging the Integration Library, which
**Integration.Marketplaces.Trendyol** | ![build](https://github.com/onurkanbakirci/Integration/actions/workflows/trendyol-integration.yml/badge.svg) | 1.0.1
**Integration.Marketplaces.Hepsiburada** | ![build](https://github.com/onurkanbakirci/Integration/actions/workflows/hepsiburada-integration.yml/badge.svg) | 1.0.1
**Integration.PaymentGateways.Paynet** | ![build](https://github.com/onurkanbakirci/Integration/actions/workflows/paynet-integration.yml/badge.svg) | 1.0.0
+**Integration.PaymentGateways.Sipay** | ![build](https://github.com/onurkanbakirci/Integration/actions/workflows/sipay-integration.yml/badge.svg) | 1.0.0
## Table of contents
@@ -32,6 +34,7 @@ Enhance your integration workflows by leveraging the Integration Library, which
- [Trendyol](#trendyol)
- [Hepsiburada](#hepsiburada)
- [Paynet](#paynet)
+ - [Sipay](#sipay)
## Introduction
@@ -148,10 +151,9 @@ var securePaymentInitialResponse = await paynetPaymentIntegration.SecurePaymentI
Console.WriteLine(securePaymentInitialResponse.HtmlContent);
// 3. After successfull 3d confirmation, secure payment charge
-var securePaymentChargeRequest = new SecurePaymentChargeRequestModel(
+var securePaymentChargeRequest = await paynetPaymentIntegration.SecurePaymentChargeAsync(new SecurePaymentChargeRequestModel(
sessionId: securePaymentInitialResponse.SessionId,
- tokenId: securePaymentInitialResponse.TokenId);
-
+ tokenId: securePaymentInitialResponse.TokenId));
// Cancel payment
var cancelResponse = await paynetPaymentIntegration.CancelAsync(new CancellationRequestModel(
@@ -165,4 +167,108 @@ var refundResponse = await paynetPaymentIntegration.RefundAsync(new RefundReques
amount: "100",
succeedUrl: "succeedUrl"
));
+```
+
+### Sipay
+
+```
+dotnet add package Integration.PaymentGateways.Sipay --version 1.0.0
+```
+
+```c#
+using Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Request;
+using Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Response;
+
+var sipayPaymentIntegration = new SipayPaymentIntegration(
+ merchantKey: "merchantKey",
+ appKey: "appKey",
+ appSecret: "appSecret",
+ merchantId: 0,
+ isInProduction: false
+);
+
+// Get installments
+var installments = await sipayPaymentIntegration.CheckInstallmentsAsync(new CheckInstallmentRequestModel(
+ creaditCard: "123456",
+ amount: 100,
+ currenyCode: "TRY"
+));
+
+// Non secure payment
+var nonSecurePaymentResponse = await sipayPaymentIntegration.NonSecurePaymentAsync(new NonSecurePaymentRequestModel(
+ ccHolderName: "John Doe",
+ ccNo: "123456",
+ expiryMonth: 12,
+ expiryYear: 2022,
+ cvv: 123,
+ currencyCode: "TRY",
+ installmentsNumber: 1,
+ invoiceId: 1,
+ invoiceDescription: "Invoice description",
+ name: "John",
+ surname: "Doe",
+ total: 100,
+ items: "items",
+ cancelUrl: "https://cancelUrl.com",
+ returnUrl: "https://returnUrl.com",
+ hashKey: "hashKey",
+ ip: "",
+ orderType: 0
+));
+
+// Secure payment
+// 1. Get secure payment hmtl content and show to user
+var securePaymentInitialHtml = sipayPaymentIntegration.SecurePaymentInitial(new SecurePaymentInitialRequestModel(
+ ccHolderName: "John Doe",
+ ccNo: "123456",
+ expiryMonth: 12,
+ expiryYear: 2022,
+ cvv: 123,
+ currencyCode: "TRY",
+ installmentsNumber: 1,
+ invoiceId: "1",
+ invoiceDescription: "Invoice description",
+ name: "John",
+ surname: "Doe",
+ total: 100,
+ items: "items",
+ cancelUrl: "https://cancelUrl.com",
+ returnUrl: "https://returnUrl.com",
+ hashKey: "hashKey",
+ orderType: 0,
+ recurringPaymentNumber: 0,
+ recurringPaymentCycle: "",
+ recurringPaymentInterval: "",
+ recurringWebHookKey: "",
+ maturityPeriod: 0,
+ paymentFrequency: 0
+));
+
+// 2. Show 3ds html content to user
+Console.WriteLine(securePaymentInitialHtml);
+
+// 3. After successfull 3d confirmation, secure payment charge
+var securePaymentChargeRequest = await sipayPaymentIntegration.SecurePaymentChargeAsync(new SecurePaymentChargeRequestModel(
+ invoiceId: "1",
+ orderId: "1",
+ status: "1",
+ hashKey: ""));
+
+
+// Cancel payment
+var cancelResponse = await sipayPaymentIntegration.CancelAsync(new CancellationRequestModel(
+ invoiceId: "",
+ hashKey: "",
+ refundTransactionId: "",
+ refundWebhookKey: ""
+));
+
+// Refund payment
+var refundResponse = await sipayPaymentIntegration.RefundAsync(new RefundRequestModel(
+ invoiceId: "",
+ amount: 100,
+ hashKey: "",
+ refundTransactionId: "",
+ refundWebhookKey: ""
+));
```
\ No newline at end of file
diff --git a/docs/integration/docs/payment-gateways/paynet.md b/docs/integration/docs/payment-gateways/paynet.md
index 060f661..da9707b 100644
--- a/docs/integration/docs/payment-gateways/paynet.md
+++ b/docs/integration/docs/payment-gateways/paynet.md
@@ -72,9 +72,9 @@ Console.WriteLine(securePaymentInitialResponse.HtmlContent);
3. **After successfull 3d confirmation, secure payment charge**
```csharp
-var securePaymentChargeRequest = new SecurePaymentChargeRequestModel(
+var securePaymentChargeRequest = await paynetPaymentIntegration.SecurePaymentChargeAsync(new SecurePaymentChargeRequestModel(
sessionId: securePaymentInitialResponse.SessionId,
- tokenId: securePaymentInitialResponse.TokenId);
+ tokenId: securePaymentInitialResponse.TokenId));
```
### Cancel payment
diff --git a/docs/integration/docs/payment-gateways/sipay.md b/docs/integration/docs/payment-gateways/sipay.md
new file mode 100644
index 0000000..b53d2df
--- /dev/null
+++ b/docs/integration/docs/payment-gateways/sipay.md
@@ -0,0 +1,133 @@
+---
+sidebar_position: 2
+---
+
+# Sipay Integration
+
+Integrate your services with sipay
+
+```bash
+dotnet add package Integration.PaymentGateways.Sipay
+```
+
+Configure your credentials which are given by sipay
+
+```csharp
+using Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Request;
+
+var sipayPaymentIntegration = new SipayPaymentIntegration(
+ merchantKey: "merchantKey",
+ appKey: "appKey",
+ appSecret: "appSecret",
+ merchantId: 0,
+ isInProduction: false
+);
+```
+
+:::tip
+
+You have to get your **merchantKey**, **appKey**, **appSecret**, **merchantId** from sipay.
+
+:::
+
+### Get installments
+
+```csharp
+var installments = await sipayPaymentIntegration.CheckInstallmentsAsync(new CheckInstallmentRequestModel(
+ creaditCard: "123456",
+ amount: 100,
+ currenyCode: "TRY"
+));
+```
+
+### Non secure payment
+
+```csharp
+var nonSecurePaymentResponse = await sipayPaymentIntegration.NonSecurePaymentAsync(new NonSecurePaymentRequestModel(
+ ccHolderName: "John Doe",
+ ccNo: "123456",
+ expiryMonth: 12,
+ expiryYear: 2022,
+ cvv: 123,
+ currencyCode: "TRY",
+ installmentsNumber: 1,
+ invoiceId: 1,
+ invoiceDescription: "Invoice description",
+ name: "John",
+ surname: "Doe",
+ total: 100,
+ items: "items",
+ cancelUrl: "https://cancelUrl.com",
+ returnUrl: "https://returnUrl.com",
+ hashKey: "hashKey",
+ ip: "",
+ orderType: 0
+));
+```
+
+### Secure payment
+Secure payment consist of 3 phases:
+
+ 1. **Get secure payment initial**
+```csharp
+var securePaymentInitialHtml = sipayPaymentIntegration.SecurePaymentInitial(new SecurePaymentInitialRequestModel(
+ ccHolderName: "John Doe",
+ ccNo: "123456",
+ expiryMonth: 12,
+ expiryYear: 2022,
+ cvv: 123,
+ currencyCode: "TRY",
+ installmentsNumber: 1,
+ invoiceId: "1",
+ invoiceDescription: "Invoice description",
+ name: "John",
+ surname: "Doe",
+ total: 100,
+ items: "items",
+ cancelUrl: "https://cancelUrl.com",
+ returnUrl: "https://returnUrl.com",
+ hashKey: "hashKey",
+ orderType: 0,
+ recurringPaymentNumber: 0,
+ recurringPaymentCycle: "",
+ recurringPaymentInterval: "",
+ recurringWebHookKey: "",
+ maturityPeriod: 0,
+ paymentFrequency: 0
+));
+```
+
+ 2. **Show 3ds html content to user**
+```csharp
+Console.WriteLine(securePaymentInitialHtml);
+```
+
+ 3. **After successfull 3d confirmation, secure payment charge**
+```csharp
+var securePaymentChargeRequest = await sipayPaymentIntegration.SecurePaymentChargeAsync(new SecurePaymentChargeRequestModel(
+ invoiceId: "1",
+ orderId: "1",
+ status: "1",
+ hashKey: ""));
+```
+
+### Cancel payment
+```csharp
+var cancelResponse = await sipayPaymentIntegration.CancelAsync(new CancellationRequestModel(
+ invoiceId: "",
+ hashKey: "",
+ refundTransactionId: "",
+ refundWebhookKey: ""
+));
+```
+
+### Refund payment
+```csharp
+var refundResponse = await sipayPaymentIntegration.RefundAsync(new RefundRequestModel(
+ invoiceId: "",
+ amount: 100,
+ hashKey: "",
+ refundTransactionId: "",
+ refundWebhookKey: ""
+));
+```
\ No newline at end of file
diff --git a/samples/PaymentGateways/PaynetIntegrationSampleConsoleApp/Program.cs b/samples/PaymentGateways/PaynetIntegrationSampleConsoleApp/Program.cs
index 87f458a..5b3c3f8 100644
--- a/samples/PaymentGateways/PaynetIntegrationSampleConsoleApp/Program.cs
+++ b/samples/PaymentGateways/PaynetIntegrationSampleConsoleApp/Program.cs
@@ -37,9 +37,9 @@
Console.WriteLine(securePaymentInitialResponse.HtmlContent);
// 3. After successfull 3d confirmation, secure payment charge
-var securePaymentChargeRequest = new SecurePaymentChargeRequestModel(
+var securePaymentChargeRequest = await paynetPaymentIntegration.SecurePaymentChargeAsync(new SecurePaymentChargeRequestModel(
sessionId: securePaymentInitialResponse.SessionId,
- tokenId: securePaymentInitialResponse.TokenId);
+ tokenId: securePaymentInitialResponse.TokenId));
// Cancel payment
diff --git a/samples/PaymentGateways/SipayIntegrationSampleConsoleApp/Program.cs b/samples/PaymentGateways/SipayIntegrationSampleConsoleApp/Program.cs
new file mode 100644
index 0000000..b1967dd
--- /dev/null
+++ b/samples/PaymentGateways/SipayIntegrationSampleConsoleApp/Program.cs
@@ -0,0 +1,95 @@
+using Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Request;
+using Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Response;
+
+var sipayPaymentIntegration = new SipayPaymentIntegration(
+ merchantKey: "merchantKey",
+ appKey: "appKey",
+ appSecret: "appSecret",
+ merchantId: 0,
+ isInProduction: false
+);
+
+// Get installments
+var installments = await sipayPaymentIntegration.CheckInstallmentsAsync(new CheckInstallmentRequestModel(
+ creaditCard: "123456",
+ amount: 100,
+ currenyCode: "TRY"
+));
+
+// Non secure payment
+var nonSecurePaymentResponse = await sipayPaymentIntegration.NonSecurePaymentAsync(new NonSecurePaymentRequestModel(
+ ccHolderName: "John Doe",
+ ccNo: "123456",
+ expiryMonth: 12,
+ expiryYear: 2022,
+ cvv: 123,
+ currencyCode: "TRY",
+ installmentsNumber: 1,
+ invoiceId: 1,
+ invoiceDescription: "Invoice description",
+ name: "John",
+ surname: "Doe",
+ total: 100,
+ items: "items",
+ cancelUrl: "https://cancelUrl.com",
+ returnUrl: "https://returnUrl.com",
+ hashKey: "hashKey",
+ ip: "",
+ orderType: 0
+));
+
+// Secure payment
+// 1. Get secure payment hmtl content and show to user
+var securePaymentInitialHtml = sipayPaymentIntegration.SecurePaymentInitial(new SecurePaymentInitialRequestModel(
+ ccHolderName: "John Doe",
+ ccNo: "123456",
+ expiryMonth: 12,
+ expiryYear: 2022,
+ cvv: 123,
+ currencyCode: "TRY",
+ installmentsNumber: 1,
+ invoiceId: "1",
+ invoiceDescription: "Invoice description",
+ name: "John",
+ surname: "Doe",
+ total: 100,
+ items: "items",
+ cancelUrl: "https://cancelUrl.com",
+ returnUrl: "https://returnUrl.com",
+ hashKey: "hashKey",
+ orderType: 0,
+ recurringPaymentNumber: 0,
+ recurringPaymentCycle: "",
+ recurringPaymentInterval: "",
+ recurringWebHookKey: "",
+ maturityPeriod: 0,
+ paymentFrequency: 0
+));
+
+// 2. Show 3ds html content to user
+Console.WriteLine(securePaymentInitialHtml);
+
+// 3. After successfull 3d confirmation, secure payment charge
+var securePaymentChargeRequest = await sipayPaymentIntegration.SecurePaymentChargeAsync(new SecurePaymentChargeRequestModel(
+ invoiceId: "1",
+ orderId: "1",
+ status: "1",
+ hashKey: ""));
+
+
+// Cancel payment
+var cancelResponse = await sipayPaymentIntegration.CancelAsync(new CancellationRequestModel(
+ invoiceId: "",
+ hashKey: "",
+ refundTransactionId: "",
+ refundWebhookKey: ""
+));
+
+// Refund payment
+var refundResponse = await sipayPaymentIntegration.RefundAsync(new RefundRequestModel(
+ invoiceId: "",
+ amount: 100,
+ hashKey: "",
+ refundTransactionId: "",
+ refundWebhookKey: ""
+));
\ No newline at end of file
diff --git a/samples/PaymentGateways/SipayIntegrationSampleConsoleApp/SipayIntegrationSampleConsoleApp.csproj b/samples/PaymentGateways/SipayIntegrationSampleConsoleApp/SipayIntegrationSampleConsoleApp.csproj
new file mode 100644
index 0000000..2b436d7
--- /dev/null
+++ b/samples/PaymentGateways/SipayIntegrationSampleConsoleApp/SipayIntegrationSampleConsoleApp.csproj
@@ -0,0 +1,15 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/src/Integration.Hub/IAuthIntegration.cs b/src/Integration.Hub/IAuthIntegration.cs
new file mode 100644
index 0000000..852fbc6
--- /dev/null
+++ b/src/Integration.Hub/IAuthIntegration.cs
@@ -0,0 +1,5 @@
+namespace Integration.Hub;
+public interface IAuthIntegration
+{
+
+}
\ No newline at end of file
diff --git a/src/Integration.Hub/Integration.Hub.csproj b/src/Integration.Hub/Integration.Hub.csproj
index 0d2e693..08dacd1 100644
--- a/src/Integration.Hub/Integration.Hub.csproj
+++ b/src/Integration.Hub/Integration.Hub.csproj
@@ -8,6 +8,9 @@
1.0.1
onurkanbakirci
onurkanbakirci
+ Integration.Hub
+ https://github.com/onurkanbakirci/Integration
+ git
\ No newline at end of file
diff --git a/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Integration.Marketplaces.Hepsiburada.csproj b/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Integration.Marketplaces.Hepsiburada.csproj
index 3fdce3e..03a0605 100644
--- a/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Integration.Marketplaces.Hepsiburada.csproj
+++ b/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Integration.Marketplaces.Hepsiburada.csproj
@@ -4,12 +4,6 @@
-
- net8.0
- enable
- enable
-
-
net8.0
enable
@@ -18,6 +12,8 @@
1.0.1
onurkanbakirci
onurkanbakirci
+ https://github.com/onurkanbakirci/Integration
+ git
diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Integration.Marketplaces.Trendyol.csproj b/src/Marketplaces/Integration.Marketplaces.Trendyol/Integration.Marketplaces.Trendyol.csproj
index 49e7436..b3b5aa2 100644
--- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Integration.Marketplaces.Trendyol.csproj
+++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Integration.Marketplaces.Trendyol.csproj
@@ -12,6 +12,8 @@
1.0.1
onurkanbakirci
onurkanbakirci
+ https://github.com/onurkanbakirci/Integration
+ git
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Paynet/Infrastructure/PaymentIntegration/PaynetPaymentIntegration.cs b/src/PaymentGateways/Integration.PaymentGateways.Paynet/Infrastructure/PaymentIntegration/PaynetPaymentIntegration.cs
index f45bf56..a12c047 100644
--- a/src/PaymentGateways/Integration.PaymentGateways.Paynet/Infrastructure/PaymentIntegration/PaynetPaymentIntegration.cs
+++ b/src/PaymentGateways/Integration.PaymentGateways.Paynet/Infrastructure/PaymentIntegration/PaynetPaymentIntegration.cs
@@ -1,4 +1,3 @@
-using Integration.Marketplaces.Trendyol.Infrastructure;
using Integration.PaymentGateways.Paynet.Infrastructure.PaymentIntegration;
using Integration.PaymentGateways.Paynet.Infrastructure.PaymentIntegration.Models.Request;
using Integration.PaymentGateways.Paynet.Infrastructure.PaymentIntegration.Models.Response;
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Paynet/Infrastructure/PaynetIntegrationBase.cs b/src/PaymentGateways/Integration.PaymentGateways.Paynet/Infrastructure/PaynetIntegrationBase.cs
index ff213ce..12c78da 100644
--- a/src/PaymentGateways/Integration.PaymentGateways.Paynet/Infrastructure/PaynetIntegrationBase.cs
+++ b/src/PaymentGateways/Integration.PaymentGateways.Paynet/Infrastructure/PaynetIntegrationBase.cs
@@ -2,7 +2,7 @@
using System.Text.Json;
using Integration.Hub;
-namespace Integration.Marketplaces.Trendyol.Infrastructure;
+namespace Integration.PaymentGateways.Paynet.Infrastructure.PaymentIntegration;
public class PaynetIntegrationBase : IntegrationBase
{
public const string ProdBaseUrl = "https://api.paynet.com.tr/";
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Paynet/Integration.PaymentGateways.Paynet.csproj b/src/PaymentGateways/Integration.PaymentGateways.Paynet/Integration.PaymentGateways.Paynet.csproj
index 0cd12df..f7fd4dd 100644
--- a/src/PaymentGateways/Integration.PaymentGateways.Paynet/Integration.PaymentGateways.Paynet.csproj
+++ b/src/PaymentGateways/Integration.PaymentGateways.Paynet/Integration.PaymentGateways.Paynet.csproj
@@ -8,6 +8,8 @@
1.0.0
onurkanbakirci
onurkanbakirci
+ https://github.com/onurkanbakirci/Integration
+ git
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/AuthPaymentIntegration.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/AuthPaymentIntegration.cs
new file mode 100644
index 0000000..378e524
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/AuthPaymentIntegration.cs
@@ -0,0 +1,16 @@
+using Integration.PaymentGateways.Sipay.Infrastructure.AuthIntegration;
+
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration;
+public class SipayPaymentIntegration : SipayIntegrationBase, ISipayAuthIntegration
+{
+ private string GetTokentUrl() => $"{GetBaseUrl()}api/token";
+
+ public SipayPaymentIntegration(string merchantKey, string appKey, string appSecret, int merchantId, bool isInProduction = true) : base(merchantKey, appKey, appSecret, merchantId, isInProduction)
+ {
+ }
+
+ public async Task GetAuthTokenAsync(GetAuthTokenRequestModel requestModel)
+ {
+ return await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetTokentUrl(), requestBody), requestModel);
+ }
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/IAuthPaymentIntegration.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/IAuthPaymentIntegration.cs
new file mode 100644
index 0000000..9f502f1
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/IAuthPaymentIntegration.cs
@@ -0,0 +1,7 @@
+using Integration.Hub;
+
+namespace Integration.PaymentGateways.Sipay.Infrastructure.AuthIntegration;
+public interface ISipayAuthIntegration : IAuthIntegration
+{
+ Task GetAuthTokenAsync(GetAuthTokenRequestModel requestModel);
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/Models/Request/GetAuthTokenRequestModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/Models/Request/GetAuthTokenRequestModel.cs
new file mode 100644
index 0000000..28b825b
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/Models/Request/GetAuthTokenRequestModel.cs
@@ -0,0 +1,13 @@
+using Integration.Hub;
+namespace Integration.PaymentGateways.Sipay.Infrastructure.AuthIntegration;
+public class GetAuthTokenRequestModel : IRequestModel
+{
+ public GetAuthTokenRequestModel(string appId, string appSecret)
+ {
+ AppId = appId;
+ AppSecret = appSecret;
+ }
+
+ public string AppId { get; set; }
+ public string AppSecret { get; set; }
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/Models/Response/GetAuthTokenResponseModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/Models/Response/GetAuthTokenResponseModel.cs
new file mode 100644
index 0000000..6446f5b
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/Models/Response/GetAuthTokenResponseModel.cs
@@ -0,0 +1,9 @@
+using Integration.PaymentGateways.Sipay.Infrastructure.AuthIntegration.Models.Response;
+
+namespace Integration.PaymentGateways.Sipay.Infrastructure.AuthIntegration;
+public class GetAuthTokenResponseModel : SipayBaseResponseModel
+{
+ public string StatusCode { get; set; }
+ public bool Is3D { get; set; }
+ public string ExpiresAt { get; set; }
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/Models/Response/SipayBaseResponseModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/Models/Response/SipayBaseResponseModel.cs
new file mode 100644
index 0000000..0736aa7
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/AuthIntegration/Models/Response/SipayBaseResponseModel.cs
@@ -0,0 +1,9 @@
+using Integration.Hub;
+
+namespace Integration.PaymentGateways.Sipay.Infrastructure.AuthIntegration.Models.Response;
+public class SipayBaseResponseModel : IResponseModel
+{
+ public bool StatusCode { get; set; }
+ public int StatusDescription { get; set; }
+ public TResponse Data { get; set; }
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Helpers/HTMLHelper.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Helpers/HTMLHelper.cs
new file mode 100644
index 0000000..31634d4
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Helpers/HTMLHelper.cs
@@ -0,0 +1,43 @@
+using System.Text;
+using RazorEngineCore;
+
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Helpers;
+
+public static class HTMLHelper
+{
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string GenerateTemplate(string templateName, string templatePath, T model)
+ {
+ string template = GetTemplate(templateName, templatePath);
+
+ var razorEngine = new RazorEngine();
+ var modifiedTemplate = razorEngine.Compile(template);
+
+ return modifiedTemplate.Run(model);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string GetTemplate(string templateName, string templatePath)
+ {
+ string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
+ string tmplFolder = Path.Combine(baseDirectory, templatePath);
+ string filePath = Path.Combine(tmplFolder, $"{templateName}.cshtml");
+
+ using var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
+ using var sr = new StreamReader(fs, Encoding.Default);
+ string mailText = sr.ReadToEnd();
+ sr.Close();
+
+ return mailText;
+ }
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Helpers/HashHelper.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Helpers/HashHelper.cs
new file mode 100644
index 0000000..16fb803
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Helpers/HashHelper.cs
@@ -0,0 +1,44 @@
+using System.Security.Cryptography;
+using System.Text;
+
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Helpers;
+public static class HashHelper
+{
+ public static string GenerateHashKey(string total, string installment, string currency_code, string merchant_key, string invoice_id, string app_secret)
+ {
+ var data = total + '|' + installment + '|' + currency_code + '|' + merchant_key + '|' + invoice_id;
+ var sha1 = new SHA1Managed();
+ var rnd = new Random();
+ var iv = sha1.ComputeHash(Encoding.UTF8.GetBytes(rnd.ToString()));
+ var password = sha1.ComputeHash(Encoding.UTF8.GetBytes(app_secret)).ToString();
+ rnd = new Random();
+ var shaSalt = sha1.ComputeHash(Encoding.UTF8.GetBytes(rnd.ToString())).ToString();
+ var salt = shaSalt.Substring(0, 4);
+
+ var sha256 = new SHA256Managed();
+ var saltWithPassword = sha256.ComputeHash(Encoding.UTF8.GetBytes(password + salt));
+ var encrypted = EncryptString(data, saltWithPassword, iv);
+ var msg_encrypted_bundle = iv + ":" + salt + ":" + encrypted;
+ msg_encrypted_bundle = msg_encrypted_bundle.Replace("/", "__");
+ return msg_encrypted_bundle;
+ }
+
+ public static string EncryptString(string plainText, byte[] key, byte[] iv)
+ {
+ var encryptor = Aes.Create();
+ encryptor.Mode = CipherMode.CBC;
+ encryptor.Key = key;
+ encryptor.IV = iv;
+ var memoryStream = new MemoryStream();
+ var aesEncryptor = encryptor.CreateEncryptor();
+ var cryptoStream = new CryptoStream(memoryStream, aesEncryptor, CryptoStreamMode.Write);
+ var plainBytes = Encoding.ASCII.GetBytes(plainText);
+ cryptoStream.Write(plainBytes, 0, plainBytes.Length);
+ cryptoStream.FlushFinalBlock();
+ var cipherBytes = memoryStream.ToArray();
+ memoryStream.Close();
+ cryptoStream.Close();
+ var cipherText = Convert.ToBase64String(cipherBytes, 0, cipherBytes.Length);
+ return cipherText;
+ }
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/ISipayPaymentIntegration.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/ISipayPaymentIntegration.cs
new file mode 100644
index 0000000..f33551a
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/ISipayPaymentIntegration.cs
@@ -0,0 +1,58 @@
+using Integration.Hub;
+using Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Request;
+using Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Response;
+
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration;
+
+public interface ISipayPaymentIntegration : IPaymentIntegration
+{
+
+ ///
+ /// Kullanıcı kart numarasının ilk 6 hanesini, tarım kartları için
+ /// kart numarasının tamamını girdiğinde, API çağrılmalıdır. getPos API,
+ /// ödeme sayfasındaki verilen kart numarasına göre taksit listesini,
+ /// tarım kartları için vade aralığını ve ödeme sıklığını sağlamaktan sorumludur.
+ ///
+ ///
+ Task CheckInstallmentsAsync(CheckInstallmentRequestModel checkInstallmentRequestModel);
+
+ ///
+ /// Sipay admini, üye işyeri web sitesinden yapılan ödemenin Non-Secure mi
+ /// yoksa 3D mi yapılması gerektiğine karar verecektir. Aşağıdaki istek,
+ /// üye iş yeri web sitesinden SiPay ödeme entegrasyon sistemine gönderilmelidir.
+ /// CURL post isteği, aşağıdaki parametrelerle SiPay'de alınmalıdır.
+ ///
+ ///
+ ///
+ Task NonSecurePaymentAsync(NonSecurePaymentRequestModel nonSecurePaymentRequestModel);
+
+ ///
+ /// Initial request to pay secure. This method returns html template.
+ /// You must render this template to your view.
+ ///
+ ///
+ ///
+ string SecurePaymentInitial(SecurePaymentInitialRequestModel securePaymentInitialRequestModel);
+
+
+ ///
+ /// Charge request to pay secure
+ ///
+ ///
+ ///
+ Task SecurePaymentChargeAsync(SecurePaymentChargeRequestModel securePaymentChargeRequestModel);
+
+ ///
+ /// Cancel payment request
+ ///
+ ///
+ ///
+ Task CancelAsync(CancellationRequestModel cancellationRequestModel);
+
+ ///
+ /// Refund payment request
+ ///
+ ///
+ ///
+ Task RefundAsync(RefundRequestModel refundRequestModel);
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/CancellationRequestModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/CancellationRequestModel.cs
new file mode 100644
index 0000000..3a53e8d
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/CancellationRequestModel.cs
@@ -0,0 +1,20 @@
+using Integration.Hub;
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Response;
+public class CancellationRequestModel : IRequestModel
+{
+ public CancellationRequestModel(string invoiceId, string hashKey, string refundTransactionId, string? refundWebhookKey = null)
+ {
+ InvoiceId = invoiceId;
+ HashKey = hashKey;
+ RefundTransactionId = refundTransactionId;
+ RefundWebhookKey = refundWebhookKey;
+ }
+
+ public string InvoiceId { get; set; }
+ public string AppId { get; set; }
+ public string AppSecret { get; set; }
+ public string MerchantKey { get; set; }
+ public string HashKey { get; set; }
+ public string RefundTransactionId { get; set; }
+ public string? RefundWebhookKey { get; set; }
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/CheckInstallmentRequestModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/CheckInstallmentRequestModel.cs
new file mode 100644
index 0000000..2b3ebba
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/CheckInstallmentRequestModel.cs
@@ -0,0 +1,23 @@
+using Integration.Hub;
+
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Request;
+public class CheckInstallmentRequestModel : IRequestModel
+{
+ public CheckInstallmentRequestModel(string creaditCard, double amount, string currenyCode, string? commissionBy = null, bool? isRecurring = null, bool? is_2d = null)
+ {
+ CreaditCard = creaditCard;
+ Amount = amount;
+ CurrenyCode = currenyCode;
+ CommissionBy = commissionBy;
+ IsRecurring = isRecurring;
+ Is_2d = is_2d;
+ }
+
+ public string CreaditCard { get; set; }
+ public double Amount { get; set; }
+ public string CurrenyCode { get; set; }
+ public string MerchantKey { get; set; }
+ public string? CommissionBy { get; set; }
+ public bool? IsRecurring { get; set; }
+ public bool? Is_2d { get; set; }
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/NonSecurePaymentRequestModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/NonSecurePaymentRequestModel.cs
new file mode 100644
index 0000000..ea45ce8
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/NonSecurePaymentRequestModel.cs
@@ -0,0 +1,67 @@
+using Integration.Hub;
+
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Request;
+
+public class NonSecurePaymentRequestModel : IRequestModel
+{
+ public NonSecurePaymentRequestModel(string ccHolderName, string ccNo, int expiryMonth, int expiryYear, int cvv, string currencyCode, int installmentsNumber, int invoiceId, string invoiceDescription, string name, string surname, int total, string items, string cancelUrl, string returnUrl, string hashKey, string ip, int orderType)
+ {
+ CCHolderName = ccHolderName;
+ CCNo = ccNo;
+ ExpiryMonth = expiryMonth;
+ ExpiryYear = expiryYear;
+ CVV = cvv;
+ CurrencyCode = currencyCode;
+ InstallmentsNumber = installmentsNumber;
+ InvoiceId = invoiceId;
+ InvoiceDescription = invoiceDescription;
+ Name = name;
+ Surname = surname;
+ Total = total;
+ Items = items;
+ CancelUrl = cancelUrl;
+ ReturnUrl = returnUrl;
+ HashKey = hashKey;
+ Ip = ip;
+ OrderType = orderType;
+ }
+
+ public string CCHolderName { get; set; }
+ public string CCNo { get; set; }
+ public int ExpiryMonth { get; set; }
+ public int ExpiryYear { get; set; }
+ public int CVV { get; set; }
+ public string CurrencyCode { get; set; }
+ public int InstallmentsNumber { get; set; }
+ public int InvoiceId { get; set; }
+ public string InvoiceDescription { get; set; }
+ public string Name { get; set; }
+ public string Surname { get; set; }
+ public int Total { get; set; }
+ public string MerchantKey { get; set; }
+ public string Items { get; set; }
+ public string CancelUrl { get; set; }
+ public string ReturnUrl { get; set; }
+ public string HashKey { get; set; }
+ public string Ip { get; set; }
+ public int OrderType { get; set; }
+ public int IsCommissionFromUser { get; set; }
+ public string CommissionBy { get; set; }
+ public string BillAddress1 { get; set; }
+ public string BillAddress2 { get; set; }
+ public string BillCity { get; set; }
+ public string BillPostcode { get; set; }
+ public string BillState { get; set; }
+ public string BillCountry { get; set; }
+ public string BillEmail { get; set; }
+ public string BillPhone { get; set; }
+ public string CardProgram { get; set; }
+ public string TransactionType { get; set; }
+ public string VposType { get; set; }
+ public string IdentityNumber { get; set; }
+ public string SaleWebHookKey { get; set; }
+ public int RecurringPaymentNumber { get; set; }
+ public string RecurringPaymentCycle { get; set; }
+ public string RecurringPaymentInterval { get; set; }
+ public string RecurringWebHookKey { get; set; }
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/RefundRequestModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/RefundRequestModel.cs
new file mode 100644
index 0000000..21d0e11
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/RefundRequestModel.cs
@@ -0,0 +1,22 @@
+using Integration.Hub;
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Response;
+public class RefundRequestModel : IRequestModel
+{
+ public RefundRequestModel(string invoiceId, double amount, string hashKey, string refundTransactionId, string? refundWebhookKey = null)
+ {
+ InvoiceId = invoiceId;
+ Amount = amount;
+ HashKey = hashKey;
+ RefundTransactionId = refundTransactionId;
+ RefundWebhookKey = refundWebhookKey;
+ }
+
+ public string InvoiceId { get; set; }
+ public double Amount { get; set; }
+ public string AppId { get; set; }
+ public string AppSecret { get; set; }
+ public string MerchantKey { get; set; }
+ public string HashKey { get; set; }
+ public string RefundTransactionId { get; set; }
+ public string? RefundWebhookKey { get; set; }
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/SecurePaymentChargeRequestModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/SecurePaymentChargeRequestModel.cs
new file mode 100644
index 0000000..f93e906
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/SecurePaymentChargeRequestModel.cs
@@ -0,0 +1,19 @@
+using Integration.Hub;
+
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Request;
+public class SecurePaymentChargeRequestModel : IRequestModel
+{
+ public SecurePaymentChargeRequestModel(string invoiceId, string orderId, string status, string hashKey)
+ {
+ InvoiceId = invoiceId;
+ OrderId = orderId;
+ Status = status;
+ HashKey = hashKey;
+ }
+
+ public string MerchantKey { get; set; }
+ public string InvoiceId { get; set; }
+ public string OrderId { get; set; }
+ public string Status { get; set; }
+ public string HashKey { get; set; }
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/SecurePaymentInitialRequestModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/SecurePaymentInitialRequestModel.cs
new file mode 100644
index 0000000..04947a2
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Request/SecurePaymentInitialRequestModel.cs
@@ -0,0 +1,73 @@
+using Integration.Hub;
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Request;
+public class SecurePaymentInitialRequestModel : IRequestModel
+{
+ public SecurePaymentInitialRequestModel(string ccHolderName, string ccNo, int expiryMonth, int expiryYear, int cvv, string currencyCode, int installmentsNumber, string invoiceId, string invoiceDescription, string name, string surname, double total, string items, string cancelUrl, string returnUrl, string hashKey, int orderType, int recurringPaymentNumber, string recurringPaymentCycle, string recurringPaymentInterval, string recurringWebHookKey, int maturityPeriod, int paymentFrequency)
+ {
+ CCHolderName = ccHolderName;
+ CCNo = ccNo;
+ ExpiryMonth = expiryMonth;
+ ExpiryYear = expiryYear;
+ Cvv = cvv;
+ CurrencyCode = currencyCode;
+ InstallmentsNumber = installmentsNumber;
+ InvoiceId = invoiceId;
+ InvoiceDescription = invoiceDescription;
+ Name = name;
+ Surname = surname;
+ Total = total;
+ Items = items;
+ CancelUrl = cancelUrl;
+ ReturnUrl = returnUrl;
+ HashKey = hashKey;
+ OrderType = orderType;
+ RecurringPaymentNumber = recurringPaymentNumber;
+ RecurringPaymentCycle = recurringPaymentCycle;
+ RecurringPaymentInterval = recurringPaymentInterval;
+ RecurringWebHookKey = recurringWebHookKey;
+ MaturityPeriod = maturityPeriod;
+ PaymentFrequency = paymentFrequency;
+ }
+
+ public string CCHolderName { get; set; }
+ public string CCNo { get; set; }
+ public int ExpiryMonth { get; set; }
+ public int ExpiryYear { get; set; }
+ public int Cvv { get; set; }
+ public string CurrencyCode { get; set; }
+ public int InstallmentsNumber { get; set; }
+ public string InvoiceId { get; set; }
+ public string InvoiceDescription { get; set; }
+ public string Name { get; set; }
+ public string Surname { get; set; }
+ public double Total { get; set; }
+ public string MerchantKey { get; set; }
+ public string Items { get; set; }
+ public string CancelUrl { get; set; }
+ public string ReturnUrl { get; set; }
+ public string HashKey { get; set; }
+ public int OrderType { get; set; }
+ public int RecurringPaymentNumber { get; set; }
+ public string RecurringPaymentCycle { get; set; }
+ public string RecurringPaymentInterval { get; set; }
+ public string RecurringWebHookKey { get; set; }
+ public int MaturityPeriod { get; set; }
+ public int PaymentFrequency { get; set; }
+
+ public string? IsCommissionFromUser { get; set; }
+ public string? CommissionBy { get; set; }
+ public string? BillAddress1 { get; set; }
+ public string? BillAddress2 { get; set; }
+ public string? BillCity { get; set; }
+ public string? BillPostcode { get; set; }
+ public string? BillState { get; set; }
+ public string? BillCountry { get; set; }
+ public string? BillEmail { get; set; }
+ public string? BillPhone { get; set; }
+ public string? CardProgram { get; set; }
+ public string? Ip { get; set; }
+ public string? TransactionType { get; set; }
+ public string? SaleWebHookKey { get; set; }
+ public string? PaymentCompletedBy { get; set; }
+ public string? ResponseMethod { get; set; }
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/CancellationResponseModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/CancellationResponseModel.cs
new file mode 100644
index 0000000..43630d1
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/CancellationResponseModel.cs
@@ -0,0 +1,6 @@
+using Integration.Hub;
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Response;
+public class CancellationResponseModel : IResponseModel
+{
+
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/CheckInstallmentResponseModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/CheckInstallmentResponseModel.cs
new file mode 100644
index 0000000..62ee5c0
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/CheckInstallmentResponseModel.cs
@@ -0,0 +1,6 @@
+using Integration.Hub;
+
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Response;
+public class CheckInstallmentResponseModel : IResponseModel
+{
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/NonSecurePaymentResponseModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/NonSecurePaymentResponseModel.cs
new file mode 100644
index 0000000..038386c
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/NonSecurePaymentResponseModel.cs
@@ -0,0 +1,15 @@
+using Integration.Hub;
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Request;
+public class NonSecurePaymentResponseModel : IResponseModel
+{
+ public int Status { get; set; }
+ public string OrderNo { get; set; }
+ public int InvoiceId { get; set; }
+ public int StatusCode { get; set; }
+ public string StatusDescription { get; set; }
+ public string PaymentMethod { get; set; }
+ public string TransactionType { get; set; }
+ public int ErrorCode { get; set; }
+ public string Error { get; set; }
+ public string HashKey { get; set; }
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/RefundResponseModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/RefundResponseModel.cs
new file mode 100644
index 0000000..e8c0a8d
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/RefundResponseModel.cs
@@ -0,0 +1,6 @@
+using Integration.Hub;
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Response;
+public class RefundResponseModel : IResponseModel
+{
+
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/SecurePaymentChargeResponseModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/SecurePaymentChargeResponseModel.cs
new file mode 100644
index 0000000..6355cdf
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/SecurePaymentChargeResponseModel.cs
@@ -0,0 +1,6 @@
+using Integration.Hub;
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Response;
+public class SecurePaymentChargeResponseModel : IResponseModel
+{
+
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/SecurePaymentInitialResponseModel.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/SecurePaymentInitialResponseModel.cs
new file mode 100644
index 0000000..da3a82b
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Models/Response/SecurePaymentInitialResponseModel.cs
@@ -0,0 +1,6 @@
+using Integration.Hub;
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Response;
+public class SecurePaymentInitialResponseModel : IResponseModel
+{
+
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Resources/HTML/3ds-payment-form.cshtml b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Resources/HTML/3ds-payment-form.cshtml
new file mode 100644
index 0000000..63acb6a
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/Resources/HTML/3ds-payment-form.cshtml
@@ -0,0 +1,10 @@
+
+
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/SipayPaymentIntegration.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/SipayPaymentIntegration.cs
new file mode 100644
index 0000000..bbe9038
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/PaymentIntegration/SipayPaymentIntegration.cs
@@ -0,0 +1,101 @@
+using Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Helpers;
+using Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Request;
+using Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration.Models.Response;
+using Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration;
+using System.ComponentModel;
+
+public class SipayPaymentIntegration : SipayIntegrationBase, ISipayPaymentIntegration
+{
+ private string GetCheckInstallmentsUrl() => $"{GetBaseUrl()}api/getpos";
+ private string GetNonSecurePaymentUrl() => $"{GetBaseUrl()}api/paySmart2D";
+ private string GetSecurePaymentInitialUrl() => $"{GetBaseUrl()}api/paySmart3D";
+ private string GetSecurePaymentChargeUrl() => $"{GetBaseUrl()}api/complete";
+ private string GetRefundUrl() => $"{GetBaseUrl()}api/refund";
+ private string GetCancelUrl() => $"{GetBaseUrl()}api/refund";
+
+ public SipayPaymentIntegration(string merchantKey, string appKey, string appSecret, int merchantId, bool isInProduction = true) : base(merchantKey, appKey, appSecret, merchantId, isInProduction)
+ {
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task CheckInstallmentsAsync(CheckInstallmentRequestModel checkInstallmentRequestModel)
+ {
+ checkInstallmentRequestModel.MerchantKey = _merchantKey;
+ return await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetCheckInstallmentsUrl(), requestBody), checkInstallmentRequestModel);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task NonSecurePaymentAsync(NonSecurePaymentRequestModel nonSecurePaymentRequestModel)
+ {
+ nonSecurePaymentRequestModel.MerchantKey = _merchantKey;
+ return await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetNonSecurePaymentUrl(), requestBody), nonSecurePaymentRequestModel);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string SecurePaymentInitial(SecurePaymentInitialRequestModel securePaymentInitialRequestModel)
+ {
+ securePaymentInitialRequestModel.MerchantKey = _merchantKey;
+
+ //Generate hashkey
+ var hashKey = HashHelper.GenerateHashKey(securePaymentInitialRequestModel.Total.ToString(), securePaymentInitialRequestModel.InstallmentsNumber.ToString(), securePaymentInitialRequestModel.CurrencyCode, securePaymentInitialRequestModel.MerchantKey, securePaymentInitialRequestModel.InvoiceId, _appSecret);
+
+ //Add hash key to dto
+ securePaymentInitialRequestModel.HashKey = hashKey;
+
+ //Generate template
+ var template = HTMLHelper.GenerateTemplate("3ds-payment-form", "Resources/HTML", securePaymentInitialRequestModel);
+ return template;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task SecurePaymentChargeAsync(SecurePaymentChargeRequestModel securePaymentChargeRequestModel)
+ {
+ securePaymentChargeRequestModel.MerchantKey = _merchantKey;
+
+ return await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetSecurePaymentChargeUrl(), requestBody), securePaymentChargeRequestModel);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task CancelAsync(CancellationRequestModel cancellationRequestModel)
+ {
+ cancellationRequestModel.MerchantKey = _merchantKey;
+ cancellationRequestModel.AppSecret = _appSecret;
+ cancellationRequestModel.AppId = _appKey;
+
+ return await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetCancelUrl(), requestBody), cancellationRequestModel);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task RefundAsync(RefundRequestModel refundRequestModel)
+ {
+ refundRequestModel.MerchantKey = _merchantKey;
+ refundRequestModel.AppSecret = _appSecret;
+ refundRequestModel.AppId = _appKey;
+
+ return await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetRefundUrl(), requestBody), refundRequestModel);
+ }
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/SipayIntegrationBase.cs b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/SipayIntegrationBase.cs
new file mode 100644
index 0000000..9011b54
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Infrastructure/SipayIntegrationBase.cs
@@ -0,0 +1,35 @@
+using System.Text.Json;
+using Integration.Hub;
+
+namespace Integration.PaymentGateways.Sipay.Infrastructure.PaymentIntegration;
+public class SipayIntegrationBase : IntegrationBase
+{
+ public const string ProdBaseUrl = "https://app.sipay.com.tr/ccpayment/";
+ public const string StageBaseUrl = "https://provisioning.sipay.com.tr/ccpayment/";
+ protected readonly string _merchantKey;
+ protected readonly string _appKey;
+ protected readonly string _appSecret;
+ protected readonly int _merchantId;
+ protected readonly bool _isInProduction;
+
+ public SipayIntegrationBase(string merchantKey, string appKey, string appSecret, int merchantId, bool isInProduction = true)
+ {
+ _merchantKey = merchantKey ?? throw new ArgumentNullException(nameof(merchantKey));
+ _appKey = appKey ?? throw new ArgumentNullException(nameof(appKey));
+ _appSecret = appSecret ?? throw new ArgumentNullException(nameof(appSecret));
+ _merchantId = merchantId;
+ _isInProduction = isInProduction;
+
+ IntializeDefaultHeaders(new Dictionary
+ {
+ { "Accept", "application/json" },
+ });
+
+ SetSerializerOptions(new JsonSerializerOptions
+ {
+ PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
+ });
+ }
+
+ public string GetBaseUrl() => _isInProduction ? ProdBaseUrl : StageBaseUrl;
+}
\ No newline at end of file
diff --git a/src/PaymentGateways/Integration.PaymentGateways.Sipay/Integration.PaymentGateways.Sipay.csproj b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Integration.PaymentGateways.Sipay.csproj
new file mode 100644
index 0000000..98e55d5
--- /dev/null
+++ b/src/PaymentGateways/Integration.PaymentGateways.Sipay/Integration.PaymentGateways.Sipay.csproj
@@ -0,0 +1,23 @@
+
+
+
+ net8.0
+ enable
+ enable
+ Integration.PaymentGateways.Sipay
+ 1.0.0
+ onurkanbakirci
+ onurkanbakirci
+ https://github.com/onurkanbakirci/Integration
+ git
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file