diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..747ff49 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,77 @@ +name: Publish NuGet Package + +# on: +# push: +# branches: +# - master +# paths: +# - 'src/**' +# - '*.csproj' +# workflow_dispatch: + +on: + workflow_dispatch: + + +jobs: + publish: + name: Publish to NuGet + runs-on: ubuntu-latest + + steps: + - 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: 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/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/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 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 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ı. diff --git a/src/PayWall.NetCore/PayWall.NetCore.csproj b/src/PayWall.NetCore/PayWall.NetCore.csproj index 462641a..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.5 + 0.0.8 PayWall.NetCore disable disable diff --git a/src/PayWall.NetCore/ServiceCollectionExtensions.cs b/src/PayWall.NetCore/ServiceCollectionExtensions.cs index e28bcad..e465821 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 @@ -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