Testing

A comprehensive testing strategy is crucial to ensure the successful integration of SmartpayGenie into your application. Here are some key testing types:

Postman testing

Purpose: To manually test API endpoints, request parameters, and response formats.

Benefits: Quick and easy to set up, allows for flexible testing scenarios.

Limitations: Relies on manual effort and may not cover all edge cases.

Unit testing

Purpose: To test individual components of your application in isolation.

Benefits: Identifies bugs early in the development process, improves code quality, and facilitates refactoring.

Focus:Test functions, classes, or modules that interact with the SmartpayGenie API

Mocking:Use mocking libraries like Jest or Sinon.JS to simulate API responses and isolate the component under test.

javascript

    const myHeaders = new Headers();
myHeaders.append("token", "TlAWiePV51isvfuRZEHuCOW1ZDBeDHep2rnosIXHRVGvMwyFTMJZUVCeIneQJJ0h");
myHeaders.append("Content-Type", "application/json");

const raw = JSON.stringify({
  "customerId": "49438567-bc45-494c-b57d-80b41f193de7",
  "currency": "kes",
  "channel": "fiat"
});

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow"
};

fetch("https://api.switch.tulupay.com/customer/add-account", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));

    }

Integration testing

Purpose: Purpose: To test how different components of your application interact with each other, including the SmartpayGenie API.

Benefits: Ensures that components work together seamlessly and data flows correctly.

Focus:Test the integration between your application and the SmartpayGenie API, including payment initiation, status checks, and webhook handling.

javascript


   			 "statusCode": "00",
  			  "status": "success",
   			 "message": "Account created successful",
   			 "voucherId": "5828097239"


    }

For more detailed information and about conversion rate of each currency, please refer to
the convert section of this documentation.