|
@@ 382-392 (lines=11) @@
|
| 379 |
|
* @version 4.0.0 |
| 380 |
|
* @param string $source_id |
| 381 |
|
*/ |
| 382 |
|
public static function get_order_by_source_id( $source_id ) { |
| 383 |
|
global $wpdb; |
| 384 |
|
|
| 385 |
|
$order_id = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT ID FROM $wpdb->posts as posts LEFT JOIN $wpdb->postmeta as meta ON posts.ID = meta.post_id WHERE meta.meta_value = %s", $source_id ) ); |
| 386 |
|
|
| 387 |
|
if ( ! empty( $order_id ) ) { |
| 388 |
|
return wc_get_order( $order_id ); |
| 389 |
|
} |
| 390 |
|
|
| 391 |
|
return false; |
| 392 |
|
} |
| 393 |
|
|
| 394 |
|
/** |
| 395 |
|
* Gets the order by Stripe charge ID. |
|
@@ 401-411 (lines=11) @@
|
| 398 |
|
* @version 4.0.0 |
| 399 |
|
* @param string $charge_id |
| 400 |
|
*/ |
| 401 |
|
public static function get_order_by_charge_id( $charge_id ) { |
| 402 |
|
global $wpdb; |
| 403 |
|
|
| 404 |
|
$order_id = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT ID FROM $wpdb->posts as posts LEFT JOIN $wpdb->postmeta as meta ON posts.ID = meta.post_id WHERE meta.meta_value = %s", $charge_id ) ); |
| 405 |
|
|
| 406 |
|
if ( ! empty( $order_id ) ) { |
| 407 |
|
return wc_get_order( $order_id ); |
| 408 |
|
} |
| 409 |
|
|
| 410 |
|
return false; |
| 411 |
|
} |
| 412 |
|
|
| 413 |
|
/** |
| 414 |
|
* Sanitize statement descriptor text. |