예제 #1
0
 /// <summary>
 /// Simulates a Customer to Business payment request.
 /// </summary>
 /// <param name="customerToBusinessSimulateDto">C2B data transfer object</param>
 /// <param name="accesstoken">Acccesstoken retrieved by the <c>GetAuthTokenAsync</c> method.</param>
 /// <param name="requestEndPoint">Set to <c>RequestEndPoint.CustomerToBusinessSimulate</c></param>
 /// <param name="cancellationToken">Cancellation Token</param>
 /// <returns>A JSON string containing data from MPESA API reposnse.</returns>
 /// <remarks>
 /// Use only for Simulation/testing. In production use <c>RegisterC2BUrlAsync</c> method to register
 /// endpoints in your application that receive customer initiated transactions from the MPESA API
 /// for confirmation and/or validation
 /// </remarks>
 public async Task <string> MakeC2BPaymentAsync(CustomerToBusinessSimulateDto customerToBusinessSimulateDto, string accesstoken, string requestEndPoint, CancellationToken cancellationToken = default)
 {
     return(await MpesaHttpRequest(customerToBusinessSimulateDto, accesstoken, requestEndPoint, cancellationToken));
 }
예제 #2
0
 /// <summary>
 /// Simulates a Customer to Business payment request.
 /// </summary>
 /// <param name="customerToBusinessSimulateDto">C2B data transfer object</param>
 /// <param name="accesstoken">Acccesstoken retrieved by the <c>GetAuthTokenAsync</c> method.</param>
 /// <param name="requestEndPoint">Set to <c>RequestEndPoint.CustomerToBusinessSimulate</c></param>
 /// <param name="cancellationToken">Cancellation Token</param>
 /// <returns>A JSON string containing data from MPESA API reposnse.</returns>
 /// <remarks>
 /// Use only for Simulation/testing. In production use <c>RegisterC2BUrlAsync</c> method to register
 /// endpoints in your application that receive customer initiated transactions from the MPESA API
 /// for confirmation and/or validation
 /// </remarks>
 public string MakeC2BPayment(CustomerToBusinessSimulateDto customerToBusinessSimulateDto, string accesstoken, string requestEndPoint, CancellationToken cancellationToken = default)
 {
     return(MpesaHttpRequest(customerToBusinessSimulateDto, accesstoken, requestEndPoint, cancellationToken).GetAwaiter().GetResult());
 }