Appendix

Last edited 441 days ago by Rocky Lal

Appendix A:

Core Connector plugin included in project reference
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace><root-name-space></RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion><package-version></PackageVersion>
<PackageId><package-id></PackageId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Apaya. Connector.Core" Version="<version>"/>
</ItemGroup>

</Project>

Appendix B:

IConnectorPlugin implementation
public class MyCustomPlugin : IConnectorPlugin {

public string ConnectorName => "MyCustomerPluginName";

public ConnectorPluginMetadata Metadata { get; } = new ConnectorPluginMetadata()
{
Author = "AuthorName",
Description = "Description",
Version = "1.0.0"
};

public IEnumerable<ConnectorAction> SupportedActions { get; } = new[]
{
ConnectorAction.ProcessPayment,
ConnectorAction.GetTransaction
}

public bool HasWebhookSupport { get; } = true;
}

public RequiredConnectorConfiguration GetRequiredConnectorConfiguration()
{
return new RequiredConnectorConfiguration()
{
Merchant = new[]
{
new RequiredConfigurationEntry()
{
Description = "Config Description",
DisplayLabel = "Public Key",
IsRequired = true,
Key = = "PublicKey"
},
...
};
};
}

Appendix C:

ProcessPaymenttAction Abstraction
public class MyCustomProcessPaymentAction : IProcessPaymentAction {

public ProcessPaymentAction(IConnectorConfigurationValidator config){
}

public Task<ProcessPaymentResponse> ProcessPaymentAsync(
ProcessPaymentRequest request,
AvailableConnectorConfiguration configuration,
CancellationToken cancellationToken)

{
throw new NotImplementedException();
}
}
public class ProcessPaymentAction : IProcessPaymentAction {

public Task<ProcessPaymentResponse> ProcessPaymentAsync(
ProcessPaymentRequest request,
AvailableConnectorConfiguration configuration,
CancellationToken cancellationToken)
{
//Third party is advised to create their custom validation request.
var request = ValidateAndMapRequest(request, configuration);

try
{
var result = await <Call-payment-function>
//ToProcessPaymentResponse is a custom implementation.
//The third party are advised to map the response returned
//from the payment function to the ProcessPaymentResponse model
return result.ToProcessPaymentResponse();
}
catch (CustomException e)

{
//ToConnectorException is a custom exception handling.
//The third party is also advised to handle the exception handling
//according to their implementation.
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.