private function setParametersAndPost($parameters, $fieldMappings, $requestParameters) { /* For loop to take all the non empty parameters in the $requestParameters and add it into the $parameters array, * if the keys are matched from $requestParameters array with the $fieldMappings array */ foreach ($requestParameters as $param => $value) { if (!is_array($value)) { $value = trim($value); } if (array_key_exists($param, $fieldMappings) && $value != '') { if (is_array($value)) { // If the parameter is a provider_credit_details or provider_credit_reversal_details, call the respective functions to set the values if ($param === 'provider_credit_details') { $parameters = $this->setProviderCreditDetails($parameters, $value); } elseif ($param === 'provider_credit_reversal_details') { $parameters = $this->setProviderCreditReversalDetails($parameters, $value); } } else { // For variables that are boolean values, strtolower them if ($this->checkIfBool($value)) { $value = strtolower($value); } $parameters[$fieldMappings[$param]] = $value; } } } $parameters = $this->setDefaultValues($parameters, $fieldMappings, $requestParameters); $responseObject = $this->calculateSignatureAndPost($parameters); return $responseObject; }