Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into release
  • Loading branch information
SoloJr committed May 27, 2021
2 parents 3177f0b + 5bd1079 commit 27153fa
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 0 deletions.
15 changes: 15 additions & 0 deletions MangoPay.SDK.Tests/ApiPayOutsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,20 @@ public async Task Test_PayOuts_Create_BankWire()
Assert.Fail(ex.Message);
}
}

[Test]
public async Task Test_PayOuts_Get_Bankwire()
{
var john = await this.GetJohnsPayOutBankWire();

var getJohnBankwire = await Api.PayOuts.GetBankwirePayoutAsync(john.Id);

Assert.NotNull(john);
Assert.NotNull(getJohnBankwire);

Assert.AreEqual(john.Id, getJohnBankwire.Id);
Assert.IsTrue(getJohnBankwire.ModeRequested == "STANDARD");
Assert.IsTrue(getJohnBankwire.ModeApplied.Length != 0);
}
}
}
19 changes: 19 additions & 0 deletions MangoPay.SDK.Tests/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public abstract class BaseTest
private static CardRegistrationDTO _johnsCardRegistration;
private static KycDocumentDTO _johnsKycDocument;
private static PayOutBankWireDTO _johnsPayOutForCardDirect;
private static PayOutBankWireDTO _johnsPayPutBankwire;
private static HookDTO _johnsHook;
private static Dictionary<ReportType, ReportRequestDTO> _johnsReports;

Expand Down Expand Up @@ -542,6 +543,24 @@ protected async Task<PayOutBankWireDTO> GetJohnsPayOutForCardDirect()
return BaseTest._johnsPayOutForCardDirect;
}

protected async Task<PayOutBankWireDTO> GetJohnsPayoutBankwire()
{
if (_johnsPayOutBankWire != null)
return _johnsPayOutBankWire;

var payIn = await this.GetNewPayInCardDirect();
var account = await this.GetJohnsAccount();

var payOut = new PayOutBankWirePostDTO(payIn.AuthorId, payIn.CreditedWalletId, new Money { Amount = 10, Currency = CurrencyIso.EUR },
new Money { Amount = 5, Currency = CurrencyIso.EUR }, account.Id, "Johns bank wire ref", "STANDARD")
{
Tag = "DefaultTag",
CreditedUserId = payIn.AuthorId
};

return await this.Api.PayOuts.CreateBankWireAsync(payOut);
}

protected async Task<TransferDTO> GetNewTransfer(WalletDTO walletIn = null)
{
WalletDTO walletWithMoney = walletIn;
Expand Down
Binary file modified MangoPay.SDK.Tests/TestKycPageFile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions MangoPay.SDK/Core/APIs/ApiBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public abstract class ApiBase
{ MethodKey.GooglePayinsDirectCreate, new ApiEndPoint("/payins/googlepay/direct", RequestType.POST)},

{ MethodKey.PayoutsBankwireCreate, new ApiEndPoint("/payouts/bankwire", RequestType.POST)},
{ MethodKey.PayoutsBankwireGet, new ApiEndPoint("/payouts/bankwire/{0}", RequestType.GET)},
{ MethodKey.PayoutsGet, new ApiEndPoint("/payouts/{0}", RequestType.GET)},
{ MethodKey.PayoutsGetRefunds, new ApiEndPoint("/payouts/{0}/refunds", RequestType.GET)},

Expand Down
20 changes: 20 additions & 0 deletions MangoPay.SDK/Core/APIs/ApiPayOuts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ public async Task<PayOutBankWireDTO> GetBankWireAsync(String payOutId)
return await this.GetObjectAsync<PayOutBankWireDTO>(MethodKey.PayoutsGet, payOutId);
}

/// <summary>
/// Gets async PayOut Bankwire Entity by its identifier
/// </summary>
/// <param name="payoutId">PayOutBankWire identifier.</param>
/// <returns></returns>
public async Task<PayOutBankWireGetDTO> GetBankwirePayoutAsync(String payoutId)
{
return await this.GetObjectAsync<PayOutBankWireGetDTO>(MethodKey.PayoutsBankwireGet, payoutId);
}

/// <summary>Creates new PayOut object.</summary>
/// <param name="payOut">The PayOut object to be created.</param>
/// <returns>Created PayOut object returned from API.</returns>
Expand Down Expand Up @@ -78,5 +88,15 @@ public PayOutBankWireDTO GetBankWire(String payOutId)
{
return this.GetObject<PayOutBankWireDTO>(MethodKey.PayoutsGet, payOutId);
}

/// <summary>
/// Gets PayOut Bankwire Entity by its identifier
/// </summary>
/// <param name="payoutId">PayOutBankWire identifier.</param>
/// <returns></returns>
public PayOutBankWireGetDTO GetBankwirePayout(String payoutId)
{
return this.GetObject<PayOutBankWireGetDTO>(MethodKey.PayoutsBankwireGet, payoutId);
}
}
}
1 change: 1 addition & 0 deletions MangoPay.SDK/Core/Enumerations/MethodKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public enum MethodKey
PayinsDirectDebitCreate,
PayinsMandateDirectDebitCreate,
PayoutsBankwireCreate,
PayoutsBankwireGet,
PayoutsGet,
PayoutsGetRefunds,
PreauthorizationCreate,
Expand Down
11 changes: 11 additions & 0 deletions MangoPay.SDK/Entities/GET/PayOutBankWireDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,15 @@ public class PayOutBankWireDTO : PayOutDTO
/// <summary>A custom reference you wish to appear on the user’s bank statement (your ClientId is already shown).</summary>
public String BankWireRef { get; set; }
}

public class PayOutBankWireGetDTO : PayOutBankWireDTO
{
public new String Status { get; set; }

public String ModeRequested { get; set; }

public String ModeApplied { get; set; }

public String FallbackReason { get; set; }
}
}

0 comments on commit 27153fa

Please sign in to comment.