Skip to content

Commit 5065cbd

Browse files
Merge pull request #268 from checkout/feature/refund-apm-and-apple
Refund APMs and Apple Pay
2 parents e833a50 + ea40628 commit 5065cbd

16 files changed

Lines changed: 356 additions & 166 deletions

woocommerce-gateway-checkout-com/includes/api/class-wc-checkoutcom-api-request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ public static function refund_payment( $order_id, $order ) {
786786
return $response;
787787
}
788788
} catch ( CheckoutApiException $ex ) {
789-
$error_message = esc_html__( 'An error has occurred while processing your refund.', 'wc_checkout_com' );
789+
$error_message = esc_html__( 'An error has occurred while processing your refund. ', 'wc_checkout_com' );
790790

791791
// check if gateway response is enabled from module settings.
792792
if ( $gateway_debug ) {

woocommerce-gateway-checkout-com/includes/apms/class-wc-checkoutcom-bancontact.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __construct()
1717
}
1818

1919
public function payment_fields()
20-
{
20+
{
2121
// get available apms depending on currency
2222
$apm_available = WC_Checkoutcom_Utility::get_alternative_payment_methods();
2323
$message = __("Pay with Bancontact. You will be redirected upon place order", 'wc_checkout_com')
@@ -62,4 +62,18 @@ public function process_payment( $order_id )
6262
);
6363
}
6464
}
65-
}
65+
66+
/**
67+
* Process refund for the order.
68+
*
69+
* @param int $order_id Order ID.
70+
* @param int $amount Amount to refund.
71+
* @param string $reason Refund reason.
72+
*
73+
* @return bool
74+
*/
75+
public function process_refund( $order_id, $amount = null, $reason = '' ) {
76+
77+
return parent::process_refund( $order_id, $amount, $reason );
78+
}
79+
}

woocommerce-gateway-checkout-com/includes/apms/class-wc-checkoutcom-boleto.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct()
1919
}
2020

2121
public function payment_fields()
22-
{
22+
{
2323
// get available apms depending on currency
2424
$apm_available = WC_Checkoutcom_Utility::get_alternative_payment_methods();
2525

@@ -80,4 +80,18 @@ public function process_payment( $order_id )
8080
);
8181
}
8282
}
83-
}
83+
84+
/**
85+
* Process refund for the order.
86+
*
87+
* @param int $order_id Order ID.
88+
* @param int $amount Amount to refund.
89+
* @param string $reason Refund reason.
90+
*
91+
* @return bool
92+
*/
93+
public function process_refund( $order_id, $amount = null, $reason = '' ) {
94+
95+
return parent::process_refund( $order_id, $amount, $reason );
96+
}
97+
}

woocommerce-gateway-checkout-com/includes/apms/class-wc-checkoutcom-eps.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __construct()
1717
}
1818

1919
public function payment_fields()
20-
{
20+
{
2121
// get available apms depending on currency
2222
$apm_available = WC_Checkoutcom_Utility::get_alternative_payment_methods();
2323
$message = __("Pay with EPS. You will be redirected upon place order", 'wc_checkout_com');
@@ -62,4 +62,18 @@ public function process_payment( $order_id )
6262
);
6363
}
6464
}
65-
}
65+
66+
/**
67+
* Process refund for the order.
68+
*
69+
* @param int $order_id Order ID.
70+
* @param int $amount Amount to refund.
71+
* @param string $reason Refund reason.
72+
*
73+
* @return bool
74+
*/
75+
public function process_refund( $order_id, $amount = null, $reason = '' ) {
76+
77+
return parent::process_refund( $order_id, $amount, $reason );
78+
}
79+
}

woocommerce-gateway-checkout-com/includes/apms/class-wc-checkoutcom-fawry.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function payment_fields()
2424
$apm_available = WC_Checkoutcom_Utility::get_alternative_payment_methods();
2525
$message = __("Pay with Fawry", 'wc_checkout_com');
2626

27-
?>
27+
?>
2828
<p style="margin-bottom: 0;"> <?php echo $message ?> </p>
2929
<?php
3030

@@ -54,14 +54,14 @@ public function process_payment( $order_id )
5454
return;
5555
}
5656

57-
57+
5858
$status = WC_Admin_Settings::get_option('ckocom_order_authorised');
5959
$message = "";
6060

6161
if ($result['source']['type'] == self::PAYMENT_METHOD) {
6262
update_post_meta($order_id, 'cko_fawry_reference_number', $result['source']['reference_number']);
6363
update_post_meta($order_id, 'cko_payment_authorized', true);
64-
64+
6565
// Get cko auth status configured in admin
6666
$message = __("Checkout.com - Fawry payment " ."</br>". " Action ID : {$result['id']} - Fawry reference number : {$result['source']['reference_number']} ", 'wc_checkout_com');
6767

@@ -91,4 +91,17 @@ public function process_payment( $order_id )
9191
);
9292
}
9393

94-
}
94+
/**
95+
* Process refund for the order.
96+
*
97+
* @param int $order_id Order ID.
98+
* @param int $amount Amount to refund.
99+
* @param string $reason Refund reason.
100+
*
101+
* @return bool
102+
*/
103+
public function process_refund( $order_id, $amount = null, $reason = '' ) {
104+
105+
return parent::process_refund( $order_id, $amount, $reason );
106+
}
107+
}

woocommerce-gateway-checkout-com/includes/apms/class-wc-checkoutcom-giropay.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,18 @@ public function process_payment( $order_id )
6363
);
6464
}
6565
}
66+
67+
/**
68+
* Process refund for the order.
69+
*
70+
* @param int $order_id Order ID.
71+
* @param int $amount Amount to refund.
72+
* @param string $reason Refund reason.
73+
*
74+
* @return bool
75+
*/
76+
public function process_refund( $order_id, $amount = null, $reason = '' ) {
77+
78+
return parent::process_refund( $order_id, $amount, $reason );
79+
}
6680
}

woocommerce-gateway-checkout-com/includes/apms/class-wc-checkoutcom-ideal.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,18 @@ public function process_payment( $order_id )
6060
);
6161
}
6262
}
63+
64+
/**
65+
* Process refund for the order.
66+
*
67+
* @param int $order_id Order ID.
68+
* @param int $amount Amount to refund.
69+
* @param string $reason Refund reason.
70+
*
71+
* @return bool
72+
*/
73+
public function process_refund( $order_id, $amount = null, $reason = '' ) {
74+
75+
return parent::process_refund( $order_id, $amount, $reason );
76+
}
6377
}

woocommerce-gateway-checkout-com/includes/apms/class-wc-checkoutcom-klarna.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct()
1919
}
2020

2121
public function payment_fields()
22-
{
22+
{
2323
// get available apms depending on currency
2424
$apm_available = WC_Checkoutcom_Utility::get_alternative_payment_methods();
2525

@@ -70,7 +70,7 @@ public function process_payment( $order_id )
7070
WC_Checkoutcom_Utility::wc_add_notice_self(__($result['error']), 'error');
7171
return;
7272
}
73-
73+
7474
// redirect to apm if redirection url is available
7575
if (isset($result['apm_redirection']) &&!empty($result['apm_redirection'])) {
7676

@@ -80,4 +80,18 @@ public function process_payment( $order_id )
8080
);
8181
}
8282
}
83-
}
83+
84+
/**
85+
* Process refund for the order.
86+
*
87+
* @param int $order_id Order ID.
88+
* @param int $amount Amount to refund.
89+
* @param string $reason Refund reason.
90+
*
91+
* @return bool
92+
*/
93+
public function process_refund( $order_id, $amount = null, $reason = '' ) {
94+
95+
return parent::process_refund( $order_id, $amount, $reason );
96+
}
97+
}

woocommerce-gateway-checkout-com/includes/apms/class-wc-checkoutcom-knet.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class WC_Gateway_Checkout_Com_Alternative_Payments_Knet extends WC_Gateway_Checkout_Com_Alternative_Payments {
44

55
const PAYMENT_METHOD = 'knet';
6-
6+
77
public function __construct()
88
{
99
$this->id = 'wc_checkout_com_alternative_payments_knet';
@@ -17,7 +17,7 @@ public function __construct()
1717
}
1818

1919
public function payment_fields()
20-
{
20+
{
2121
// get available apms depending on currency
2222
$apm_available = WC_Checkoutcom_Utility::get_alternative_payment_methods();
2323
$message = __("Pay with Knet. You will be redirected upon place order", 'wc_checkout_com');
@@ -62,4 +62,18 @@ public function process_payment( $order_id )
6262
);
6363
}
6464
}
65-
}
65+
66+
/**
67+
* Process refund for the order.
68+
*
69+
* @param int $order_id Order ID.
70+
* @param int $amount Amount to refund.
71+
* @param string $reason Refund reason.
72+
*
73+
* @return bool
74+
*/
75+
public function process_refund( $order_id, $amount = null, $reason = '' ) {
76+
77+
return parent::process_refund( $order_id, $amount, $reason );
78+
}
79+
}

woocommerce-gateway-checkout-com/includes/apms/class-wc-checkoutcom-multibanco.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct() {
2222
$this->method_title = __( 'Checkout.com', 'wc_checkout_com' );
2323
$this->method_description = __( 'The Checkout.com extension allows shop owners to process online payments through the <a href=\"https://www.checkout.com\">Checkout.com Payment Gateway.</a>', 'wc_checkout_com' );
2424
$this->title = __( 'Pay by Multibanco with Checkout.com', 'wc_checkout_com' );
25-
$this->supports = array( 'products', 'refunds' );
25+
$this->supports = array( 'products' );
2626
$this->has_fields = true;
2727

2828
$this->init_form_fields();

0 commit comments

Comments
 (0)