activity_model.php
1 year ago
agent_meta_model.php
1 year ago
agent_model.php
1 year ago
booking_meta_model.php
1 year ago
booking_model.php
1 year ago
bundle_meta_model.php
1 year ago
bundle_model.php
1 year ago
cart_item_model.php
1 year ago
cart_meta_model.php
1 year ago
cart_model.php
1 year ago
connector_model.php
1 year ago
customer_meta_model.php
1 year ago
customer_model.php
9 months ago
invoice_model.php
1 year ago
join_bundles_services_model.php
1 year ago
location_category_model.php
1 year ago
location_model.php
1 year ago
meta_model.php
1 year ago
model.php
9 months ago
off_period_model.php
1 year ago
order_intent_meta_model.php
1 year ago
order_intent_model.php
9 months ago
order_item_model.php
1 year ago
order_meta_model.php
1 year ago
order_model.php
1 year ago
otp_model.php
9 months ago
payment_request_model.php
1 year ago
process_job_model.php
1 year ago
process_model.php
1 year ago
recurrence_model.php
1 year ago
service_category_model.php
9 months ago
service_meta_model.php
1 year ago
service_model.php
9 months ago
session_model.php
1 year ago
settings_model.php
1 year ago
step_settings_model.php
1 year ago
transaction_intent_model.php
1 year ago
transaction_model.php
1 year ago
transaction_refund_model.php
1 year ago
work_period_model.php
1 year ago
transaction_refund_model.php
68 lines
| 1 | <?php |
| 2 | |
| 3 | class OsTransactionRefundModel extends OsModel { |
| 4 | public $id, |
| 5 | $token, |
| 6 | $transaction_id, |
| 7 | $amount, |
| 8 | $updated_at, |
| 9 | $created_at; |
| 10 | |
| 11 | function __construct($id = false) { |
| 12 | parent::__construct(); |
| 13 | $this->table_name = LATEPOINT_TABLE_TRANSACTION_REFUNDS; |
| 14 | $this->nice_names = ['token' => __('Confirmation Number', 'latepoint')]; |
| 15 | |
| 16 | if ($id) { |
| 17 | $this->load_by_id($id); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | public function properties_to_query(): array{ |
| 22 | return [ |
| 23 | 'payment_method' => __('Payment Method', 'latepoint'), |
| 24 | 'payment_portion' => __('Payment Portion', 'latepoint'), |
| 25 | 'kind' => __('Type', 'latepoint'), |
| 26 | ]; |
| 27 | } |
| 28 | |
| 29 | public function generate_data_vars(): array { |
| 30 | return [ |
| 31 | 'id' => $this->id, |
| 32 | 'token' => $this->token, |
| 33 | 'transaction_id' => $this->transaction_id, |
| 34 | 'amount' => OsMoneyHelper::format_price($this->amount), |
| 35 | ]; |
| 36 | } |
| 37 | |
| 38 | protected function params_to_sanitize() { |
| 39 | return ['amount' => 'money']; |
| 40 | } |
| 41 | |
| 42 | |
| 43 | protected function params_to_save($role = 'admin'): array { |
| 44 | $params_to_save = array('id', |
| 45 | 'token', |
| 46 | 'transaction_id', |
| 47 | 'amount'); |
| 48 | return $params_to_save; |
| 49 | } |
| 50 | |
| 51 | |
| 52 | protected function allowed_params($role = 'admin'): array { |
| 53 | $allowed_params = array('id', |
| 54 | 'token', |
| 55 | 'transaction_id', |
| 56 | 'amount'); |
| 57 | return $allowed_params; |
| 58 | } |
| 59 | |
| 60 | |
| 61 | protected function properties_to_validate() :array { |
| 62 | $validations = array( |
| 63 | 'transaction_id' => array('presence'), |
| 64 | 'token' => array('presence'), |
| 65 | ); |
| 66 | return $validations; |
| 67 | } |
| 68 | } |