interface iBxBaseModPaymentProvider
{
public function initializeCheckout($iPendingId, $aCartInfo);
public function finalizeCheckout(&$aData);
public function finalizedCheckout();
}
INSERT INTO `bx_payment_providers`(
`name`, `caption`, `description`, `option_prefix`,
`for_visitor`, `for_single`, `for_recurring`, `single_seller`, `time_tracker`,
`active`, `order`, `class_name`, `class_file`
) VALUES (
'mygate', '_bx_payment_mygate_cpt', '_bx_payment_mygate_dsc', 'mygate_',
1, 1, 0, 0, 0,
1, 80, 'BxPaymentProviderMygate', ''
);
SET @iProviderId = LAST_INSERT_ID();
INSERT INTO `bx_payment_providers_options`(
`provider_id`, `name`, `type`, `caption`, `description`,
`extra`, `check_type`, `check_params`, `check_error`, `order`
) VALUES
(@iProviderId, 'mygate_active', 'checkbox', '_bx_payment_mygate_active_cpt', '_bx_payment_mygate_active_dsc', '', '', '', '', 1),
(@iProviderId, 'mygate_api_key', 'secret', '_bx_payment_mygate_api_key_cpt', '_bx_payment_mygate_api_key_dsc', '', '', '', '', 2),
(@iProviderId, 'mygate_return_data_url', 'value', '_bx_payment_mygate_return_data_url_cpt', '', '', '', '', '', 3),
(@iProviderId, 'mygate_notify_url', 'value', '_bx_payment_mygate_notify_url_cpt', '', '', '', '', '', 4);
class BxPaymentProviderOffline extends BxBaseModPaymentProvider implements iBxBaseModPaymentProvider
{
function __construct($aConfig)
{
$this->MODULE = 'bx_payment';
parent::__construct($aConfig);
}
public function initializeCheckout($iPendingId, $aCartInfo, $sRedirect = '')
{
$aPending = $this->_oModule->_oDb->getOrderPending(array('type' => 'id', 'id' => $iPendingId));
if(!empty($aPending['order']) || (int)$aPending['processed'] != 0)
return $this->_sLangsPrefix . 'err_already_processed';
// Build form / redirect for BX_PAYMENT_TYPE_SINGLE; reject recurring.
$this->_oModule->_oTemplate->displayPageCodeRedirect($this->getCheckoutUrl(), $aFormData);
exit;
}
public function finalizeCheckout(&$aData)
{
return array('code' => 1, 'message' => $this->_sLangsPrefix . 'cdt_err_not_available');
}
public function finalizedCheckout()
{
return array('code' => 1, 'message' => $this->_sLangsPrefix . 'cdt_err_not_available');
}
}