Passed
Push — master ( 258987...abdd42 )
by Brian
11:44 queued 05:35
created

wpinv_onhold_invoice_notification()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
b 0
f 0
dl 0
loc 1
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Contains all deprecated functions.
4
 *
5
 * @since 1.0.19
6
 * @package Invoicing
7
 */
8
9
defined( 'ABSPATH' ) || exit;
10
11
/**
12
 * @deprecated
13
 */
14
function wpinv_get_invoice_cart_id() {
15
    return getpaid_get_current_invoice_id();
16
}
17
18
/**
19
 * @deprecated
20
 */
21
function wpinv_get_invoice_cart() {
22
    return wpinv_get_invoice( getpaid_get_current_invoice_id() );
23
}
24
25
/**
26
 * @deprecated
27
 */
28
function wpinv_get_invoice_description( $invoice ) {
29
    $invoice = new WPInv_Invoice( $invoice );
30
    return $invoice->get_description();
31
}
32
33
/**
34
 * @deprecated
35
 */
36
function wpinv_get_invoice_currency_code( $invoice ) {
37
    $invoice = new WPInv_Invoice( $invoice );
38
    return $invoice->get_currency();
39
}
40
41
/**
42
 * @deprecated
43
 */
44
function wpinv_get_payment_user_email( $invoice ) {
45
    $invoice = new WPInv_Invoice( $invoice );
46
    return $invoice->get_email();
47
}
48
49
/**
50
 * @deprecated
51
 */
52
function wpinv_get_user_id( $invoice ) {
53
    $invoice = new WPInv_Invoice( $invoice );
54
    return $invoice->get_user_id();
55
}
56
57
/**
58
 * @deprecated
59
 */
60
function wpinv_get_invoice_status( $invoice, $return_label = false ) {
61
    $invoice = new WPInv_Invoice( $invoice );
62
    
63
    if ( $return_label ) {
64
        return $invoice->get_status_nicename();
65
    }
66
67
    return $invoice->get_status();
68
}
69
70
/**
71
 * @deprecated
72
 */
73
function wpinv_get_payment_gateway( $invoice, $return_label = false ) {
74
    $invoice = new WPInv_Invoice( $invoice );
75
76
    if ( $return_label ) {
77
        return $invoice->get_gateway_title();
78
    }
79
80
    return $invoice->get_gateway();
81
}
82
83
/**
84
 * @deprecated
85
 */
86
function wpinv_get_payment_gateway_name( $invoice ) {
87
    return wpinv_get_payment_gateway( $invoice, true );
0 ignored issues
show
Deprecated Code introduced by
The function wpinv_get_payment_gateway() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

87
    return /** @scrutinizer ignore-deprecated */ wpinv_get_payment_gateway( $invoice, true );
Loading history...
88
}
89
90
/**
91
 * @deprecated
92
 */
93
function wpinv_get_payment_transaction_id( $invoice ) {
94
    $invoice = new WPInv_Invoice( $invoice );
95
    return $invoice->get_transaction_id();
96
}
97
98
/**
99
 * @deprecated
100
 */
101
function wpinv_get_invoice_meta( $invoice_id = 0, $meta_key = '_wpinv_payment_meta', $single = true ) {
102
    $invoice = new WPInv_Invoice( $invoice_id );
103
    return $invoice->get_meta( $meta_key, $single );
104
}
105
106
/**
107
 * @deprecated
108
 */
109
function wpinv_update_invoice_meta( $invoice_id = 0, $meta_key = '', $meta_value = '' ) {
110
    $invoice = new WPInv_Invoice( $invoice_id );
111
    return $invoice->update_meta_data( $meta_key, $meta_value );
112
}
113
114
/**
115
 * @deprecated
116
 */
117
function wpinv_get_items( $invoice = 0 ) {
118
    $invoice = new WPInv_Invoice( $invoice );
119
    return $invoice->get_items();
120
}
121
122
/**
123
 * @deprecated
124
 */
125
function wpinv_get_fees( $invoice = 0 ) {
126
    $invoice = new WPInv_Invoice( $invoice );
127
    return $invoice->get_fees();
128
}
129
130
/**
131
 * @deprecated
132
 */
133
function wpinv_get_invoice_ip( $invoice ) {
134
    $invoice = new WPInv_Invoice( $invoice );
135
    return $invoice->get_ip();
136
}
137
138
/**
139
 * @deprecated
140
 */
141
function wpinv_get_invoice_user_info( $invoice ) {
142
    $invoice = new WPInv_Invoice( $invoice );
143
    return $invoice->get_user_info();
144
}
145
146
/**
147
 * @deprecated
148
 */
149
function wpinv_subtotal( $invoice = 0, $currency = false ) {
150
    $invoice  = new WPInv_Invoice( $invoice );
151
    $subtotal = $invoice->get_subtotal();
152
153
    if ( $currency ) {
154
        return wpinv_price( wpinv_format_amount( $subtotal ), $invoice->get_currency() );
155
    }
156
157
    return $subtotal;
158
}
159
160
/**
161
 * @deprecated
162
 */
163
function wpinv_tax( $invoice = 0, $currency = false ) {
164
    $invoice  = new WPInv_Invoice( $invoice );
165
    $tax      = $invoice->get_total_tax();
166
167
    if ( $currency ) {
168
        return wpinv_price( wpinv_format_amount( $tax ), $invoice->get_currency() );
169
    }
170
171
    return $tax;
172
}
173
174
/**
175
 * @deprecated
176
 */
177
function wpinv_discount( $invoice = 0, $currency = false, $deprecated ) {
0 ignored issues
show
Unused Code introduced by
The parameter $deprecated is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

177
function wpinv_discount( $invoice = 0, $currency = false, /** @scrutinizer ignore-unused */ $deprecated ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
178
    $invoice  = new WPInv_Invoice( $invoice );
179
    $discount = $invoice->get_total_discount();
180
181
    if ( $currency ) {
182
        return wpinv_price( wpinv_format_amount( $discount ), $invoice->get_currency() );
183
    }
184
185
    return $discount;
186
}
187
188
/**
189
 * @deprecated
190
 */
191
function wpinv_discount_code( $invoice = 0 ) {
192
    $invoice = new WPInv_Invoice( $invoice );
193
    return $invoice->get_discount_code();
194
}
195
196
/**
197
 * @deprecated
198
 */
199
function wpinv_payment_total( $invoice = 0, $currency = false ) {
200
    $invoice  = new WPInv_Invoice( $invoice );
201
    $total = $invoice->get_total();
202
203
    if ( $currency ) {
204
        return wpinv_price( wpinv_format_amount( $total ), $invoice->get_currency() );
205
    }
206
207
    return $total;
208
}
209
210
/**
211
 * @deprecated
212
 */
213
function wpinv_get_date_created( $invoice = 0, $format = '' ) {
214
    $invoice = new WPInv_Invoice( $invoice );
215
216
    $format         = ! empty( $format ) ? $format : get_option( 'date_format' );
217
    $date_created   = $invoice->get_created_date();
218
219
    return empty( $date_created ) ? date_i18n( $format, strtotime( $date_created ) ) : '';
0 ignored issues
show
Bug introduced by
It seems like $format can also be of type false; however, parameter $format of date_i18n() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

219
    return empty( $date_created ) ? date_i18n( /** @scrutinizer ignore-type */ $format, strtotime( $date_created ) ) : '';
Loading history...
220
}
221
222
/**
223
 * @deprecated
224
 */
225
function wpinv_get_invoice_date( $invoice = 0, $format = '' ) {
226
    wpinv_get_date_created( $invoice, $format );
0 ignored issues
show
Deprecated Code introduced by
The function wpinv_get_date_created() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

226
    /** @scrutinizer ignore-deprecated */ wpinv_get_date_created( $invoice, $format );
Loading history...
227
}
228
229
/**
230
 * @deprecated
231
 */
232
function wpinv_get_invoice_vat_number( $invoice = 0 ) {
233
    $invoice = new WPInv_Invoice( $invoice );
234
    return $invoice->get_vat_number();
235
}
236
237
/**
238
 * @deprecated
239
 */
240
function wpinv_insert_payment_note( $invoice = 0, $note = '', $user_type = false, $added_by_user = false, $system = false ) {
241
    $invoice = new WPInv_Invoice( $invoice );
242
    return $invoice->add_note( $note, $user_type, $added_by_user, $system );
243
}
244
245
/**
246
 * @deprecated
247
 */
248
function wpinv_get_payment_key( $invoice = 0 ) {
249
	$invoice = new WPInv_Invoice( $invoice );
250
    return $invoice->get_key();
251
}
252
253
/**
254
 * @deprecated
255
 */
256
function wpinv_get_invoice_number( $invoice = 0 ) {
257
    $invoice = new WPInv_Invoice( $invoice );
258
    return $invoice->get_number();
259
}
260
261
/**
262
 * @deprecated
263
 */
264
function wpinv_get_cart_discountable_subtotal() {
265
    return 0;
266
}
267
268
/**
269
 * @deprecated
270
 */
271
function wpinv_get_cart_items_subtotal() {
272
    return 0;
273
}
274
275
/**
276
 * @deprecated
277
 */
278
function wpinv_get_cart_subtotal() {
279
    return 0;
280
}
281
282
/**
283
 * @deprecated
284
 */
285
function wpinv_cart_subtotal() {
286
    return 0;
287
}
288
289
/**
290
 * @deprecated
291
 */
292
function wpinv_get_cart_total() {
293
    return 0;
294
}
295
296
/**
297
 * @deprecated
298
 */
299
function wpinv_cart_total() {
300
    return 0;
301
}
302
303
/**
304
 * @deprecated
305
 */
306
function wpinv_get_cart_tax() {
307
    return 0;
308
}
309
310
/**
311
 * @deprecated
312
 */
313
function wpinv_cart_tax() {
314
    return 0;
315
}
316
317
/**
318
 * @deprecated
319
 */
320
function wpinv_get_cart_discount_code() {
321
    return '';
322
}
323
324
/**
325
 * @deprecated
326
 */
327
function wpinv_cart_discount_code() {
328
    return '';
329
}
330
331
/**
332
 * @deprecated
333
 */
334
function wpinv_get_cart_discount() {
335
    return 0;
336
}
337
338
/**
339
 * @deprecated
340
 */
341
function wpinv_cart_discount() {
342
    return '';
343
}
344
345
/**
346
 * @deprecated
347
 */
348
function wpinv_get_cart_fees() {
349
    return array();
350
}
351
352
/**
353
 * @deprecated
354
 */
355
function wpinv_get_cart_fee_total() {
356
    return 0;
357
}
358
359
/**
360
 * @deprecated
361
 */
362
function wpinv_get_cart_fee_tax() {
363
    return 0;
364
}
365
366
/**
367
 * @deprecated
368
 */
369
function wpinv_cart_has_recurring_item() {
370
    return false;
371
}
372
373
/**
374
 * @deprecated
375
 */
376
function wpinv_cart_has_free_trial() {
377
    return false;
378
}
379
380
/**
381
 * @deprecated
382
 */
383
function wpinv_get_cart_contents() {
384
    return array();
385
}
386
387
/**
388
 * @deprecated
389
 */
390
function wpinv_get_cart_content_details() {
391
    return array();
392
}
393
394
/**
395
 * @deprecated
396
 */
397
function wpinv_get_cart_details() {
398
    return array();
399
}
400
401
/**
402
 * @deprecated
403
 */
404
function wpinv_update_payment_status( $invoice, $new_status = 'publish' ) {    
405
    $invoice = new WPInv_Invoice( $invoice );
406
    return $invoice->update_status( $new_status );
407
}
408
409
/**
410
 * @deprecated
411
 */
412
function wpinv_cart_has_fees() {
413
    return false;
414
}
415
416
/**
417
 * @deprecated
418
 */
419
function wpinv_set_checkout_session() {
420
    return false;
421
}
422
423
/**
424
 * @deprecated
425
 */
426
function wpinv_get_checkout_session() {
427
	return false;
428
}
429
430
/**
431
 * @deprecated
432
 */
433
function wpinv_empty_cart() {
434
    return false;
435
}
436
437
/**
438
 * @deprecated
439
 */
440
function wpinv_display_invoice_totals() {}
441
442
/**
443
 * @deprecated
444
 */
445
function wpinv_checkout_billing_details() {
446
    return array();
447
}
448
449
/**
450
 * @deprecated
451
 */
452
function wpinv_register_post_types() {
453
    GetPaid_Post_Types::register_post_types();
454
}
455
456
/**
457
 * @deprecated
458
 */
459
function wpinv_set_payment_transaction_id( $invoice_id = 0, $transaction_id = '' ) {
460
461
    // Fetch the invoice.
462
    $invoice = new WPInv_Invoice( $invoice_id );
463
464
    if ( 0 ==  $invoice->get_id() ) {
465
        return false;
466
    }
467
468
    // Prepare the transaction id.
469
    if ( empty( $transaction_id ) ) {
470
        $transaction_id = $invoice_id;
471
    }
472
473
    // Set the transaction id;
474
    $invoice->set_transaction_id( apply_filters( 'wpinv_set_payment_transaction_id', $transaction_id, $invoice ) );
475
476
    // Save the invoice.
477
    return $invoice->save();
478
}
479
480
/**
481
 * @deprecated
482
 */
483
function wpinv_send_to_gateway( $gateway, $payment_data ) {
484
    $payment_data['gateway_nonce'] = wp_create_nonce('wpi-gateway');
485
    do_action( 'wpinv_gateway_' . $gateway, $payment_data );
486
}
487
488
/**
489
 * @deprecated
490
 */
491
function wpinv_die_handler() {
492
    die();
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
493
}
494
495
/**
496
 * @deprecated
497
 */
498
function wpinv_die( $message = '', $title = '', $status = 400 ) {
499
    add_filter( 'wp_die_ajax_handler', 'wpinv_die_handler', 10, 3 );
500
    add_filter( 'wp_die_handler', 'wpinv_die_handler', 10, 3 );
501
    wp_die( $message, $title, array( 'response' => $status ));
502
}
503
504
/**
505
 * @deprecated
506
 */
507
function wpinv_checkout_cart_columns() {
508
    return 4;
509
}
510
511
/**
512
 * @deprecated
513
 */
514
function wpinv_set_cart_discount() {
515
    return array();
516
}
517
518
/**
519
 * @deprecated
520
 */
521
function wpinv_unset_cart_discount() {
522
    return array();
523
}
524
525
/**
526
 * @deprecated
527
 */
528
function wpinv_cart_discounts_html() {}
529
530
/**
531
 * @deprecated
532
 */
533
function wpinv_get_cart_discounts_html() {}
534
535
/**
536
 * @deprecated
537
 */
538
function wpinv_display_cart_discount() {}
539
540
/**
541
 * @deprecated
542
 */
543
function wpinv_multiple_discounts_allowed() {
544
    return false;
545
}
546
547
/**
548
 * @deprecated
549
 */
550
function wpinv_get_cart_items_discount_amount() {
551
    return 0;
552
}
553
554
/**
555
 * @deprecated
556
 */
557
function wpinv_get_cart_item_discount_amount() {
558
    return 0;
559
}
560
561
/**
562
 * @deprecated.
563
 */
564
function wpinv_new_invoice_notification() {}
565
566
/**
567
 * @deprecated.
568
 */
569
function wpinv_cancelled_invoice_notification() {}
570
571
/**
572
 * @deprecated.
573
 */
574
function wpinv_failed_invoice_notification() {}
575
576
/**
577
 * @deprecated.
578
 */
579
function wpinv_onhold_invoice_notification() {}
580
581
/**
582
 * @deprecated.
583
 */
584
function wpinv_processing_invoice_notification() {}
585
586
/**
587
 * @deprecated.
588
 */
589
function wpinv_completed_invoice_notification() {}
590
591
/**
592
 * @deprecated.
593
 */
594
function wpinv_fully_refunded_notification() {}
595
596
/**
597
 * @deprecated.
598
 */
599
function wpinv_partially_refunded_notification() {}
600
601
/**
602
 * @deprecated
603
 */
604
function wpinv_new_invoice_note_notification() {}
605
606
/**
607
 * @deprecated
608
 */
609
function wpinv_user_invoice_notification() {}
610
611
/**
612
 * @deprecated
613
 */
614
function wpinv_user_note_notification() {}
615