function commerce_stripe_return_access in Commerce Stripe 7
Same name and namespace in other branches
- 7.3 commerce_stripe.module \commerce_stripe_return_access()
Access callback for processing returns.
1 string reference to 'commerce_stripe_return_access'
- commerce_stripe_menu in ./
commerce_stripe.module - Implements hook_menu().
File
- ./
commerce_stripe.module, line 121 - 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_return_access($order, $transaction) {
// Don't allow refunds on non-stripe transactions.
if ($transaction->payment_method != 'commerce_stripe') {
return FALSE;
}
// Don't allow refunds on fully refunded transactions.
if (!empty($transaction->data['stripe']['amount_refunded'])) {
if ($transaction->data['stripe']['amount_refunded'] >= $transaction->amount) {
return FALSE;
}
}
// Only allow refunds on original charge transactions.
if (!empty($transaction->data['stripe']['stripe_refund'])) {
return FALSE;
}
return commerce_payment_transaction_access('update', $transaction);
}