Appendix

Last edited 350 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.

throw e.ToConnectorException();
}
}
}

Appendix D:

ProcessPaymentAction Function Implementation Example
public class ProcessPaymentActionResolver: IProcessPaymentActionProvider {
public IProcessPaymentAction GetHandler()
{
return new ProcessPaymentAction
(new DefaultConnectorConfigurationValidator());
}
}

Appendix E:

image.png
Figure 8: Plugin implementation flow

Appendix F:

Example configuration details format
{
"Merchant": [
{
"Key": "PublicKey",
"IsRequired": true,
"Description": "Checkout api public key",
"DisplayLabel": "Public Key
},
{
"Key": "SecretKey",
"IsRequired": true,
"Description": "Checkout api secret key",
"DisplayLabel": "Secret Key"
},
{
"Key": "webhookSignature",
"IsRequired": false,
"Description": "Checkout webhook secret key",
"DisplayLabel": "Webhook Signature"
}
],
"Product": [
{
"Key": "ProductID",
"IsRequired": true,
"Description": "Product Configuration Id Mapping",
"DisplayLabel": "IMS Mapping ID"
}
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.