function _commerce_stripe_get_txn_capture_bool in Commerce Stripe 7.3
Used in commerce_stripe_submit_form_submit to get the capture flag for the charge.
Parameters
array $payment_method: An array containing the payment_method information.
array $pane_values: An array containing values from the Commerce Stripe payment pane.
Return value
bool Returns TRUE if capture is set & FALSE for auth only.
2 calls to _commerce_stripe_get_txn_capture_bool()
- commerce_stripe_cardonfile_charge in ./
commerce_stripe.module - Card on file callback: background charge payment TODO: implement proper return codes per commerce payment
- commerce_stripe_submit_form_submit in ./
commerce_stripe.module - Payment method callback: checkout form submission.
File
- ./
commerce_stripe.module, line 1862 - This module provides Stripe (http://stripe.com/) payment gateway integration to Commerce. Commerce Stripe offers a PCI-compliant way to process payments straight from you Commerce shop.
Code
function _commerce_stripe_get_txn_capture_bool($payment_method, $pane_values) {
$txn_type = !empty($payment_method['settings']['txn_type']) ? $payment_method['settings']['txn_type'] : COMMERCE_CREDIT_AUTH_CAPTURE;
// This handles the case when we are in the payment terminal. The
// $pane_values contains which type of transaction chosen
if (!empty($pane_values['txn_type'])) {
$txn_type = $pane_values['txn_type'];
}
// The capture flag in the charge takes a boolean. This simply
// translates the txn constants to a bool.
if ($txn_type == COMMERCE_CREDIT_AUTH_CAPTURE) {
return TRUE;
}
else {
if ($txn_type == COMMERCE_CREDIT_AUTH_ONLY) {
return FALSE;
}
}
// Return TRUE by default.
return TRUE;
}