function commerce_stripe_get_remote_status in Commerce Stripe 7.3
Get the transactions remote status.
Parameters
bool $txn_capture_bool: Indicates whether or not the payment was captured.
stdClass $prev_transaction: The previous transaction entity.
string $action: The operation being performed on the transaction.
Return value
string The remote status.
Throws
Exception
4 calls to commerce_stripe_get_remote_status()
- commerce_stripe_capture_form_submit in includes/
commerce_stripe.admin.inc - Submit handler: process a prior authorization capture via AIM.
- 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.
- commerce_stripe_void_form_submit in includes/
commerce_stripe.admin.inc - Submit handler: process the void request. This is only accessible on uncaptured charge. If a user wishes to cancel a captured transaction, they need to credit the account
File
- ./
commerce_stripe.module, line 1899 - 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_remote_status($txn_capture_bool, $prev_transaction = NULL, $action = NULL) {
// This is the case that a new charge is being created.
if (!$prev_transaction) {
if ($txn_capture_bool === FALSE) {
return 'AUTH_ONLY';
}
else {
if ($txn_capture_bool === TRUE) {
return 'AUTH_CAPTURE';
}
}
}
else {
// An administrator is acting upon a previous transaction in the admin ui
// in order to capture or void.
switch ($action) {
case 'capture':
if ($prev_transaction->remote_status == 'AUTH_ONLY') {
return 'PRIOR_AUTH_CAPTURE';
}
else {
//This means that internally this function has been called improperly by
//the programmer.
throw new Exception(t('Remote Status capture improperly used internally.'));
}
break;
case 'void':
if ($prev_transaction->remote_status == 'AUTH_ONLY') {
return 'VOID';
}
else {
// This means that internally this function has been called improperly by
// the programmer.
throw new Exception(t('Remote Status void improperly used internally.'));
}
break;
}
}
return 'FAILED';
}