/** * Constructor * * @param cbpaidGatewayAccount $account */ public function __construct( $account ) { parent::__construct( $account ); // Set gateway URLS for $this->pspUrl() results: first 2 are the main hosted payment page posting URL, next ones are gateway-specific: $this->_gatewayUrls = array( 'psp+normal' => $this->getAccountParam( 'psp_normal_url' ), 'psp+test' => $this->getAccountParam( 'psp_test_url' ), 'link+normal' => $this->getAccountParam( 'psp_link_url' ), 'link+test' => $this->getAccountParam( 'psp_link_test_url' ), ); }
/** * Constructor * * @param cbpaidGatewayAccount $account */ public function __construct($account) { parent::__construct($account); $this->private_key = $this->getAccountParam('privatekey'); $this->window_key = $this->getAccountParam('apikey'); $this->api_key = $this->getAccountParam('apiuserapikey'); // Set gateway URLS for $this->pspUrl() results: first 2 are the main hosted payment page posting URL, next ones are gateway-specific: $this->reason = ''; //Quickpay do not use separate API urls $this->formurl = "#"; // $this->formurl = $this->getNotifyUrl( $paymentBasket ); /* $this->_gatewayUrls = array( 'psp+normal' => $this->formurl, 'psp+test' => $this->formurl, 'psp+api' => $this->formurl ); */ }
/** * Copies relevant $ipn parameters into $paymentBasket * * @param cbpaidPaymentNotification $ipn * @param cbpaidPaymentBasket $paymentBasket * @return void */ protected function _bindIpnToBasket( $ipn, &$paymentBasket ) { /* Copy: 'test_ipn', 'payer_id', 'payer_status', 'residence_country', 'business', 'receiver_email', 'receiver_id', 'custom', 'memo', 'auth_id', 'auth_exp', 'auth_amount', 'auth_status', 'parent_txn_id', 'payment_method', 'gateway_account', 'payment_date' (IF COMPLETED), 'payment_type', 'pending_reason', 'reason_code', 'sale_id', 'txn_id', 'txn_type', 'subscr_date', 'subscr_effective', 'recurring', 'reattempt', 'retry_at', 'recur_times', 'username', 'password', 'subscr_id' ) */ // Not copied on purpose: // - charset // Should be OK to copy: // - payment_method // - gateway_account parent::_bindIpnToBasket( $ipn, $paymentBasket ); // copying missing as particular to this gateway: payer_email, receipt_id if ( $ipn->payer_email ) { $paymentBasket->payer_email = $ipn->payer_email; } if ( $ipn->receipt_id ) { $paymentBasket->receipt_id = $ipn->receipt_id; } if ( $ipn->payment_status === 'Completed' ) { // Correct the payment basket with tax set at and provided by the gateway: $mc_gross = (float) $ipn->mc_gross; $tax = (float) $ipn->tax; if ( ( $tax > 0 ) && ( $paymentBasket->mc_gross < $mc_gross ) && ( ( $paymentBasket->mc_gross - ( $mc_gross - $tax ) ) < 0.00001 ) ) { $paymentBasket->mc_gross += $tax; } } // Correct the payment basket with payment fees provided by the gateway: $mc_fee = (float) $ipn->mc_fee; if ( $mc_fee != 0.0 ) { $paymentBasket->mc_fee += $mc_fee; } }