Commit a33fbd84 authored by Vincent Mrose's avatar Vincent Mrose 💬
Browse files

Merge branch 'release/2.3.1'

parents 6185241a 3e906466
......@@ -3,3 +3,4 @@
define("UPG_MODULE_TITLE",'CrefoPay');
define("UPG_MODULE_TITLE_ADMIN",'CrefoPay');
define("UPG_MODULE_FRONTEND_TITLE","CrefoPay");
define("UPG_MODULE_FRONTEND_DESC","Die Komplettlösung für Ihre Zahlungsabwicklung");
......@@ -59,7 +59,8 @@ class WC_Gateway_Hosted_Payments extends WC_Payment_Gateway
'options' => array(
\Upg\Library\Request\Objects\Person::SALUTATIONMALE => __('Male', $this->id),
\Upg\Library\Request\Objects\Person::SALUTATIONFEMALE => __('Female', $this->id),
)
),
'priority' => 9,
);
$checkoutFields = $fields['billing'];
......@@ -74,21 +75,25 @@ class WC_Gateway_Hosted_Payments extends WC_Payment_Gateway
array(
'billing_upg_company_registration_id' => array(
'label' => __('Company Registration ID', 'upg'),
'class' => array('form-row-wide')
'class' => array('form-row-wide'),
'priority' => 31,
),
'billing_upg_company_vat_id' => array(
'label' => __('Company VAT ID', 'upg'),
'class' => array('form-row-wide')
'class' => array('form-row-wide'),
'priority' => 32,
),
'billing_upg_company_tax_id' => array(
'label' => __('Company Tax ID', 'upg'),
'class' => array('form-row-wide')
'class' => array('form-row-wide'),
'priority' => 33,
),
'billing_upg_company_register_type' => array(
'label' => __('Company Register Type', 'upg'),
'type' => 'select',
'required' => 0,
'clear' => false,
'priority' => 34,
'options' => array(
'' => __('Please select', $this->id),
\Upg\Library\Request\Objects\Company::COMPANY_TYPE_HRA => __(
......
......@@ -90,7 +90,7 @@ class WC_Gateway_Upg_Admin_Order_Metabox
if ( in_array( $post->post_type, wc_get_order_types( 'order-meta-boxes' ) ) ) {
$order = wc_get_order( $post->ID );
if($order->payment_method == WC_Gateway_Hosted_Payments::MODULE_ID) {
if($order->get_payment_method() == WC_Gateway_Hosted_Payments::MODULE_ID) {
do_action( 'woocommerce_payco_save_meta', $post_id, $post );
}
}
......
......@@ -78,13 +78,12 @@ class WC_Gateway_Upg_Callback_Processor implements \Upg\Library\Callback\Process
public function run()
{
if(WC_Gateway_Upg_Helper::validateCallBackUrl($this->paymentInstrumentsPageUrl)) {
update_post_meta( $this->order->id, '_payco_recover_url', $this->paymentInstrumentsPageUrl);
update_post_meta( $this->order->get_id(), '_payco_recover_url', $this->paymentInstrumentsPageUrl);
return $this->order->get_checkout_payment_url(true);
}else if ($this->notificationType == self::NOTIFICATION_TYPE_PAYMENT_STATUS && $this->resultCode == 0) {
update_post_meta( $this->order->id, '_payment_method_title', WC_Gateway_Upg_Helper::getOrderPaymentMethodString($this->paymentMethod) );
update_post_meta( $this->order->id, '_payco_payment_method', $this->paymentMethod);
update_post_meta( $this->order->get_id(), '_payment_method_title', WC_Gateway_Upg_Helper::getOrderPaymentMethodString($this->paymentMethod) );
update_post_meta( $this->order->get_id(), '_payco_payment_method', $this->paymentMethod);
$this->order->update_status($this->settings['payco_return_status_success']);
$this->order->reduce_order_stock();
......@@ -95,5 +94,4 @@ class WC_Gateway_Upg_Callback_Processor implements \Upg\Library\Callback\Process
return $this->order->get_checkout_order_received_url();
}
}
}
\ No newline at end of file
......@@ -14,9 +14,9 @@ class WC_Gateway_Upg_Metabox_Api_Actions
if ( ! is_object( $theorder ) ) {
$theorder = wc_get_order( $post->ID );
}
if($theorder->payment_method !== WC_Gateway_Hosted_Payments::MODULE_ID) {
if($theorder->get_payment_method() !== WC_Gateway_Hosted_Payments::MODULE_ID) {
$text = __('Order was placed using %s','upg');
echo "<p>".sprintf($text, $theorder->payment_method_title)."</p>";
echo "<p>".sprintf($text, $theorder->get_payment_method_title())."</p>";
return;
}
......
......@@ -11,7 +11,7 @@ class WC_Gateway_Upg_Metabox_Capture
if ( ! is_object( $theorder ) ) {
$theorder = wc_get_order( $post->ID );
}
if($theorder->payment_method !== WC_Gateway_Hosted_Payments::MODULE_ID) {
if($theorder->get_payment_method() !== WC_Gateway_Hosted_Payments::MODULE_ID) {
echo "<p>".__('Order was not processed by Payco','upg')."</p>";
return;
}
......@@ -77,7 +77,7 @@ class WC_Gateway_Upg_Metabox_Capture
try{
$captures = $wpdb->get_var("SELECT count(capture_id) AS captures FROM {$wpdb->prefix}woocommerce_payco_captures WHERE order_id={$order->id}");
$captures = $wpdb->get_var("SELECT count(capture_id) AS captures FROM {$wpdb->prefix}woocommerce_payco_captures WHERE order_id={$order->get_id()}");
if(!empty($captures)) {
$captures++;
......@@ -99,7 +99,7 @@ class WC_Gateway_Upg_Metabox_Capture
$wpdb->insert(
$wpdb->prefix.'woocommerce_payco_captures',
array(
'order_id' => $order->id,
'order_id' => $order->get_id(),
'capture_amount' => $amount,
'capture_reference' => $captureId,
),
......@@ -125,9 +125,9 @@ class WC_Gateway_Upg_Metabox_Capture
{
global $wpdb;
$autocaptured = $wpdb->get_var($wpdb->prepare("SELECT autocapture FROM {$wpdb->prefix}woocommerce_payco_captures WHERE order_id = %d;", $order->id));
$autocaptured = $wpdb->get_var($wpdb->prepare("SELECT autocapture FROM {$wpdb->prefix}woocommerce_payco_captures WHERE order_id = %d;", $order->get_id()));
$autocaptureEnabled = get_post_meta($order->id, '_payco_transaction_setting_autocapture', true);
$autocaptureEnabled = get_post_meta($order->get_id(), '_payco_transaction_setting_autocapture', true);
if(!$autocaptureEnabled) {
return true;
......@@ -143,10 +143,10 @@ class WC_Gateway_Upg_Metabox_Capture
private static function calculateCaptureAmountLeft(WC_Order $order)
{
global $wpdb;
$paymentMethod = get_post_meta( $order->id, '_payco_payment_method', true );
$paymentMethod = get_post_meta( $order->get_id(), '_payco_payment_method', true );
$captureAmount = $wpdb->get_var($wpdb->prepare(
"SELECT SUM(capture_amount) AS capture_amount_sum FROM {$wpdb->prefix}woocommerce_payco_captures WHERE order_id=%d",$order->id)
"SELECT SUM(capture_amount) AS capture_amount_sum FROM {$wpdb->prefix}woocommerce_payco_captures WHERE order_id=%d",$order->get_id())
);
switch($paymentMethod) {
......@@ -157,7 +157,7 @@ class WC_Gateway_Upg_Metabox_Capture
FROM {$wpdb->prefix}woocommerce_payco_refunds AS refund_table
INNER JOIN {$wpdb->prefix}woocommerce_payco_captures AS capture_table
ON capture_table.capture_id = refund_table.capture_id
WHERE capture_table.order_id=%d",$order->id)
WHERE capture_table.order_id=%d",$order->get_id())
);
if($refunds > 0) {
......
......@@ -14,7 +14,7 @@ class WC_Gateway_Upg_Metabox_Payment_Details
return $result;
}catch(\Exception $e){
WC_Gateway_Upg_Payment_Log::logError("When outputing details in admin for ".$order->id." Got: ".$e->getMessage());
WC_Gateway_Upg_Payment_Log::logError("When outputing details in admin for ".$order->get_id()." Got: ".$e->getMessage());
}
return false;
......@@ -28,9 +28,9 @@ class WC_Gateway_Upg_Metabox_Payment_Details
if ( ! is_object( $theorder ) ) {
$theorder = wc_get_order( $post->ID );
}
if($theorder->payment_method !== WC_Gateway_Hosted_Payments::MODULE_ID) {
if($theorder->get_payment_method() !== WC_Gateway_Hosted_Payments::MODULE_ID) {
$text = __('Order was placed using %s','upg');
echo "<p>".sprintf($text, $theorder->payment_method_title)."</p>";
echo "<p>".sprintf($text, $theorder->get_payment_method_title())."</p>";
return;
}
......
......@@ -10,7 +10,7 @@ class WC_Gateway_Upg_Metabox_Refund
if ( ! is_object( $theorder ) ) {
$theorder = wc_get_order( $post->ID );
}
if($theorder->payment_method !== WC_Gateway_Hosted_Payments::MODULE_ID) {
if($theorder->get_payment_method() !== WC_Gateway_Hosted_Payments::MODULE_ID) {
echo "<p>".__('Order was not processed by Payco','upg')."</p>";
return;
}
......
......@@ -47,7 +47,7 @@ class WC_Gateway_Upg_Mns_Process
case 'NEW':
$processed = true;
case 'ACKNOWLEDGEPENDING':
self::mnsTransactionStatusAcknowledgePending($order);
self::mnsTransactionStatusAcknowledgePending($order, $mns->payment_reference);
$processed = true;
break;
case 'FRAUDPENDING':
......@@ -127,8 +127,9 @@ class WC_Gateway_Upg_Mns_Process
self::updateStatus($order, self::$setting['payco_mns_transaction_cancelled']);
}
public static function mnsTransactionStatusAcknowledgePending(WC_Order $order)
public static function mnsTransactionStatusAcknowledgePending(WC_Order $order, $paymentReference)
{
update_post_meta( $order->get_id(), '_payco_payment_reference', $paymentReference);
self::updateStatus($order, self::$setting['payco_mns_acknowledge_pending']);
}
......@@ -144,7 +145,7 @@ class WC_Gateway_Upg_Mns_Process
public static function mnsTransactionStatusMerchantPending(WC_Order $order)
{
self::updateStatus($order, self::$setting['payco_mns_merchant_pending']);
self::updateStatus($order->get_id(), self::$setting['payco_mns_merchant_pending']);
}
public static function mnsTransactionStatusInProgress(WC_Order $order)
......@@ -161,7 +162,7 @@ class WC_Gateway_Upg_Mns_Process
{
$autocapture = get_post_meta($order->get_id(), '_payco_transaction_setting_autocapture', true);
//ok now check if any autocaptures have been done
$autoCaptured = $db->get_var($db->prepare("SELECT autocapture FROM {$db->prefix}woocommerce_payco_captures WHERE order_id = %d;", $order->id));
$autoCaptured = $db->get_var($db->prepare("SELECT autocapture FROM {$db->prefix}woocommerce_payco_captures WHERE order_id = %d;", $order->get_id()));
if($autocapture && !$autoCaptured) {
//ok go record an autocapture as happening
......@@ -171,7 +172,7 @@ class WC_Gateway_Upg_Mns_Process
array(
'capture_amount' => 0,
),
array('order_id' => $order->id),
array('order_id' => $order->get_id()),
array('%f'),
array('%d')
);
......@@ -179,7 +180,7 @@ class WC_Gateway_Upg_Mns_Process
$db->insert(
$db->prefix.'woocommerce_payco_captures',
array(
'order_id' => $order->id,
'order_id' => $order->get_id(),
'capture_amount' => $order->get_total(),
'capture_reference' => $order->get_order_number(),
'autocapture' => 1,
......
......@@ -30,7 +30,7 @@ class WC_Gateway_Upg_Payment_Info
public function email_payment_detail( $order, $sent_to_admin, $plain_text = false )
{
if (! $sent_to_admin && $this->paymentMethod === $order->payment_method ) {
if (! $sent_to_admin && $this->paymentMethod === $order->get_payment_method() ) {
$this->showDetails($order);
}
}
......@@ -66,7 +66,7 @@ class WC_Gateway_Upg_Payment_Info
}
}catch (Exception $e) {
WC_Gateway_Upg_Payment_Log::logError("When outputing details for ".$order->id." Got: ".$e->getMessage());
WC_Gateway_Upg_Payment_Log::logError("When outputing details for ".$order->get_id()." Got: ".$e->getMessage());
}
}
......
......@@ -20,6 +20,13 @@ $payco_admin_settings_form = array(
'default' => UPG_MODULE_FRONTEND_TITLE,
'desc_tip' => true,
),
'description' => array(
'title' => __('Description', 'woocommerce'),
'type' => 'text',
'description' => __('The description of the CrefoPay payment methods.', 'woocommerce'),
'default' => UPG_MODULE_FRONTEND_DESC,
'desc_tip' => true,
),
'log_settings' => array(
'title' => __('Log Settings', 'upg'),
'type' => 'title',
......
......@@ -2,7 +2,7 @@
/**
* Plugin Name: CrefoPay für WooCommerce
* Description: Die Komplettlösung für Ihre Zahlungsabwicklung.
* Version: 2.2.5
* Version: 2.3.0
* Author: CrefoPayment GmbH & Co. KG
* Text Domain: upg
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment