Mimic API
Manages the following endpoints: Deposit , Disbursement and Merchant.
Installation
dotnet CLI
Install the latest SDK using dotnet CLI:
dotnet add package PingPayment.Mimic
NuGet.exe
Install the latest SDK using NuGet.exe:
nuget install PingPayment.Mimic
Visual Studio
From within Visual Studio:
- Open the Solution Explorer.
- Right-click on a project within your solution.
- Click on Manage NuGet Packages...
- Click on the Browse tab and search for "PingPayments.Mimic".
- Click on the PingPayments.Mimic package, select the appropriate version in the right-tab and click Install.
Client
The client exposes all enpoints and It's operations that let you create and interact with Ping Payments Mimic API through your Ping Payments account. Ping Payment Mimic Client uses the Http Client for sending and receiving HTTP responses.
Ping Payment Mimic Client
The using
directive allows you to use types defined in a namespace without specifying the fully qualified namespace of that type. Add the following using directive from the PingPayments.Mimic
namespace:
using PingPayments.Mimic;
Initializing the client with an appropriate environment.
Mimic only exist in a Sanbox environment.
- Sandbox environment,
PingEnvironments.Mimic.SandboxUri
.
var httpClient = new HttpClient().ConfigurePingPaymentsClient(PingEnvironments.MimicApi.SandboxUri);
var api = new PingMimicApiClient(httpClient);
Or use Dependency injection
services.AddHttpClient<IPingMimicApiClient, PingMimiccApiClient>(client =>
{
client.ConfigurePingPaymentsClient(PingEnvironments.Mimic.SandboxUri);
});
Deposit (Endpoint)
The Deposit endpoint exposes one method dedicated to creating a mimic deposit.
Method
Create Deposit
Create a mimic deposit to simulate a bank transfer.
Usage:
-
Create a Ping Mimic Client.
-
Call the
Create()
method with acreateDepositRequest
.-
await api.Deposit.V1.Create(createDepositRequest);
-
Parameters
Parameter | Type | Requierd | Description |
---|---|---|---|
createDepositRequest | CreateDepositRequest | Yes | Request body required to create a mimic deposit |
Returns
Returns an empty response, or an error response.
Example Usage
//Crate a CreateDepositRequest
var createDepositRequest = new CreateDepositRequest
(
1000,
CurrencyEnum.NOK,
"100827483",
ReferenceTypeEnum.KID
);
//Make call to API
var response = await api.Deposit.V1.Create(createDepositRequest);
Response
204 No content
{}
Disbursement (Endpoint)
The Disbursement endpoint exposes one method dedicated to trigger disbursements.
Method
Trigger a disbursement
Trigger a disbursement.
Usage:
-
Create a Ping Mimic Client.
-
Call the
Trigger()
method with an array of Payment Order Ids.-
await api.Disbursement.V1.Trigger(paymentOrderIdList);
-
Parameters
Parameter | Type | Requierd | Description |
---|---|---|---|
paymentOrderIdList | Guid[] | Yes | Array of Payment Order Id |
Returns
Returns an array of disbursed Payment Orders and an array of failed disbursements, or an error response.
Example Usage
Guid paymentOrderId = Guid.Parse("f329ddcf-01bb-4434-914f-3981ada2e2cd");
Guid[] paymentOrderIdList = new[] { paymentOrderId };
var response = await _api.Disbursement.V1.Trigger(paymentOrderIdList);
Response
200 OK
{
"disbursed_payment_orders":
[
"f329ddcf-01bb-4434-914f-3981ada2e2cd"
],
"failed_to_disburse": []
}
Merchants (Endpoint)
The Merchant endpoint exposes one method dedicated to changing the status of a merchant.
Method
Update Merchant Status
Mimic an update of a merchant status.
Usage:
-
Create a Ping Mimic Client.
-
Call the
Update()
method with amerchantId
and amerchantStatus
.-
await api.Merchant.V1.Update(merchantId, merchantStatus);
-
Parameters
Parameter | Type | Requierd | Description |
---|---|---|---|
merchantId | Guid | Yes | Id of a specific merchant. |
merchantStatus | MerchantStatus | Yes | The desired status of the merchant to be updated to. |
Returns
Returns an empty response, or an error response.
Example Usage
//Get merchantId as Guid
Guid merchantId = Guid.Parse("a448e07e-1f16-460e-8fe6-2221795d767c");
//Make call to API
var response = await api.Merchant.V1.Update(merchantId, MerchantStatus.APPROVED);
Response
204 No content
{}
Updated 9 months ago