Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds AZN currency #125

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Craftgate/Adapter/BankAccountTrackingAdapter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Craftgate.Net;
using Craftgate.Request;
using Craftgate.Request.Common;
using Craftgate.Response;
using Craftgate.Response.Dto;

namespace Craftgate.Adapter
{
public class BankAccountTrackingAdapter : BaseAdapter
{
public BankAccountTrackingAdapter(RequestOptions requestOptions) : base(requestOptions)
{
}

public BankAccountTrackingRecordListResponse SearchRecords(SearchBankAccountTrackingRecordsRequest request)
{
var query = RequestQueryParamsBuilder.BuildQueryParam(request);
var path = "/bank-account-tracking/v1/merchant-bank-account-trackings/records" + query;

return RestClient.Get<BankAccountTrackingRecordListResponse>(RequestOptions.BaseUrl + path,
CreateHeaders(path, RequestOptions));
}

public Task<BankAccountTrackingRecordListResponse> SearchRecordsAsync(SearchBankAccountTrackingRecordsRequest request)
{
var query = RequestQueryParamsBuilder.BuildQueryParam(request);
var path = "/bank-account-tracking/v1/merchant-bank-account-trackings/records" + query;

return AsyncRestClient.Get<BankAccountTrackingRecordListResponse>(RequestOptions.BaseUrl + path,
CreateHeaders(path, RequestOptions));
}
}
}
15 changes: 11 additions & 4 deletions Craftgate/CraftgateClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class CraftgateClient
private readonly SettlementReportingAdapter _settlementReportingAdapter;
private readonly WalletAdapter _walletAdapter;
private readonly HookAdapter _hookAdapter;
private readonly BankAccountTrackingAdapter _bankAccountTrackingAdapter;

public CraftgateClient(string apiKey, string secretKey)
: this(apiKey, secretKey, BaseUrl, null)
Expand All @@ -27,7 +28,7 @@ public CraftgateClient(string apiKey, string secretKey, string baseUrl)
: this(apiKey, secretKey, baseUrl, null)
{
}

public CraftgateClient(string apiKey, string secretKey, string baseUrl, string language)
{
var requestOptions = new RequestOptions
Expand All @@ -49,6 +50,7 @@ public CraftgateClient(string apiKey, string secretKey, string baseUrl, string l
_fileReportingAdapter = new FileReportingAdapter(requestOptions);
_fraudAdapter = new FraudAdapter(requestOptions);
_hookAdapter = new HookAdapter(requestOptions);
_bankAccountTrackingAdapter = new BankAccountTrackingAdapter(requestOptions);
}

public PaymentAdapter Payment()
Expand Down Expand Up @@ -94,16 +96,21 @@ public PayByLinkApiAdapter PayByLink()
public FileReportingAdapter FileReporting()
{
return _fileReportingAdapter;
}
}

public FraudAdapter Fraud()
{
return _fraudAdapter;
}

public HookAdapter Hook()
{
return _hookAdapter;
}

public BankAccountTrackingAdapter BankAccountTracking()
{
return _bankAccountTrackingAdapter;
}
}
}
9 changes: 9 additions & 0 deletions Craftgate/Model/BankAccountTrackingSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Runtime.Serialization;

namespace Craftgate.Model
{
public enum BankAccountTrackingSource
{
[EnumMember(Value = "YKB")] YKB
}
}
3 changes: 2 additions & 1 deletion Craftgate/Model/Currency.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public enum Currency
[EnumMember(Value = "BRL")] BRL,
[EnumMember(Value = "CNY")] CNY,
[EnumMember(Value = "AED")] AED,
[EnumMember(Value = "IQD")] IQD
[EnumMember(Value = "IQD")] IQD,
[EnumMember(Value = "AZN")] AZN
}
}
11 changes: 11 additions & 0 deletions Craftgate/Model/RecordType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Runtime.Serialization;

namespace Craftgate.Model
{
public enum RecordType
{
[EnumMember(Value = "SEND")] SEND,

[EnumMember(Value = "RECEIVE")] RECEIVE
}
}
17 changes: 17 additions & 0 deletions Craftgate/Request/SearchBankAccountTrackingRecordsRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using Craftgate.Model;

namespace Craftgate.Request
{
public class SearchBankAccountTrackingRecordsRequest
{
public string SenderName { get; set; }
public string SenderIban { get; set; }
public string Description { get; set; }
public Currency? Currency { get; set; }
public DateTime? MinRecordDate { get; set; }
public DateTime? MaxRecordDate { get; set; }
public int Page { get; set; } = 0;
public int Size { get; set; } = 10;
}
}
9 changes: 9 additions & 0 deletions Craftgate/Response/BankAccountTrackingRecordListResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Craftgate.Response.Common;
using Craftgate.Response.Dto;

namespace Craftgate.Response
{
public class BankAccountTrackingRecordListResponse : ListResponse<BankAccountTrackingRecordResponse>
{
}
}
18 changes: 18 additions & 0 deletions Craftgate/Response/BankAccountTrackingRecordResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using Craftgate.Model;

namespace Craftgate.Response.Dto
{
public class BankAccountTrackingRecordResponse
{
public long Id { get; set; }
public string SenderName { get; set; }
public string SenderIban { get; set; }
public string Description { get; set; }
public decimal Amount { get; set; }
public Currency Currency { get; set; }
public DateTime RecordDate { get; set; }
public RecordType RecordType { get; set; }
public BankAccountTrackingSource BankAccountTrackingSource { get; set; }
}
}
31 changes: 31 additions & 0 deletions Samples/BankAccountTrackingSample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using Craftgate;
using Craftgate.Model;
using Craftgate.Request;
using Craftgate.Request.Dto;
using NUnit.Framework;

namespace Samples
{
public class BankAccountTrackingSample
{
private readonly CraftgateClient _craftgateClient =
new CraftgateClient("api-key", "secret-key", "https://sandbox-api.craftgate.io");

[Test]
public void Search_Bank_Account_Tracking_Records()
{
var request = new SearchBankAccountTrackingRecordsRequest()
{
Currency = Currency.TRY,
Page = 0,
Size = 10
};

var response = _craftgateClient.BankAccountTracking().SearchRecords(request);
Assert.NotNull(response);
Assert.True(response.Items.Count > 0);
}
}
}
Loading