| 1 |
<?php |
| 2 |
|
| 3 |
namespace Better_Payment\Lite\Models; |
| 4 |
|
| 5 |
use Better_Payment\Lite\Admin\DB; |
| 6 |
use Better_Payment\Lite\Model; |
| 7 |
|
| 8 |
/** |
| 9 |
* The Transaction handler database class |
| 10 |
* |
| 11 |
* @since 0.0.4 |
| 12 |
*/ |
| 13 |
class TransactionModel extends Model { |
| 14 |
|
| 15 |
/** |
| 16 |
* Initialize the class |
| 17 |
* |
| 18 |
* @since 0.0.4 |
| 19 |
*/ |
| 20 |
public function __construct( ) { |
| 21 |
parent::__construct(); |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Transactions for the CSV export. |
| 26 |
* |
| 27 |
* @param array $args DB::get_transactions() filters. |
| 28 |
* @param string $version 'v2' filters `status` by the admin list's tab buckets; 'v1' by raw status. |
| 29 |
* @return array |
| 30 |
*/ |
| 31 |
public function get_transactions($args = [], $version = 'v1') { |
| 32 |
// Set default per_page if not provided |
| 33 |
if (!isset($args['per_page'])) { |
| 34 |
$args['per_page'] = '999999999'; |
| 35 |
} |
| 36 |
$all_transactions = DB::get_transactions($args, 0, $version); |
| 37 |
return $all_transactions; |
| 38 |
} |
| 39 |
} |