updated plugin Easy Digital Downloads
version 3.1.0.4
This commit is contained in:
@ -234,6 +234,7 @@ add_action( 'edd_complete_purchase', 'edd_schedule_after_payment_action', 10, 1
|
||||
* Executes the one time event used for after purchase actions.
|
||||
*
|
||||
* @since 2.8
|
||||
* @since 3.1.0.4 This also verifies that all order items have the synced status as the order.
|
||||
* @param $payment_id
|
||||
* @param $force
|
||||
*/
|
||||
@ -248,6 +249,31 @@ function edd_process_after_payment_actions( $payment_id = 0, $force = false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* In the event that during the order completion process, a timeout happens,
|
||||
* ensure that all the order items have the correct status, to match the order itself.
|
||||
*
|
||||
* @see https://github.com/awesomemotive/easy-digital-downloads-pro/issues/77
|
||||
*/
|
||||
$order_items = edd_get_order_items(
|
||||
array(
|
||||
'order_id' => $payment_id,
|
||||
'status__not_in' => edd_get_deliverable_order_item_statuses(),
|
||||
'number' => 200,
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! empty( $order_items ) ) {
|
||||
foreach ( $order_items as $order_item ) {
|
||||
edd_update_order_item(
|
||||
$order_item->id,
|
||||
array(
|
||||
'status' => $payment->status,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$payment->add_note( __( 'After payment actions processed.', 'easy-digital-downloads' ) );
|
||||
$payment->update_meta( '_edd_complete_actions_run', time() ); // This is in GMT
|
||||
|
||||
|
@ -3098,7 +3098,7 @@ class EDD_Payment {
|
||||
}
|
||||
|
||||
$item_fees[ $id ] = array(
|
||||
'amount' => $item_fee->amount,
|
||||
'amount' => $item_fee->total,
|
||||
'label' => $item_fee->description,
|
||||
'no_tax' => $no_tax ? $no_tax : false,
|
||||
'type' => 'fee',
|
||||
|
@ -527,22 +527,22 @@ class EDD_Payments_Query extends EDD_Stats {
|
||||
$order_ids = array();
|
||||
|
||||
if ( is_array( $this->args['download'] ) ) {
|
||||
$orders = edd_get_order_items( array(
|
||||
$order_items = edd_get_order_items( array(
|
||||
'product_id__in' => (array) $this->args['download'],
|
||||
) );
|
||||
|
||||
foreach ( $orders as $order ) {
|
||||
/** @var $order EDD\Orders\Order_Item */
|
||||
$order_ids[] = $order->order_id;
|
||||
foreach ( $order_items as $order_item ) {
|
||||
/** @var $order_item EDD\Orders\Order_Item */
|
||||
$order_ids[] = $order_item->order_id;
|
||||
}
|
||||
} else {
|
||||
$orders = edd_get_order_items( array(
|
||||
$order_items = edd_get_order_items( array(
|
||||
'product_id' => $this->args['download'],
|
||||
) );
|
||||
|
||||
foreach ( $orders as $order ) {
|
||||
/** @var $order EDD\Orders\Order_Item */
|
||||
$order_ids[] = $order->id;
|
||||
foreach ( $order_items as $order_item ) {
|
||||
/** @var $order_item EDD\Orders\Order_Item */
|
||||
$order_ids[] = $order_item->order_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1249,7 +1249,7 @@ function edd_get_payment_amount( $order_id = 0 ) {
|
||||
|
||||
// Bail if nothing was passed.
|
||||
if ( empty( $order_id ) ) {
|
||||
return '';
|
||||
return 0.00;
|
||||
}
|
||||
|
||||
$order = edd_get_order( $order_id );
|
||||
|
Reference in New Issue
Block a user