/**
 * @file
 * iDEAL payment module for Ubercart. No extra gateway needed.
 * Include For iDEAL ING/PB Advanced Connector
 *
 * Development by Qrios | http://www.qrios.nl | c.kodde {at} qrios {dot} nl
 *
 *
 */
function ideal_payment_api_dirreq_call()
{
    $path_module = drupal_get_path('module', 'ideal_payment_api');
    ////Set errors on so we can see if there is a PHP error goes wrong
    //ini_set('display_errors',1);
    //error_reporting(E_ALL & ~E_NOTICE);
    //include connector
    require_once $path_module . '/lib/iDEALConnector.php';
    // Initialise connector
    $iDEALConnector = new iDEALConnector();
    //Process directory request
    $response = $iDEALConnector->GetIssuerList();
    if ($response->errCode) {
        $return .= t('Payment through iDEAL gateway not possible.') . ' ';
        $return .= t('Error message iDEAL') . ': ';
        $return .= $response->errMsg . '(' . $response->errCode . ')';
    } else {
        //Get issuerlist
        $issuerArray = $response->issuerShortList;
        if (count($issuerArray) == 0) {
            $return .= t('List with banks not available, payment through iDEAL gateway not possible.');
        } else {
            $return = $issuerArray;
        }
    }
    /*END ThinMPI code for DirReq*/
    return $return;
}
Ejemplo n.º 2
0
	/**
	* Retrieves the list of issuers and caches them in the datastore
	*
	* @return mixed Returns an array of issuers or false if it failed to get the list
	*/
	private function UpdateIssuers()
	{
		$GLOBALS['ISC_CLASS_DATA_STORE']->Delete('IdealIssuers');

		// can't update without a merchant id
		if (!$this->GetValue('merchantid')) {
			return false;
		}

		$iDEALConnector = new iDEALConnector();

		// retrieve list of issuers
		$result = $iDEALConnector->GetIssuerList();

		if ($result === false) {
			$result = $iDEALConnector->getError();
		}

		if($result->IsResponseError()) {
			// request failed
			$this->SetError(GetLang('IdealCantRetrieveIssuers',	array('code' => $result->getErrorCode(), "message" => $result->getErrorMessage())));

			return false;
		}
		$issuerArray = $result->getIssuerFullList();

		if (empty($issuerArray)) {
			// no banks registered in iDeal ... cancel
			$this->SetError(GetLang('IdealNoIssuersConfigured'));

			return false;
		}

		$issuers = array();
		foreach ($issuerArray as $issuer) {
			$issuers[$issuer->issuerID] = array("name" => $issuer->issuerName, "list" => $issuer->issuerListType);
		}

		// cache list of issuers
		$GLOBALS['ISC_CLASS_DATA_STORE']->Save('IdealIssuers', $issuers);

		return $issuers;
	}