Providers status example

Retrieve the business' providers and their status. Optionally include a provider number as a query param to filter the results and retrieve only a single provider.

by joshpiper_medipass

HTML

<script src="https://unpkg.com/@medipass/partner-sdk/umd/@medipass/partner-sdk.min.js"></script>
<div id="providers">
  
</div>

JavaScript

// import MedipassTransactionSDK from '@medipass/partner-sdk';
// const MedipassTransactionSDK = require('@medipass/partner-sdk');


/**
 * Retrieve a business' provider by provider number.
 *
 * Example response:
 * {
 *   "providers": [
 *     {
 *         "providerNumber": "1234567A",
 *         "funders": [
 *             {
 *                 "displayName": "Example 1",
 *                 "code": "exmpl1"
 *             }
 *         ]
 *     }
 *   ]
 * }   
 */
async function main() {
  await MedipassTransactionSDK.setConfig({
    env: 'dev', // Enter the environment you want to target (stg/prod)
    apiKey: '6233fd0326e88c00680e32b7:-veemKYcZBnPfdes1anGUUZnnkZmTKFJmkI19bZK_r4', // Can be found in your business settings in Connect
    appId: 'web-application', // Your application identifier
    appVersion: 'v1.0.0' // The transaction SDK version to target 
  });

  // Provider number must be supplied
  const providerNumber = '3539440H';
    const patientId = '6243f1695ef93900672ef327';

  const { providers } = await MedipassTransactionSDK.providers.getProvidersStatus({
    query: {
      providerNumber,
      patientId
    }
  });
  
  const { items } = await MedipassTransactionSDK.payments.getBusinessPatientPaymentMethods({
    query: {
      patientId
    }
  });
  
  console.log("Hi", items);
  console.log("Providers", providers);
  document.getElementById('providers').textContent = JSON.stringify(providers);
}

main();