| 1 |
<?php if ( ! defined( 'ABSPATH' ) ) exit;/*Exit if accessed directly*/ ?> |
| 2 |
<?php |
| 3 |
/* |
| 4 |
GATEWAY : CASH ON DELIVERY (COD) |
| 5 |
*/ |
| 6 |
?> |
| 7 |
<?php |
| 8 |
function wppizza_register_wppizza_gateway_cod( $gateways ) { |
| 9 |
$gateways[] = 'WPPIZZA_GATEWAY_COD'; |
| 10 |
return $gateways; |
| 11 |
} |
| 12 |
add_filter( 'wppizza_register_gateways', 'wppizza_register_wppizza_gateway_cod' ); |
| 13 |
|
| 14 |
|
| 15 |
/**must start with WPPIZZA_GATEWAY_**/ |
| 16 |
class WPPIZZA_GATEWAY_COD{ |
| 17 |
|
| 18 |
/***************************** |
| 19 |
[required] |
| 20 |
*****************************/ |
| 21 |
/* |
| 22 |
@type : string( must NOT be empty) |
| 23 |
@param : gateway version number |
| 24 |
*/ |
| 25 |
public $gatewayVersion = WPPIZZA_VERSION; |
| 26 |
|
| 27 |
/* |
| 28 |
@type : string (must NOT be empty) |
| 29 |
@param : string |
| 30 |
gateway name |
| 31 |
*/ |
| 32 |
public $gatewayName = 'Cash on Delivery'; |
| 33 |
|
| 34 |
/* |
| 35 |
@type : array |
| 36 |
@param : options of gateway |
| 37 |
*/ |
| 38 |
public $gatewayOptions = array(); |
| 39 |
|
| 40 |
/* |
| 41 |
@type : string (can be empty) |
| 42 |
@param : string |
| 43 |
additional description of gateway displayed in ADMIN area |
| 44 |
*/ |
| 45 |
public $gatewayDescription = ''; |
| 46 |
|
| 47 |
/* |
| 48 |
@type : string (can be empty) |
| 49 |
@param : string |
| 50 |
default printed under gateway options FRONTEND |
| 51 |
can be changed/localized/emptied in admin |
| 52 |
*/ |
| 53 |
public $gatewayAdditionalInfo = ''; |
| 54 |
|
| 55 |
/* |
| 56 |
@type : bool |
| 57 |
@param : bool |
| 58 |
enable discounts on usage (rather than surcharges) |
| 59 |
*/ |
| 60 |
public $gatewayDiscount = true; |
| 61 |
|
| 62 |
/* |
| 63 |
@type : bool |
| 64 |
@param : bool |
| 65 |
automatically enable on install |
| 66 |
*/ |
| 67 |
public $gatewayAutoEnable = true; |
| 68 |
|
| 69 |
|
| 70 |
/****************************** |
| 71 |
[optional] |
| 72 |
but recommended |
| 73 |
******************************/ |
| 74 |
/* |
| 75 |
@type : string |
| 76 |
@param : 'prepay' or 'cod'. |
| 77 |
omit or set distinctly to "prepay" (i.e for cc's and other payment processors) |
| 78 |
set to 'cod' to simply have another payment option that works like the wppizza inbuilt cod payment |
| 79 |
(if you want that, simply set the parameters above, empty the construct and delete all methods) |
| 80 |
*/ |
| 81 |
public $gatewayType = 'cod'; |
| 82 |
|
| 83 |
/* |
| 84 |
avoid php 8.2+ depracated notices |
| 85 |
*/ |
| 86 |
public $gatewayIdent; |
| 87 |
public $gatewayOptionName; |
| 88 |
public $gatewaySettings; |
| 89 |
|
| 90 |
/****************************************************************************************************************** |
| 91 |
* |
| 92 |
* |
| 93 |
* [construct] |
| 94 |
* |
| 95 |
* |
| 96 |
******************************************************************************************************************/ |
| 97 |
function __construct() { |
| 98 |
/************************ |
| 99 |
[get gateway options] |
| 100 |
************************/ |
| 101 |
$this -> gatewayOptions = get_option(__CLASS__, 0); |
| 102 |
} |
| 103 |
} |
| 104 |
?> |