Skip to content

Commit

Permalink
Include payloads. Full and checked currencies
Browse files Browse the repository at this point in the history
  • Loading branch information
eyonys committed Sep 10, 2023
1 parent fcad658 commit 076a7aa
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 15 deletions.
13 changes: 13 additions & 0 deletions NowPayments.Net.Objects/CurrenciesList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,17 @@ public class CurrenciesList
[JsonPropertyName("currencies")]
public List<string>? Currencies { get; set; }
}

public class FullCurrenciesList

{
[JsonPropertyName("currencies")]
public List<Currency>? Currencies { get; set; }
}

public class CheckedCurrenciesList
{
[JsonPropertyName("selectedCurrencies")]
public List<string>? Currencies { get; set; }
}
}
52 changes: 52 additions & 0 deletions NowPayments.Net.Objects/Currency.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System.Text.Json.Serialization;

namespace NowPayments.Net.Objects
{
public class Currency
{
[JsonPropertyName("id")]
public int Id { get; set; }
[JsonPropertyName("code")]
public string? Code { get; set; }
[JsonPropertyName("name")]
public string? Name { get; set; }
[JsonPropertyName("enable")]
public bool Enable { get; set; }
[JsonPropertyName("wallet_regex")]
public string? WalletRegex { get; set; }
[JsonPropertyName("priority")]
public int Priority { get; set; }
[JsonPropertyName("extra_id_exists")]
public bool ExtraIdExists { get; set; }
[JsonPropertyName("extra_id_regex")]
public string? ExtraIdRegex { get; set; }
[JsonPropertyName("logo_url")]
public string? LogoUrl { get; set; }
[JsonPropertyName("track")]
public bool Track { get; set; }
[JsonPropertyName("cg_id")]
public string? CgId { get; set; }
[JsonPropertyName("is_maxlimit")]
public bool IsMaxlimit { get; set; }
[JsonPropertyName("network")]
public string? Network { get; set; }
[JsonPropertyName("smart_contract")]
public string? SmartContract { get; set; }
[JsonPropertyName("network_precision")]
public string? NetworkPrecision { get; set; }
[JsonPropertyName("explorer_link_hash")]
public string? ExplorerLinkHash { get; set; }
[JsonPropertyName("precision")]
public int Precision { get; set; }
[JsonPropertyName("ticker")]
public string? Ticker { get; set; }
[JsonPropertyName("is_defi")]
public bool IsDefi { get; set; }
[JsonPropertyName("is_popular")]
public bool IsPopular { get; set; }
[JsonPropertyName("is_stable")]
public bool IsStable { get; set; }
[JsonPropertyName("available_for_to_conversion")]
public bool AvailableForToConversion { get; set; }
}
}
4 changes: 2 additions & 2 deletions NowPayments.Net.Objects/NowPayments.Net.Objects.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<PackageProjectUrl>https://github.com/compila-ltd/NowPayments.Net.Objects</PackageProjectUrl>
<RepositoryUrl>https://github.com/compila-ltd/NowPayments.Net.Objects</RepositoryUrl>
<PackageId>NowPayments.Net.Objects</PackageId>
<Version>1.0.1</Version>
<Version>1.0.2</Version>
<Authors>Eyonys Gonzalez Marcaida</Authors>
<Company>Compila</Company>
<PackageDescription>Objects library related to NowPayments Api.</PackageDescription>
Expand All @@ -46,6 +46,6 @@
</ItemGroup>
<ItemGroup>
<!-- Add a README.md next to the csproj -->
<None Include="README.md" Pack="true" PackagePath="..\"/>
<None Include="README.md" Pack="true" PackagePath="..\" />
</ItemGroup>
</Project>
13 changes: 0 additions & 13 deletions NowPayments.Net.Objects/Payment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public class Payment
{
[JsonPropertyName("payment_id")]
public long PaymentId { get; set; }

[JsonPropertyName("invoice_id")]
public string? InvoiceId { get; set; }
[JsonPropertyName("payin_extra_id")]
Expand All @@ -27,40 +26,28 @@ public class Payment
public string? Type { get; set; }
[JsonPropertyName("payment_extra_ids")]
public List<long>? PaymentExtraIds { get; set; }

[JsonPropertyName("payment_status")]
public string? PaymentStatus { get; set; }

[JsonPropertyName("pay_address")]
public string? PayAddress { get; set; }

[JsonPropertyName("price_amount")]
public decimal PriceAmount { get; set; }

[JsonPropertyName("price_currency")]
public string? PriceCurrency { get; set; }

[JsonPropertyName("pay_amount")]
public decimal PayAmount { get; set; }

[JsonPropertyName("actually_paid")]
public decimal ActuallyPaid { get; set; }

[JsonPropertyName("pay_currency")]
public string? PayCurrency { get; set; }

[JsonPropertyName("created_at")]
public DateTime CreatedAt { get; set; }

[JsonPropertyName("updated_at")]
public DateTime UpdatedAt { get; set; }

[JsonPropertyName("purchase_id")]
public long PurchaseId { get; set; }

[JsonPropertyName("outcome_currency")]
public string? OutcomeCurrency { get; set; }

[JsonPropertyName("outcome_amount")]
public decimal OutcomeAmount { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;

namespace NowPayments.Net.Objects.RequestPayload
{
internal class AuthenticationRequestPayload
{
[JsonPropertyName("email")]
public string Email { get; set; } = string.Empty;
[JsonPropertyName("password")]
public string Password { get; set; } = string.Empty;
}
}
49 changes: 49 additions & 0 deletions NowPayments.Net.Objects/RequestPayload/PaymentRequestPayload.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;

namespace NowPayments.Net.Objects.RequestPayload
{
public class PaymentRequestPayload
{
[JsonPropertyName("price_amount")]
public decimal PriceAmount { get; set; }
[JsonPropertyName("price_currency")]
public string PriceCurrency { get; set; } = "usd";
[JsonPropertyName("pay_amount")]
public decimal PayAmount { get; set; }
[JsonPropertyName("pay_currency")]
public string PayCurrency { get; set; } = "btc";
[JsonPropertyName("ipn_callback_url")]
public string? IPNCallbackUrl { get; set; }
[JsonPropertyName("order_id")]
public string? OrderId { get; set; }
[JsonPropertyName("order_description")]
public string? OrderDescription { get; set; }
[JsonPropertyName("purchase_id")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public long PurchaseId { get; set; } = 0;
[JsonPropertyName("payout_address")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? PayoutAddress { get; set; }
[JsonPropertyName("payout_currency")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? PayoutCurrency { get; set; }
[JsonPropertyName("payout_extra_id")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? PayoutExtraId { get; set; }
[JsonPropertyName("is_fixed_rate")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool IsFixedRate { get; set; } = false;
[JsonPropertyName("is_fee_paid_by_user")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool IsFeePaidByUser { get; set; } = false;
}

public class PaymentRequestPayload_Sandbox : PaymentRequestPayload
{
[JsonPropertyName("case")]
public string? Case { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace NowPayments.Net.Objects.ResponsePayload
{
public class PaymentResponsePayload : Payment
{
}
}

0 comments on commit 076a7aa

Please sign in to comment.