Skip to content

Commit

Permalink
balance nuget file added
Browse files Browse the repository at this point in the history
  • Loading branch information
mElzantot committed Jun 12, 2024
1 parent a67e4c3 commit 5cfb2c2
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 8 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/balance-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Deploy to NuGet"

on:
workflow_dispatch:
push:
branches:
- main

env:
PROJECT_PATH: "src/Balance/SubsBase.SDK.Balance.csproj"
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}/output
NUGET_SOURCE_URL: 'https://api.nuget.org/v3/index.json'

jobs:
deploy:
name: 'Deploy'
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout'
uses: actions/checkout@v2

- name: 'Install dotnet'
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.x'

- name: 'Restore packages'
run: dotnet restore ${{ env.PROJECT_PATH }}

- name: 'Build project'
run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release

- name: 'Get version'
uses: kzrnm/[email protected]
id: get-version
with:
proj-path: ${{ env.PROJECT_PATH }}

- name: 'Get package name'
id: get-package-name
run: echo "::set-output name=package-name::SubsBaseBalance.${{ steps.get-version.outputs.version }}"

- name: 'Pack project'
run: dotnet pack ${{ env.PROJECT_PATH }} --no-restore --no-build --configuration Release --include-symbols -p:PackageVersion=${{ steps.get-version.outputs.version }} --output ${{ env.PACKAGE_OUTPUT_DIRECTORY }}

- name: 'Push package'
run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/${{ steps.get-package-name.outputs.package-name }}.nupkg -k ${{ secrets.NUGET_AUTH_TOKEN }} -s ${{ env.NUGET_SOURCE_URL }}

3 changes: 1 addition & 2 deletions src/Balance/SubsBase.SDK.Balance/Contracts/BalanceDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ namespace SubsBase.SDK.Balance.Contracts;
public class BalanceDetails
{
public Guid Id { get; set; }
public decimal Amount { get; set; }
public decimal Total { get; set; }
public DateTime? Expiry { get; set; }

public Guid BalanceId { get; set; }
public BalanceInfo? BalanceInfo { get; set; }
}
20 changes: 14 additions & 6 deletions src/Balance/SubsBase.SDK.Balance/Contracts/BalanceInfo.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
using System.Text.Json.Serialization;

namespace SubsBase.SDK.Balance.Contracts;

public class BalanceInfo
{
public Guid Id { get; set; }
public string Unit { get; set; } = string.Empty;
public Dictionary<string, object>? Metadata { get; set; }

public List<BalanceMovement>? BalanceMovements { get; set; }
public List<BalanceDetails>? BalanceDetails { get; set; }
public List<BalanceHold>? BalanceHolds { get; set; }
}

public class BalanceInfoNew
{
public string Unit { get; set; } = string.Empty;
public Dictionary<string, object>? Metadata { get; set; }
[JsonPropertyName("allowTotalBalanceToBeNegative")] public bool AllowTotalBalanceToBeNegative { get; set; } = false;
[JsonPropertyName("metadata")] public Dictionary<string, string>? Metadata { get; set; }
[JsonPropertyName("unit")] public string Unit { get; set; } = string.Empty;
}


public class BalanceInfoUpdate
{
public Dictionary<string, object>? Metadata { get; set; }
[JsonPropertyName("metadata")] public Dictionary<string, object>? Metadata { get; set; }
}

public class BalanceSummary
{
[JsonPropertyName("balanceId")] public Guid BalanceId { get; set; }
[JsonPropertyName("totalAmount")] public decimal TotalAmount { get; set; }
[JsonPropertyName("onHoldAmount")] public decimal OnHoldAmount { get; set; }
[JsonPropertyName("availableAmount")] public decimal AvailableAmount { get; set; }
}

0 comments on commit 5cfb2c2

Please sign in to comment.