/** * 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; } }