From 99f62919e4f1f160fa83dfb9b903ad9691689687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaan=20Sa=C4=9Flam?= Date: Tue, 25 Mar 2025 20:58:18 +0300 Subject: [PATCH 1/9] added release workflow --- .github/workflows/release.yml | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..22d44c3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +name: Publish NuGet Package + +on: + push: + branches: + - master + paths: + - 'src/**' + - '*.csproj' + workflow_dispatch: + +jobs: + publish: + name: Publish to NuGet + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup .NET SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: | + 5.0.x + 6.0.x + 7.0.x + 8.0.x + + - name: Get current version + id: get_version + run: | + VERSION=$(grep -oP '(?<=).*?(?=)' *.csproj) + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Pack + run: dotnet pack --configuration Release --no-build --output ./artifacts + + - name: Push to NuGet + run: | + dotnet nuget push ./artifacts/*.nupkg \ + --source https://api.nuget.org/v3/index.json \ + --api-key ${{ secrets.NUGET_API_KEY }} \ + --skip-duplicate + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} \ No newline at end of file From 5b65f0ac88df6dcbaba8eb6154510a7c404b17d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enes=20Selman=20T=C3=BCt=C3=BCnc=C3=BC?= <165418122+enespaywall@users.noreply.github.com> Date: Tue, 25 Mar 2025 21:19:49 +0300 Subject: [PATCH 2/9] Feature/pw 3198 (#3) * Update test panel and API URLs in README and ServiceCollectionExtensions * version upgraded --- README.md | 2 +- src/PayWall.NetCore/PayWall.NetCore.csproj | 2 +- src/PayWall.NetCore/ServiceCollectionExtensions.cs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bfe260a..fece33d 100644 --- a/README.md +++ b/README.md @@ -198,6 +198,6 @@ Paketi yükledikten sonra `appsettings.json` içinde `PayWall` kısmının oldu - **PayWall Entegrasyon Dökümanı:** [https://developer.paywall.one/](https://developer.paywall.one/) - **Website:** [https://paywall.one/](https://paywall.one/) -- **Test Paneli:** [https://dev-panel.itspaywall.com/](https://dev-panel.itspaywall.com/) +- **Test Paneli:** [https://test-panel.itspaywall.com/](https://test-panel.itspaywall.com/) - **Canlı Panel(Global):** [https://panel.itspaywall.com/](https://panel.itspaywall.com/) - **Canlı Panel(Turkey):** [https://panel.paywall.com.tr/](https://panel.paywall.com.tr/) diff --git a/src/PayWall.NetCore/PayWall.NetCore.csproj b/src/PayWall.NetCore/PayWall.NetCore.csproj index 462641a..8c9b5ab 100644 --- a/src/PayWall.NetCore/PayWall.NetCore.csproj +++ b/src/PayWall.NetCore/PayWall.NetCore.csproj @@ -4,7 +4,7 @@ net5.0;net6.0;net7.0;net8.0 PayWall PayWall.NetCore - 0.0.5 + 0.0.6 PayWall.NetCore disable disable diff --git a/src/PayWall.NetCore/ServiceCollectionExtensions.cs b/src/PayWall.NetCore/ServiceCollectionExtensions.cs index e28bcad..1553ac1 100644 --- a/src/PayWall.NetCore/ServiceCollectionExtensions.cs +++ b/src/PayWall.NetCore/ServiceCollectionExtensions.cs @@ -23,13 +23,13 @@ public static class ServiceCollectionExtensions #region Private Properties // Global private static Uri ProdPaymentApiUrlGCP => new("https://payment-api.itspaywall.com/api/paywall/"); - private static Uri TestPaymentApiUrlGCP => new("https://dev-payment-api.itspaywall.com/api/paywall/"); + private static Uri TestPaymentApiUrlGCP => new("https://test-payment-api.itspaywall.com/api/paywall/"); private static Uri ProdPaymentPrivateApiUrlGCP => new("https://payment-private-api.itspaywall.com/api/paywall/"); - private static Uri TestPaymentPrivateApiUrlGCP => new("https://dev-payment-private-api.itspaywall.com/api/paywall/"); + private static Uri TestPaymentPrivateApiUrlGCP => new("https://test-payment-private-api.itspaywall.com/api/paywall/"); private static Uri ProdCardWallApiUrlGCP => new("https://card-api.itspaywall.com/paywall/"); - private static Uri TestCardWallApiUrlGCP => new("https://dev-card-api.itspaywall.com/paywall/"); + private static Uri TestCardWallApiUrlGCP => new("https://test-card-api.itspaywall.com/paywall/"); private static Uri ProdMemberApiUrlGCP => new("https://member-api.itspaywall.com/api/paywall/"); - private static Uri TestMemberApiUrlGCP => new("https://dev-member-api.itspaywall.com/api/paywall/"); + private static Uri TestMemberApiUrlGCP => new("https://test-member-api.itspaywall.com/api/paywall/"); // Turkey From 2c7b3167fa4150f629563ac27fd9c15256d38152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaan=20Sa=C4=9Flam?= Date: Tue, 25 Mar 2025 21:23:21 +0300 Subject: [PATCH 3/9] find csproj --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 22d44c3..eabb3d4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,7 +30,7 @@ jobs: - name: Get current version id: get_version run: | - VERSION=$(grep -oP '(?<=).*?(?=)' *.csproj) + VERSION=$(find . -name "*.csproj" -exec grep -oP '(?<=).*?(?=)' {} + | head -n 1) echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Restore dependencies From d4d5de15a7abd790fb33f9639e381f244581174b Mon Sep 17 00:00:00 2001 From: yigitcizmeci Date: Tue, 29 Apr 2025 23:41:39 +0300 Subject: [PATCH 4/9] PaymentRequest.cs InquiryValue => IdentityNumber --- src/PayWall.NetCore/Models/Request/Payment/PaymentRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PayWall.NetCore/Models/Request/Payment/PaymentRequest.cs b/src/PayWall.NetCore/Models/Request/Payment/PaymentRequest.cs index 0483048..74f4f2d 100644 --- a/src/PayWall.NetCore/Models/Request/Payment/PaymentRequest.cs +++ b/src/PayWall.NetCore/Models/Request/Payment/PaymentRequest.cs @@ -245,7 +245,7 @@ public class CardInsurance /// [StringLength(20)] [Required] - public string InquiryValue { get; set; } + public string IdentityNumber { get; set; } /// /// Ödemenin alınacağı kartın son kullanma tarihi ayı. From 9a325bd5504d6fee077d034a84b26ba821a6a954 Mon Sep 17 00:00:00 2001 From: enespaywall Date: Tue, 29 Apr 2025 23:55:45 +0300 Subject: [PATCH 5/9] bump version to 0.0.7 --- src/PayWall.NetCore/PayWall.NetCore.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PayWall.NetCore/PayWall.NetCore.csproj b/src/PayWall.NetCore/PayWall.NetCore.csproj index 8c9b5ab..d7a3263 100644 --- a/src/PayWall.NetCore/PayWall.NetCore.csproj +++ b/src/PayWall.NetCore/PayWall.NetCore.csproj @@ -4,7 +4,7 @@ net5.0;net6.0;net7.0;net8.0 PayWall PayWall.NetCore - 0.0.6 + 0.0.7 PayWall.NetCore disable disable From ce45a8ccdea6d57b1e56790a41ca1a33c77a1d10 Mon Sep 17 00:00:00 2001 From: enespaywall Date: Thu, 15 May 2025 19:07:43 +0300 Subject: [PATCH 6/9] add PaywallService registration to ServiceCollectionExtensions --- src/PayWall.NetCore/ServiceCollectionExtensions.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/PayWall.NetCore/ServiceCollectionExtensions.cs b/src/PayWall.NetCore/ServiceCollectionExtensions.cs index 1553ac1..e465821 100644 --- a/src/PayWall.NetCore/ServiceCollectionExtensions.cs +++ b/src/PayWall.NetCore/ServiceCollectionExtensions.cs @@ -54,6 +54,19 @@ public static void AddPaywallService(this IServiceCollection services, IConfigur .AddMemberApiClient(payWallOptions, handlerFactories) .AddTransient(); } + + public static void AddPaywallService( + this IServiceCollection services, + PayWallOptions payWallOptions, + params Func[] handlerFactories) + { + services + .AddPaymentApiClient(payWallOptions, handlerFactories) + .AddPaymentPrivateApiClient(payWallOptions, handlerFactories) + .AddCardWallApiClient(payWallOptions, handlerFactories) + .AddMemberApiClient(payWallOptions, handlerFactories) + .AddTransient(); + } #endregion #region Private Methods From 88a227d42093cc7eefd7643c603aaee0f3060fa1 Mon Sep 17 00:00:00 2001 From: enespaywall Date: Thu, 15 May 2025 19:11:23 +0300 Subject: [PATCH 7/9] bump version to 0.0.8 --- src/PayWall.NetCore/PayWall.NetCore.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PayWall.NetCore/PayWall.NetCore.csproj b/src/PayWall.NetCore/PayWall.NetCore.csproj index d7a3263..917e454 100644 --- a/src/PayWall.NetCore/PayWall.NetCore.csproj +++ b/src/PayWall.NetCore/PayWall.NetCore.csproj @@ -4,7 +4,7 @@ net5.0;net6.0;net7.0;net8.0 PayWall PayWall.NetCore - 0.0.7 + 0.0.8 PayWall.NetCore disable disable From 5717769cf0647b7b1ecd34fb583f2acf21341e5d Mon Sep 17 00:00:00 2001 From: ceyda <54938901+ceydatekin@users.noreply.github.com> Date: Fri, 16 May 2025 10:06:46 +0300 Subject: [PATCH 8/9] add newline at end of Error.cs (#9) --- src/PayWall.NetCore/Models/Common/Error.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PayWall.NetCore/Models/Common/Error.cs b/src/PayWall.NetCore/Models/Common/Error.cs index deedc9e..07d11c4 100644 --- a/src/PayWall.NetCore/Models/Common/Error.cs +++ b/src/PayWall.NetCore/Models/Common/Error.cs @@ -3,6 +3,7 @@ public class Error { public int Code { get; set; } + public string Message { get; set; } } } \ No newline at end of file From f00d5bcffa8e47bf0be54622104141cd380f35e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaan=20Sa=C4=9Flam?= Date: Fri, 16 May 2025 10:07:56 +0300 Subject: [PATCH 9/9] Infra/deploy rules (#8) * edited pipeline * typo * typo * removed sensitive data --- .github/workflows/release.yml | 109 +++++++++++------- .github/workflows/sonarqube.yml | 36 ++++++ azure-pipelines-triggers.yml | 19 --- .../appsettings.Development.json | 8 +- 4 files changed, 107 insertions(+), 65 deletions(-) create mode 100644 .github/workflows/sonarqube.yml delete mode 100644 azure-pipelines-triggers.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eabb3d4..747ff49 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,13 +1,17 @@ name: Publish NuGet Package -on: - push: - branches: - - master - paths: - - 'src/**' - - '*.csproj' - workflow_dispatch: +# on: +# push: +# branches: +# - master +# paths: +# - 'src/**' +# - '*.csproj' +# workflow_dispatch: + +on: + workflow_dispatch: + jobs: publish: @@ -15,38 +19,59 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Check Team Membership + id: check_team + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_SECRET }} + TEAM_SLUG: 'reviewers' + ORG_NAME: 'paywallone' + run: | + ACTOR="${{ github.actor }}" + TEAM_MEMBERSHIP_RESPONSE=$(curl -s \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/orgs/$ORG_NAME/teams/$TEAM_SLUG/memberships/$ACTOR") + echo "$TEAM_MEMBERSHIP_RESPONSE" + if echo "$TEAM_MEMBERSHIP_RESPONSE" | grep -q '"state": "active"'; then + echo "Actor $ACTOR is a member of the team." + echo "::set-output name=is_member::true" + else + echo "Actor $ACTOR is NOT a member of the team." + echo "::set-output name=is_member::false" + exit 1 + fi + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup .NET SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: | + 5.0.x + 6.0.x + 7.0.x + 8.0.x - - name: Setup .NET SDK - uses: actions/setup-dotnet@v3 - with: - dotnet-version: | - 5.0.x - 6.0.x - 7.0.x - 8.0.x - - - name: Get current version - id: get_version - run: | - VERSION=$(find . -name "*.csproj" -exec grep -oP '(?<=).*?(?=)' {} + | head -n 1) - echo "version=$VERSION" >> $GITHUB_OUTPUT - - - name: Restore dependencies - run: dotnet restore - - - name: Build - run: dotnet build --configuration Release --no-restore - - - name: Pack - run: dotnet pack --configuration Release --no-build --output ./artifacts - - - name: Push to NuGet - run: | - dotnet nuget push ./artifacts/*.nupkg \ - --source https://api.nuget.org/v3/index.json \ - --api-key ${{ secrets.NUGET_API_KEY }} \ - --skip-duplicate - env: - NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} \ No newline at end of file + - name: Get current version + id: get_version + run: | + VERSION=$(find . -name "*.csproj" -exec grep -oP '(?<=).*?(?=)' {} + | head -n 1) + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Pack + run: dotnet pack --configuration Release --no-build --output ./artifacts + + - name: Push to NuGet + run: | + dotnet nuget push ./artifacts/*.nupkg \ + --source https://api.nuget.org/v3/index.json \ + --api-key ${{ secrets.NUGET_API_KEY }} \ + --skip-duplicate + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} \ No newline at end of file diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml new file mode 100644 index 0000000..801f489 --- /dev/null +++ b/.github/workflows/sonarqube.yml @@ -0,0 +1,36 @@ +name: SonarQube Analysis + +on: + schedule: + - cron: '0 6 * * 1' # Her Pazartesi saat 06:00'da çalıştır + workflow_dispatch: # Manuel çalıştırmak için +env: + ACCESS_TOKEN: ${{ secrets.AZURE_ARTIFACTS_ACCESSTOKEN }} + ACCESS_TOKEN_HANGFIRE: ${{ secrets.ACCESS_TOKEN_HANGFIRE }} + +jobs: + sonarqube: + name: SonarQube Code Analysis + runs-on: [self-hosted, pw-hc-runner] # Runner etiketi burada doğru olmalı + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # SonarQube'un analiz için tüm geçmişe ihtiyacı olabilir + + - name: Install .NET SDK + run: | + echo ${{ github.event.repository.name }} + sudo dnf install -y dotnet-sdk-8.0 # Versiyon ihtiyacına göre değiştir + + - name: Install SonarScanner for .NET + run: | + dotnet tool update --global dotnet-sonarscanner + + - name: Run SonarQube Analysis + run: | + export PATH="$HOME/.dotnet/tools:$PATH" + dotnet-sonarscanner begin /k:"${{ github.event.repository.name }}" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" + dotnet build + dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" \ No newline at end of file diff --git a/azure-pipelines-triggers.yml b/azure-pipelines-triggers.yml deleted file mode 100644 index 2119857..0000000 --- a/azure-pipelines-triggers.yml +++ /dev/null @@ -1,19 +0,0 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml. - -trigger: -- master - -pool: - vmImage: ubuntu-latest - -steps: -- script: echo Hello, world! - displayName: 'Run a one-line script' - -- script: | - echo Add other tasks to build, test, and deploy your project. - echo See https://aka.ms/yaml - displayName: 'Run a multi-line script' \ No newline at end of file diff --git a/src/PayWall.NetCore.Example/appsettings.Development.json b/src/PayWall.NetCore.Example/appsettings.Development.json index f071485..17ce113 100644 --- a/src/PayWall.NetCore.Example/appsettings.Development.json +++ b/src/PayWall.NetCore.Example/appsettings.Development.json @@ -8,9 +8,9 @@ "PayWall" : { "Prod": false, "DataCenter": "Global", - "PublicClient": "f375fd2c-b9d7-4560-8e14-0c0ac46b1830", - "PublicKey": "P19sW+ewdl6Bn7LqrCnJudy4H3mOj4kWJewc4JhwIRMQwnmSolP+h67te+DjrfB22QWfQKguo53zLAdA5OAxioqSHZzxZ5w39xP8VlkHq+d8dt54lyT5AXiTR9P6T0uW3U7O15Mi8+N69KhAcwC3qZQLaQhwhqHKYMXmZ2meV9V5bsa+9b0r+1Z4JGYd3ihRZt7O/r7qoFqlQagM23h5C2eL+eWPWLQBHDKVFmLUBvn5xc90iujGGFFgwTqK014f9B1cV81N2CQKS2bT7HEODnAYWCOogEctY9hZ11ADAYSlHaDK0LQ9uZ/FeW0726SHdd5EvP6XO2XuVVPWQZESag==", - "PrivateClient": "f6582612-a350-476c-b047-e5d7de8ae6e0", - "PrivateKey": "LHdOYHEfC3Guzp/eD6wrnd9xjNqzcS0C0OIU1drC/HGOuBsPFy3HQSv1ETay/LcRthG4Lnneo7yUuUZS78y0sZpqZQs8yX4DPSnD4gQ7EVTciIgpZppZzLK100xkFMbjhZWzyXuVg/TLyVwqybRm95eOMKjMLxc2TX0xo4rID7sY1yrfxHhzP/lZYqqAItijFlHBBW7kxVaACFme/1y/ubX1BwMcIR7h1Xejvh46EmU3xALiPCvDla8sjjLE2gdCzprBkFCD4aIrtp91n6BUbHYHTt/Dcg773E3IQyOo+61harGAydrQiNJEpqYrESzpB0b2Qd+dMUX4ZQMXFFtDAg==" + "PublicClient": "", + "PublicKey": "", + "PrivateClient": "", + "PrivateKey": "" } } \ No newline at end of file