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:

  1. Open the Solution Explorer.
  2. Right-click on a project within your solution.
  3. Click on Manage NuGet Packages...
  4. Click on the Browse tab and search for "PingPayments.Mimic".
  5. 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:

  1. Create a Ping Mimic Client.

  2. Call the Create() method with a createDepositRequest.

    1. await api.Deposit.V1.Create(createDepositRequest);
      
  3. Handle response.

Parameters

ParameterTypeRequierdDescription
createDepositRequestCreateDepositRequestYesRequest 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:

  1. Create a Ping Mimic Client.

  2. Call the Trigger() method with an array of Payment Order Ids.

    1. await api.Disbursement.V1.Trigger(paymentOrderIdList);
      
  3. Handle response.

Parameters

ParameterTypeRequierdDescription
paymentOrderIdList Guid[]YesArray 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:

  1. Create a Ping Mimic Client.

  2. Call the Update() method with a merchantId and a merchantStatus.

    1. await api.Merchant.V1.Update(merchantId, merchantStatus);
      
  3. Handle response.

Parameters

ParameterTypeRequierdDescription
merchantId GuidYesId of a specific merchant.
merchantStatusMerchantStatusYesThe 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

{}