Verifying the Plugin Operability

After a plugin is deployed to the payment-sdk microservice (see Plugin Installation), its methods can be tested in two ways:

  • Using cURL, or
  • An End-to-End test from Billing.

How to call methods individually using cURL

The payment-sdk microservice is not accessible outside of the Kubernetes cluster. To use cURL, it is necessary to connect to the microservice container.

kubectl -n <NAMESPACE> exec -it <PAYMENT_SDK_POD_NAME> -- exec

On the container console, the cURL command can be executed as follows:

curl localhost:9445 -d '{"plugin":"<PLUGIN_NAME>", "action":"<METHOD_NAME>"}'

For example, the following cURL command calls the GetConfig method in the Example plugin:

curl localhost:9445 -d '{"plugin":"Example", "action":"GetConfig"}'

HTTP/1.1 200 OK
{"friendlyName":"Example Payment Plugin","connection":{"type":"section","friendlyName":"Connection settings","items":{"gateway_url":{"type":"text","friendlyName":"Gateway URL","default":"https://demo-payment-gateway.com","required":true},"auth_code":{"type":"integer","friendlyName":"Authentication Code","min":100,"max":999}}},"format":{"type":"dropdown","options":["xml","json","csv"],"default":"json","friendlyName":"Protocol format"},"test_mode":{"type":"yesno","friendlyName":"Test Mode","default":"yes"}}

Some methods require input parameters. The following cURL command shows how to call the Redirect method from the Example plugin:

curl localhost:9445 -d '{"plugin":"Example","action":"Redirect","config":{"auth_code":"421","format":"json","gateway_url":"https://demo-payment-gateway.com","test_mode":"1"},"environment":{"lang":"en","notify_url":"https://example.sandboxes.int.zone/notify","return_url":"https://example.sandboxes.int.zone/callback","return_url_3dsecure":"https://example.sandboxes.int.zone/3dsecure","return_url_failed":"https://example.sandboxes.int.zone/fail/callback","return_url_ok":"https://example.sandboxes.int.zone/ok/callback"},"document_info":{"id":10,"total":"1.00","currency":"USD","description":"Pre-authorization Charge"},"transaction_category":"C","transaction_moto":true,"transaction_initiator":"MIT","ref_no":9,"transaction_amount":"1.00","currency_iso":"USD","current_lang":"en"}'

HTTP/1.1 200 OK
{"STATUS":"REDIRECT","REDIRECT_HASH":{"url":"https:\/\/demo-payment-gateway.com","method":"POST","attrs":{"ref_no":9,"amount":"1.00","currency":"USD","accept_url":"https:\/\/example.sandboxes.int.zone\/ok\/callback","decline_url":"https:\/\/example.sandboxes.int.zone\/fail\/callback","enable_tokens":1}}}

How to call methods from Billing

  1. In the Billing panel, go to Settings > Payment Processing.
  2. In the list of gateways, find the one you created.
  3. Click its name and configure a gateway. When you are done, test the methods implemented in the plugin.

How to test implemented methods in the plugin

  • TestConnection

    • In the Billing panel, go to System > Settings > Payments Processing > Payment Gateways, click $(PLUGIN_NAME) Gateway.
    • Click the Test Connection button: the "Test Connection succeeded" message will be displayed.
  • Sell

    Perform any purchase operation from UX1 for Customers.

    • For the Redirect plugin, you will be redirected to the gate page where you can approve or reject the payment.
    • For the tokenized plugin, you will be redirected to the gate page where a token will be received. With the token received, a new payment method will be created in Billing, which allows you to make recurring payments without redirect.
  • RefundCredit

    • Credit:
      1. In the Billing panel, go to Documents > Add New Refund.
      2. Select an account, choose Standalone with the $(PLUGIN_NAME) Gateway Token payment method, then set the amount and proceed with the refund creation.
      3. Open the created refund and click Refund. The "Successfully refunded" message will be displayed.
      4. Open the E-Transactions tab and check the details: Type = Refund, Result = Ok, Transaction Number = Some value.
    • Refund:
      1. Go to UX1 for Customers and purchase a service.
      2. In the confirmation pop-up window, select $(PLUGIN_NAME) Gateway Token and click Purchase.
      3. In the Billing panel, go to Documents > Payments.
      4. Open the payment and click Refund. The "Successfully refunded" message will be displayed.
      5. Open the E-Transactions tab and check the details: Type = Refund, Result = Ok, Transaction Number = Some value.
  • RefundPartial

    1. In the Billing panel, go to Documents > Add New Refund.
    2. Select an account, then choose Previous Transaction and specify the transaction. Click Next.
    3. Set Total to a value less than the payment total and click Finish.
    4. Open the created refund and click Refund. The "Successfully refunded" message will be displayed.
    5. Open the E-Transactions tab and check the details: Type = Refund, Result = Ok, Transaction Number = Some value.
  • Void

    1. Go to UX1 for Customers and purchase a service.
    2. In the confirmation pop-up window, select $(PLUGIN_NAME) Gateway Token and click Purchase.
    3. In the Billing panel, go to Documents > Payments.
    4. Open the payment and click Void Last E-Transaction. The "Successfully voided" message will be displayed.
    5. Open the E-Transactions tab and check the details: Type = Void, Result = Ok, Transaction Number = Some value.

    To test this method, you can also create a refund and void.

CloudBlue, an Ingram Micro business, uses cookies to improve the usability of our site. By continuing to use this site and/or logging in you are accepting the use of these cookies. For more information, visit our Privacy Policy.