activity_model.php
3 months ago
agent_meta_model.php
3 months ago
agent_model.php
3 months ago
booking_meta_model.php
3 months ago
booking_model.php
3 months ago
bundle_meta_model.php
3 months ago
bundle_model.php
3 months ago
cart_item_model.php
3 months ago
cart_meta_model.php
3 months ago
cart_model.php
3 months ago
connector_model.php
3 months ago
customer_meta_model.php
3 months ago
customer_model.php
1 month ago
invoice_model.php
3 months ago
join_bundles_services_model.php
3 months ago
location_category_model.php
3 months ago
location_model.php
3 months ago
meta_model.php
3 months ago
model.php
3 months ago
off_period_model.php
3 months ago
order_intent_meta_model.php
3 months ago
order_intent_model.php
3 months ago
order_item_model.php
3 months ago
order_meta_model.php
3 months ago
order_model.php
3 months ago
otp_model.php
3 months ago
payment_request_model.php
3 months ago
process_job_model.php
3 months ago
process_model.php
3 months ago
recurrence_model.php
3 months ago
service_category_model.php
3 months ago
service_meta_model.php
3 months ago
service_model.php
3 months ago
session_model.php
3 months ago
settings_model.php
3 months ago
step_settings_model.php
3 months ago
transaction_intent_model.php
3 months ago
transaction_model.php
3 months ago
transaction_refund_model.php
3 months ago
work_period_model.php
3 months ago
transaction_refund_model.php
73 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( |
| 45 | 'id', |
| 46 | 'token', |
| 47 | 'transaction_id', |
| 48 | 'amount', |
| 49 | ); |
| 50 | return $params_to_save; |
| 51 | } |
| 52 | |
| 53 | |
| 54 | protected function allowed_params( $role = 'admin' ): array { |
| 55 | $allowed_params = array( |
| 56 | 'id', |
| 57 | 'token', |
| 58 | 'transaction_id', |
| 59 | 'amount', |
| 60 | ); |
| 61 | return $allowed_params; |
| 62 | } |
| 63 | |
| 64 | |
| 65 | protected function properties_to_validate(): array { |
| 66 | $validations = array( |
| 67 | 'transaction_id' => array( 'presence' ), |
| 68 | 'token' => array( 'presence' ), |
| 69 | ); |
| 70 | return $validations; |
| 71 | } |
| 72 | } |
| 73 |