Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
crefopay
WooCommerce
Commits
50236f2d
Commit
50236f2d
authored
Jun 18, 2021
by
Daniel Kazior
Browse files
Merge branch 'develop' into 'master'
Release 3.2.1 See merge request
!34
parents
43b8ab6c
b3537874
Changes
36
Hide whitespace changes
Inline
Side-by-side
crefopay-payment-solution.zip
View file @
50236f2d
No preview for this file type
crefopay-payment-solution/composer.json
View file @
50236f2d
{
"name"
:
"crefopay/woocommerce"
,
"description"
:
"CrefoPay Payment Solution for WooCommerce"
,
"version"
:
"3.2.
0
"
,
"version"
:
"3.2.
1
"
,
"readme"
:
"docs/de/admin_index.md"
,
"type"
:
"project"
,
"keywords"
:
[
"payment"
,
"crefopay"
,
"creditreform"
,
"riskmanagement"
,
"psp"
],
...
...
crefopay-payment-solution/crefopay-payment-solution.php
View file @
50236f2d
...
...
@@ -3,7 +3,7 @@
* Plugin Name: CrefoPay Payment Solution
* Plugin URI: https://repo.crefopay.de/crefopay/woocommerce
* Description: The complete solution for your eCommerce payments.
* Version: 3.2.
0
* Version: 3.2.
1
* Requires at least: 5.1
* Requires PHP: 7.2
* Author: Shakuras GbR
...
...
@@ -128,7 +128,7 @@ define('PHONE_REGEX', '/^(((((((00|\+)[0-9]{2}[ \\\\\-\/]?)|0)[1-9][0-9]{1,4})[
* Main Class of the CrefoPay payment plugin
*
* @class CrefoPay_Payment_Solution
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay-Payment-Solution
*/
class
Crefopay_Payment_Solution
...
...
@@ -344,7 +344,7 @@ class Crefopay_Payment_Solution
// Reserve payment
try
{
$logger
->
debug
(
"Now trying to reserve order
"
.
$orderID
.
"
with paymentInstrumentID "
.
$_POST
[
'paymentInstrumentId'
]);
$logger
->
debug
(
"Now trying to reserve order
{
$orderID
}
with paymentInstrumentID "
.
$_POST
[
'paymentInstrumentId'
]);
$payment
->
setPaymentInstrumentID
(
$_POST
[
'paymentInstrumentId'
])
->
setOrderID
(
$order
->
get_order_number
())
...
...
crefopay-payment-solution/includes/callbacks/class-wc-api-callback.php
View file @
50236f2d
...
...
@@ -13,7 +13,7 @@ require_once plugin_dir_path(__FILE__) . '../controllers/class-wc-api-callback-p
*
* @class WC_API_CrefoPay_Api_Callback
* @extends WC_API
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay-Payment-Solution\Callbacks
*/
class
WC_API_CrefoPay_Api_Callback
extends
WC_API
...
...
@@ -23,18 +23,16 @@ class WC_API_CrefoPay_Api_Callback extends WC_API
*/
private
$logger
;
/**
* Callback constructor
*/
public
function
__construct
()
{
$this
->
logger
=
wc_get_logger
(
'class-wc-api-callback'
);
add_action
(
'woocommerce_api_success_callback'
,
array
(
$this
,
'success_callback_handler'
));
add_action
(
'woocommerce_api_failure_callback'
,
array
(
$this
,
'failure_callback_handler'
));
add_action
(
'woocommerce_api_success_callback'
,
array
(
$this
,
'success_callback_handler'
));
add_action
(
'woocommerce_api_failure_callback'
,
array
(
$this
,
'failure_callback_handler'
));
}
/**
* Process success callback
*
...
...
@@ -50,6 +48,35 @@ class WC_API_CrefoPay_Api_Callback extends WC_API
try
{
$handler
=
new
CrefoPay_API_Callback_Processor
(
$orderID
);
$order
=
$handler
->
run
();
// Getting payment method option paymentComleteState
switch
(
$order
->
get_payment_method
())
{
case
"crefopay_creditcard"
:
$gateway
=
new
WC_Crefo_CreditCard
();
$paymentCompleteOption
=
$gateway
->
get_option
(
'paymentCompleteState'
);
break
;
case
"crefopay_paypal"
:
$gateway
=
new
WC_Crefo_PayPal
();
$paymentCompleteOption
=
$gateway
->
get_option
(
'paymentCompleteState'
);
break
;
case
"crefopay_sofort"
:
$gateway
=
new
WC_Crefo_Sofort
();
$paymentCompleteOption
=
$gateway
->
get_option
(
'paymentCompleteState'
);
break
;
default
:
$this
->
logger
->
warning
(
"Unknown payment method "
.
$order
->
get_payment_method
());
$paymentCompleteOption
=
'on-hold'
;
break
;
}
// Set after payment state
if
(
$paymentCompleteOption
!=
'disabled'
)
{
if
(
$order
->
update_status
(
$paymentCompleteOption
,
__
(
'Payment reservation completed'
,
'crefopay-payment-solution'
)))
{
$this
->
logger
->
debug
(
"successfully set new order state "
.
$paymentCompleteOption
);
}
else
{
$this
->
logger
->
error
(
"unable to set new order state "
.
$paymentCompleteOption
);
}
}
}
catch
(
\
Exception
$e
)
{
$this
->
logger
->
error
(
'crefoApiCallback Exception: '
.
$e
->
getMessage
());
exit
;
...
...
@@ -59,7 +86,6 @@ class WC_API_CrefoPay_Api_Callback extends WC_API
wp_safe_redirect
(
$order
->
get_checkout_order_received_url
());
}
/**
* Process failure callback
*
...
...
crefopay-payment-solution/includes/callbacks/class-wc-notification-callback.php
View file @
50236f2d
...
...
@@ -16,7 +16,7 @@ use Upg\Library\Mns\Handler;
*
* @class WC_API_Crefo_Notification_Callback
* @extends WC_API
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay-Payment-Solution\Callbacks
*/
class
WC_API_Crefo_Notification_Callback
extends
WC_API
...
...
@@ -44,7 +44,7 @@ class WC_API_Crefo_Notification_Callback extends WC_API
$this
->
logger
=
wc_get_logger
(
'class-wc-notification-callback'
);
$this
->
callbackProcessor
=
new
CrefoPay_Notification_Callback_Processor
();
$this
->
notificationProcessor
=
new
CrefoPay_Notification_Processor
();
add_action
(
'woocommerce_api_notification_callback'
,
array
(
$this
,
'notification_callback_handler'
));
add_action
(
'woocommerce_api_notification_process'
,
array
(
$this
,
'notification_process_handler'
));
}
...
...
@@ -56,6 +56,16 @@ class WC_API_Crefo_Notification_Callback extends WC_API
*/
public
function
notification_callback_handler
()
{
// check version compatibility
if
(
!
empty
(
$_POST
[
'version'
]))
{
if
(
version_compare
(
'2.2'
,
$_POST
[
'version'
])
<
0
)
{
$this
->
logger
->
emergency
(
"got invalid notification version: "
.
$_POST
[
'version'
]
.
" - some relevant payment information may have been lost; we strongly recommend contacting service@crefopay.de!"
);
exit
(
http_response_code
(
200
));
}
}
try
{
$handler
=
new
Handler
(
CrefoPay
::
getInstance
()
->
getConfig
(),
$_POST
,
$this
->
callbackProcessor
);
$handler
->
run
();
...
...
@@ -66,6 +76,12 @@ class WC_API_Crefo_Notification_Callback extends WC_API
$this
->
logger
->
error
(
'notification callback ParamNotProvided.Exception: '
.
$paramInvalid
->
getMessage
());
exit
(
http_response_code
(
400
));
}
catch
(
\
Exception
$e
)
{
// Order not found but that may be caused by a Pay by Link transaction
if
(
$e
->
getCode
()
==
404
)
{
$this
->
logger
->
info
(
'notification callback Exception: '
.
$e
->
getMessage
());
exit
(
http_response_code
(
200
));
}
$this
->
logger
->
error
(
'notification callback Exception: '
.
$e
->
getMessage
());
exit
(
http_response_code
(
400
));
}
...
...
@@ -78,7 +94,7 @@ class WC_API_Crefo_Notification_Callback extends WC_API
*/
public
function
notification_process_handler
()
{
$processor
=
new
CrefoPay_Notification_Processor
();
$args
=
array
(
'type'
=>
'shop_order'
,
'date_modified'
=>
'>'
.
(
time
()
-
(
60
*
60
*
24
)),
...
...
@@ -87,7 +103,7 @@ class WC_API_Crefo_Notification_Callback extends WC_API
if
(
$order
->
meta_exists
(
META_TAG_MNS
))
{
$mnsQueue
=
$order
->
get_meta
(
META_TAG_MNS
);
try
{
$
p
rocessor
->
process_mns
(
$order
,
$mnsQueue
);
$
this
->
notificationP
rocessor
->
process_mns
(
$order
,
$mnsQueue
);
$order
->
update_meta_data
(
META_TAG_MNS
,
$mnsQueue
);
$order
->
save
();
}
catch
(
Exception
$e
)
{
...
...
crefopay-payment-solution/includes/controllers/class-wc-api-callback-processor.php
View file @
50236f2d
...
...
@@ -12,7 +12,7 @@ require_once plugin_dir_path(__FILE__) . '../controllers/class-wc-crefopay.php';
* Process redirect payments
*
* @class WC_API_CrefoPay_Api_Callback
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay-Payment-Solution\Controllers
*/
class
CrefoPay_API_Callback_Processor
...
...
@@ -56,7 +56,7 @@ class CrefoPay_API_Callback_Processor
// Empty cart before redirect to "thank you" page
$woocommerce
->
cart
->
empty_cart
();
$this
->
logger
->
debug
(
"Successfully
updat
ed order: "
.
$this
->
orderId
.
" after callback."
);
$this
->
logger
->
debug
(
"Successfully
load
ed order: "
.
$this
->
orderId
.
" after callback."
);
return
$order
;
}
else
{
$this
->
logger
->
error
(
"Unable to load order: "
.
$this
->
orderId
.
" from callback."
);
...
...
crefopay-payment-solution/includes/controllers/class-wc-crefopay.php
View file @
50236f2d
...
...
@@ -52,7 +52,7 @@ use Upg\Library\Validation\Validation;
*
* @class CrefoPay
* @autoloads Upg\Library
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay-Payment-Solution\Controllers
*/
class
CrefoPay
...
...
@@ -923,6 +923,10 @@ class CrefoPay
}
}
if
((
int
)
$this
->
options
[
'crefopay_overcapture_factor'
]
>
0
)
{
$amount
->
setAmount
(
round
(
$amount
->
getAmount
()
*
$this
->
options
[
'crefopay_overcapture_factor'
]));
}
try
{
$this
->
request
=
new
ReserveRequest
(
$this
->
config
);
$this
->
request
...
...
crefopay-payment-solution/includes/controllers/class-wc-helper-germanized.php
View file @
50236f2d
...
...
@@ -14,7 +14,7 @@ if ( class_exists( 'WC_GZD_Email_Customer_Paid_For_Order' ) ) :
* from the WooCommerce Germanized extension.
*
* @class CrefoPay_GZD_Email_Customer_Paid_For_Order
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay-Payment-Solution\Controllers
*/
class
CrefoPay_GZD_Email_Customer_Paid_For_Order
extends
WC_GZD_Email_Customer_Paid_For_Order
...
...
crefopay-payment-solution/includes/controllers/class-wc-notification-callback-processor.php
View file @
50236f2d
...
...
@@ -16,7 +16,7 @@ use Upg\Library\Mns\ProcessorInterface;
*
* @class CrefoPay_Notification_Callback_Processor
* @implements Upg\Library\Mns\ProcessorInterface
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay-Payment-Solution\Controllers
*/
class
CrefoPay_Notification_Callback_Processor
implements
ProcessorInterface
...
...
@@ -215,7 +215,7 @@ class CrefoPay_Notification_Callback_Processor implements ProcessorInterface
// if it's still empty we were unable to find the order
if
(
!
$order
)
{
throw
new
Exception
(
"unable to
loa
d order with CrefoPay orderID
{
$this
->
orderID
}
"
);
throw
new
Exception
(
"unable to
fin
d order with CrefoPay orderID
{
$this
->
orderID
}
"
,
404
);
}
$mnsQueue
[]
=
$this
->
getMnsArray
();
...
...
crefopay-payment-solution/includes/controllers/class-wc-notification-processor.php
View file @
50236f2d
...
...
@@ -10,7 +10,7 @@ defined('ABSPATH') or die('No script kiddies please!');
* Process CrefoPay notifications.
*
* @class CrefoPay_Notification_Processor
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay-Payment-Solution\Controllers
*/
class
CrefoPay_Notification_Processor
...
...
@@ -61,13 +61,20 @@ class CrefoPay_Notification_Processor
*/
public
function
process_mns
(
WC_Order
&
$order
,
array
&
$mnsQueue
)
{
$
this
->
options
=
get_option
(
'igp_settings'
);
$options
=
get_option
(
'igp_settings'
);
$index
=
0
;
foreach
(
$mnsQueue
as
$mns
)
{
if
(
$mns
[
'processed'
])
{
$this
->
logger
->
debug
(
"mns already processed: "
.
print_r
(
$mns
,
true
));
}
else
{
$this
->
logger
->
debug
(
"now processing mns for order "
.
$order
->
get_order_number
()
.
": "
.
print_r
(
$mns
,
true
));
// complete payment by tx-state:
if
(
$this
->
getMnsStatus
(
$mns
)
==
$options
[
'crefopay_orderstate_payment_complete'
])
{
$this
->
logger
->
debug
(
"complete the payment"
);
$order
->
payment_complete
(
$this
->
orderID
);
}
switch
(
$this
->
getMnsStatus
(
$mns
))
{
// Transaction states:
...
...
@@ -86,8 +93,8 @@ class CrefoPay_Notification_Processor
break
;
case
self
::
STATE_CIAPENDING
:
if
(
$
this
->
options
[
'crefopay_orderstate_cia_pending'
]
!=
'disabled'
)
{
$newState
=
empty
(
$
this
->
options
[
'crefopay_orderstate_cia_pending'
])
?
ORDER_STATE_CIA_PENDING
:
$
this
->
options
[
'crefopay_orderstate_cia_pending'
];
if
(
$options
[
'crefopay_orderstate_cia_pending'
]
!=
'disabled'
)
{
$newState
=
empty
(
$options
[
'crefopay_orderstate_cia_pending'
])
?
ORDER_STATE_CIA_PENDING
:
$options
[
'crefopay_orderstate_cia_pending'
];
$this
->
logger
->
debug
(
"set new order status: "
.
$newState
);
if
(
$order
->
set_status
(
$newState
,
__
(
'TRANSACTION_CIAPENDING'
,
'crefopay-payment-solution'
)))
{
$this
->
logger
->
debug
(
"successfully set new order state "
.
$newState
);
...
...
@@ -98,14 +105,8 @@ class CrefoPay_Notification_Processor
break
;
case
self
::
STATE_MERCHANTPENDING
:
// Complete the payment
if
(
$order
->
get_payment_method
()
!=
'crefopay_invoice'
)
{
$this
->
logger
->
debug
(
"complete the payment"
);
$order
->
payment_complete
(
$this
->
orderID
);
}
if
(
$this
->
options
[
'crefopay_orderstate_merchant_pending'
]
!=
'disabled'
)
{
$newState
=
empty
(
$this
->
options
[
'crefopay_orderstate_merchant_pending'
])
?
ORDER_STATE_RESERVED
:
$this
->
options
[
'crefopay_orderstate_merchant_pending'
];
if
(
$options
[
'crefopay_orderstate_merchant_pending'
]
!=
'disabled'
)
{
$newState
=
empty
(
$options
[
'crefopay_orderstate_merchant_pending'
])
?
ORDER_STATE_RESERVED
:
$options
[
'crefopay_orderstate_merchant_pending'
];
$this
->
logger
->
debug
(
"set new order status: "
.
$newState
);
if
(
$order
->
set_status
(
$newState
,
__
(
'TRANSACTION_MERCHANTPENDING'
,
'crefopay-payment-solution'
)))
{
...
...
@@ -117,8 +118,8 @@ class CrefoPay_Notification_Processor
break
;
case
self
::
STATE_FRAUDPENDING
:
if
(
$
this
->
options
[
'crefopay_orderstate_fraud_pending'
]
!=
'disabled'
)
{
$newState
=
empty
(
$
this
->
options
[
'crefopay_orderstate_fraud_pending'
])
?
ORDER_STATE_FRAUDPENDING
:
$
this
->
options
[
'crefopay_orderstate_fraud_pending'
];
if
(
$options
[
'crefopay_orderstate_fraud_pending'
]
!=
'disabled'
)
{
$newState
=
empty
(
$options
[
'crefopay_orderstate_fraud_pending'
])
?
ORDER_STATE_FRAUDPENDING
:
$options
[
'crefopay_orderstate_fraud_pending'
];
$this
->
logger
->
debug
(
"set new order status: "
.
$newState
);
if
(
$order
->
set_status
(
$newState
,
__
(
'TRANSACTION_FRAUDPENDING'
,
'crefopay-payment-solution'
)))
{
$this
->
logger
->
debug
(
"successfully set new order state "
.
$newState
);
...
...
@@ -129,8 +130,8 @@ class CrefoPay_Notification_Processor
break
;
case
self
::
STATE_IN_PROGRESS
:
if
(
$
this
->
options
[
'crefopay_orderstate_in_progress'
]
!=
'disabled'
)
{
$newState
=
empty
(
$
this
->
options
[
'crefopay_orderstate_in_progress'
])
?
ORDER_STATE_PROCESSING
:
$
this
->
options
[
'crefopay_orderstate_in_progress'
];
if
(
$options
[
'crefopay_orderstate_in_progress'
]
!=
'disabled'
)
{
$newState
=
empty
(
$options
[
'crefopay_orderstate_in_progress'
])
?
ORDER_STATE_PROCESSING
:
$options
[
'crefopay_orderstate_in_progress'
];
$this
->
logger
->
debug
(
"set new order status: "
.
$newState
);
if
(
$order
->
set_status
(
$newState
,
__
(
'TRANSACTION_IN_PROGRESS'
,
'crefopay-payment-solution'
)))
{
$this
->
logger
->
debug
(
"successfully set new order state "
.
$newState
);
...
...
@@ -141,8 +142,8 @@ class CrefoPay_Notification_Processor
break
;
case
self
::
STATE_FRAUDCANCELLED
:
if
(
$
this
->
options
[
'crefopay_orderstate_fraud_cancelled'
]
!=
'disabled'
)
{
$newState
=
empty
(
$
this
->
options
[
'crefopay_orderstate_fraud_cancelled'
])
?
ORDER_STATE_CANCELLED
:
$
this
->
options
[
'crefopay_orderstate_fraud_cancelled'
];
if
(
$options
[
'crefopay_orderstate_fraud_cancelled'
]
!=
'disabled'
)
{
$newState
=
empty
(
$options
[
'crefopay_orderstate_fraud_cancelled'
])
?
ORDER_STATE_CANCELLED
:
$options
[
'crefopay_orderstate_fraud_cancelled'
];
$this
->
logger
->
debug
(
"set new order status: "
.
$newState
);
if
(
$order
->
set_status
(
$newState
,
__
(
'TRANSACTION_FRAUDCANCELLED'
,
'crefopay-payment-solution'
)))
{
$this
->
logger
->
debug
(
"successfully set new order state "
.
$newState
);
...
...
@@ -153,8 +154,8 @@ class CrefoPay_Notification_Processor
break
;
case
self
::
STATE_CANCELLED
:
if
(
$
this
->
options
[
'crefopay_orderstate_cancelled'
]
!=
'disabled'
)
{
$newState
=
empty
(
$
this
->
options
[
'crefopay_orderstate_cancelled'
])
?
ORDER_STATE_CANCELLED
:
$
this
->
options
[
'crefopay_orderstate_cancelled'
];
if
(
$options
[
'crefopay_orderstate_cancelled'
]
!=
'disabled'
)
{
$newState
=
empty
(
$options
[
'crefopay_orderstate_cancelled'
])
?
ORDER_STATE_CANCELLED
:
$options
[
'crefopay_orderstate_cancelled'
];
$this
->
logger
->
debug
(
"set new order status: "
.
$newState
);
if
(
$order
->
set_status
(
$newState
,
__
(
'TRANSACTION_CANCELLED'
,
'crefopay-payment-solution'
)))
{
$this
->
logger
->
debug
(
"successfully set new order state "
.
$newState
);
...
...
@@ -165,8 +166,8 @@ class CrefoPay_Notification_Processor
break
;
case
self
::
STATE_EXPIRED
:
if
(
$
this
->
options
[
'crefopay_orderstate_expired'
]
!=
'disabled'
)
{
$newState
=
empty
(
$
this
->
options
[
'crefopay_orderstate_expired'
])
?
ORDER_STATE_FAILED
:
$
this
->
options
[
'crefopay_orderstate_expired'
];
if
(
$options
[
'crefopay_orderstate_expired'
]
!=
'disabled'
)
{
$newState
=
empty
(
$options
[
'crefopay_orderstate_expired'
])
?
ORDER_STATE_FAILED
:
$options
[
'crefopay_orderstate_expired'
];
if
(
$order
->
get_status
()
==
'pending'
)
{
...
...
@@ -189,8 +190,8 @@ class CrefoPay_Notification_Processor
$order
->
payment_complete
(
$mns
[
'orderID'
]);
$this
->
sendGzdEmailConfirmation
(
$mns
[
'orderID'
]);
}
if
(
$
this
->
options
[
'crefopay_orderstate_done'
]
!=
'disabled'
)
{
$newState
=
empty
(
$
this
->
options
[
'crefopay_orderstate_done'
])
?
ORDER_STATE_DONE
:
$
this
->
options
[
'crefopay_orderstate_done'
];
if
(
$options
[
'crefopay_orderstate_done'
]
!=
'disabled'
)
{
$newState
=
empty
(
$options
[
'crefopay_orderstate_done'
])
?
ORDER_STATE_DONE
:
$options
[
'crefopay_orderstate_done'
];
$this
->
logger
->
debug
(
"set new order status: "
.
$newState
);
if
(
$order
->
set_status
(
$newState
,
__
(
'TRANSACTION_DONE'
,
'crefopay-payment-solution'
)))
{
$this
->
logger
->
debug
(
"successfully set new order state "
.
$newState
);
...
...
@@ -237,8 +238,8 @@ class CrefoPay_Notification_Processor
case
self
::
STATE_INDUNNING
:
$newState
=
ORDER_STATE_INDUNNING
;
$this
->
logger
->
debug
(
"set new order status: "
.
$newState
);
if
(
$
this
->
options
[
'crefopay_orderstate_in_dunning'
]
!=
'disabled'
)
{
$newState
=
empty
(
$
this
->
options
[
'crefopay_orderstate_in_dunning'
])
?
ORDER_STATE_INDUNNING
:
$
this
->
options
[
'crefopay_orderstate_in_dunning'
];
if
(
$options
[
'crefopay_orderstate_in_dunning'
]
!=
'disabled'
)
{
$newState
=
empty
(
$options
[
'crefopay_orderstate_in_dunning'
])
?
ORDER_STATE_INDUNNING
:
$options
[
'crefopay_orderstate_in_dunning'
];
$this
->
logger
->
debug
(
"set new order status: "
.
$newState
);
if
(
$order
->
set_status
(
$newState
,
__
(
'TRANSACTION_INDUNNING'
,
'crefopay-payment-solution'
)))
{
$this
->
logger
->
debug
(
"successfully set new order state "
.
$newState
);
...
...
@@ -251,8 +252,8 @@ class CrefoPay_Notification_Processor
case
self
::
STATE_IN_COLLECTION
:
$newState
=
ORDER_STATE_INCOLLECTION
;
$this
->
logger
->
debug
(
"set new order status: "
.
$newState
);
if
(
$
this
->
options
[
'crefopay_orderstate_in_collection'
]
!=
'disabled'
)
{
$newState
=
empty
(
$
this
->
options
[
'crefopay_orderstate_in_collection'
])
?
ORDER_STATE_INCOLLECTION
:
$
this
->
options
[
'crefopay_orderstate_in_collection'
];
if
(
$options
[
'crefopay_orderstate_in_collection'
]
!=
'disabled'
)
{
$newState
=
empty
(
$options
[
'crefopay_orderstate_in_collection'
])
?
ORDER_STATE_INCOLLECTION
:
$options
[
'crefopay_orderstate_in_collection'
];
$this
->
logger
->
debug
(
"set new order status: "
.
$newState
);
if
(
$order
->
set_status
(
$newState
,
__
(
'TRANSACTION_INCOLLECTION'
,
'crefopay-payment-solution'
)))
{
$this
->
logger
->
debug
(
"successfully set new order state "
.
$newState
);
...
...
crefopay-payment-solution/includes/gateways/class-wc-crefopay-gateway-exception.php
View file @
50236f2d
...
...
@@ -19,7 +19,7 @@ require_once plugin_dir_path(__FILE__) . '../models/class-wc-crefopay-error.php'
*
* @class WC_Crefo_Exception
* @extends WC_Data_Exception
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay Payment Solution
*/
class
WC_Crefo_Exception
extends
WC_Data_Exception
...
...
crefopay-payment-solution/includes/gateways/class-wc-payment-gateway-creditcard.php
View file @
50236f2d
...
...
@@ -14,7 +14,7 @@ require_once plugin_dir_path(__FILE__) . '../controllers/class-wc-crefopay.php';
*
* @class WC_Crefo_Credit Card
* @extends WC_Crefo_Gateway
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay Payment Solution
*/
class
WC_Crefo_CreditCard
extends
WC_Crefo_Gateway
...
...
crefopay-payment-solution/includes/gateways/class-wc-payment-gateway-debit.php
View file @
50236f2d
...
...
@@ -15,7 +15,7 @@ require_once plugin_dir_path(__FILE__) . 'class-wc-payment-gateway.php';
*
* @class WC_Crefo_Debit
* @extends WC_Crefo_Gateway
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay-Payment-Solution\Gateways
*/
class
WC_Crefo_Debit
extends
WC_Crefo_Gateway
...
...
crefopay-payment-solution/includes/gateways/class-wc-payment-gateway-invoice.php
View file @
50236f2d
...
...
@@ -13,7 +13,7 @@ require_once plugin_dir_path(__FILE__) . 'class-wc-payment-gateway.php';
*
* @class WC_Crefo_Invoice
* @extends WC_Crefo_Gateway
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay-Payment-Solution\Gateways
*/
class
WC_Crefo_Invoice
extends
WC_Crefo_Gateway
...
...
@@ -59,13 +59,6 @@ class WC_Crefo_Invoice extends WC_Crefo_Gateway
$parent_fields
=
parent
::
init_form_fields
();
$this
->
form_fields
=
array_merge
(
$parent_fields
,
array
(
'crefopay_set_complete_invoice'
=>
array
(
'title'
=>
__
(
'Set Payment Complete for invoice'
,
'crefopay-payment-solution'
),
'type'
=>
'checkbox'
,
'description'
=>
__
(
'Set Payment Complete for invoice Description'
,
'crefopay-payment-solution'
),
'default'
=>
'no'
,
'desc_tip'
=>
true
,
),
'label_birthdate'
=>
array
(
'title'
=>
__
(
'Label Birthdate'
,
'crefopay-payment-solution'
),
'type'
=>
'text'
,
...
...
@@ -190,23 +183,4 @@ if (!empty($this->get_option('label_birthdate'))) {
$this
->
dateOfBirth
=
$birthdate
;
return
true
;
}
/**
* After payment actions
*
* @param WC_Order $order
* @return void
*/
public
function
finish_payment
(
$order
)
{
if
(
$this
->
get_option
(
'crefopay_set_complete_invoice'
)
==
'yes'
)
{
$order
->
payment_complete
(
$order
->
get_order_number
());
}
else
{
if
(
$order
->
update_status
(
ORDER_STATE_CIA_PENDING
,
__
(
'Awaiting invoice payment'
,
'crefopay-payment-solution'
)))
{
$this
->
logger
->
debug
(
"successfully set new order state "
.
ORDER_STATE_CIA_PENDING
);
}
else
{
$this
->
logger
->
error
(
"unable to set new order state "
.
ORDER_STATE_CIA_PENDING
);
}
}
}
}
crefopay-payment-solution/includes/gateways/class-wc-payment-gateway-paypal.php
View file @
50236f2d
...
...
@@ -13,7 +13,7 @@ require_once plugin_dir_path(__FILE__) . 'class-wc-payment-gateway.php';
*
* @class WC_Crefo_PayPal
* @extends WC_Crefo_Gateway
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay Payment Solution
*/
class
WC_Crefo_PayPal
extends
WC_Crefo_Gateway
...
...
crefopay-payment-solution/includes/gateways/class-wc-payment-gateway-prepaid.php
View file @
50236f2d
...
...
@@ -13,7 +13,7 @@ require_once plugin_dir_path(__FILE__) . 'class-wc-payment-gateway.php';
*
* @class WC_Crefo_Prepaid
* @extends WC_Crefo_Gateway
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay Payment Solution
*/
class
WC_Crefo_Prepaid
extends
WC_Crefo_Gateway
...
...
@@ -34,42 +34,4 @@ class WC_Crefo_Prepaid extends WC_Crefo_Gateway
return
parent
::
__construct
();
}
/**
* form field init
*/
public
function
init_form_fields
()
{
$parent_fields
=
parent
::
init_form_fields
();
$this
->
form_fields
=
array_merge
(
$parent_fields
,
array
(
'crefopay_call_onhold_ciapending'
=>
array
(
'title'
=>
__
(
'Set on-hold state for prepaid'
,
'crefopay-payment-solution'
),
'type'
=>
'checkbox'
,
'description'
=>
__
(
'Set on-hold state for prepaids Description'
,
'crefopay-payment-solution'
),
'default'
=>
'yes'
,
'desc_tip'
=>
true
,
),
));
}
/**
* After payment actions
*
* @param WC_Order $order
* @return void
*/
public
function
finish_payment
(
$order
)
{
if
(
$this
->
get_option
(
'crefopay_call_onhold_ciapending'
)
==
'yes'
)
{
if
(
$order
->
update_status
(
ORDER_STATE_CIA_PENDING
,
__
(
'Awaiting prepaid payment'
,
'crefopay-payment-solution'
)))
{
$this
->
logger
->
debug
(
"successfully set new order state "
.
ORDER_STATE_CIA_PENDING
);
}
else
{
$this
->
logger
->
error
(
"unable to set new order state "
.
ORDER_STATE_CIA_PENDING
);
}
}
}
}
crefopay-payment-solution/includes/gateways/class-wc-payment-gateway-sofort.php
View file @
50236f2d
...
...
@@ -13,7 +13,7 @@ require_once plugin_dir_path(__FILE__) . 'class-wc-payment-gateway.php';
*
* @class WC_Crefo_Sofort
* @extends WC_Crefo_Gateway
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay Payment Solution
*/
class
WC_Crefo_Sofort
extends
WC_Crefo_Gateway
...
...
crefopay-payment-solution/includes/gateways/class-wc-payment-gateway.php
View file @
50236f2d
<?php
if
(
!
defined
(
'ABSPATH'
))
{
if
(
!
defined
(
'ABSPATH'
))
{
exit
;
}
...
...
@@ -15,7 +15,7 @@ use Upg\Library\Request\Objects\PaymentInstrument;
*
* @class WC_Crefo_Gateway
* @extends WC_Payment_Gateway
* @version 3.2.
0
* @version 3.2.
1
* @package CrefoPay-Payment-Solution\Gateways
*/
abstract
class
WC_Crefo_Gateway
extends
WC_Payment_Gateway
...
...
@@ -26,7 +26,7 @@ abstract class WC_Crefo_Gateway extends WC_Payment_Gateway
* @var const string
*/
const
CREFO_INTEGRATION_TYPE
=
'API'
;
/**
* @var WooCommerce\WC_Logger
*/
...
...
@@ -66,7 +66,7 @@ abstract class WC_Crefo_Gateway extends WC_Payment_Gateway
$this
->
description
=
$this
->
get_option
(
'description'
);
$this
->
method_description
=
$this
->
get_option
(
'description'
);
$this
->
supports
=
array
(
'refunds'
'refunds'
,
);
$this
->
logger
=
wc_get_logger
(
'class-wc-crefo-gateway'
);
$this
->
payment_error
=
$this
->
get_option
(
'payment_error'
);
...
...
@@ -78,23 +78,23 @@ abstract class WC_Crefo_Gateway extends WC_Payment_Gateway
if
(
is_admin
())
{
add_action
(
'woocommerce_update_options_payment_gateways_'
.
$this
->
id
,
array
(
$this
,
'process_admin_options'
));
}
// add capture and canlcel action