| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Better_Payment\Lite\Models; |
| 4 | 4 | |
| 5 | -use Better_Payment\Lite\Admin\Better_Payment_DB; | |
| 5 | +use Better_Payment\Lite\Admin\DB; | |
| 6 | 6 | use Better_Payment\Lite\Model; |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * The Transaction handler database class |
| @@ -20,9 +20,20 @@ | ||
| 20 | 20 | public function __construct( ) { |
| 21 | 21 | parent::__construct(); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function get_transactions($per_page = '999999999') { | |
| 25 | - $all_transactions = Better_Payment_DB::get_transactions(['per_page' => $per_page]); | |
| 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); | |
| 26 | 37 | return $all_transactions; |
| 27 | 38 | } |
| 28 | 39 | } |