Changeset 3253194
- Timestamp:
- 03/10/2025 09:27:10 AM (13 months ago)
- Location:
- yoco-payment-gateway
- Files:
-
- 2 deleted
- 30 edited
- 1 copied
-
assets/banner-1544x500.png (modified) (1 prop) (previous)
-
assets/banner-772x250.png (modified) (1 prop) (previous)
-
assets/icon-128x128.png (modified) (1 prop) (previous)
-
assets/icon-256x256.png (modified) (1 prop) (previous)
-
assets/screenshot-1.png (modified) (1 prop) (previous)
-
assets/screenshot-2.png (modified) (1 prop) (previous)
-
assets/screenshot-3.png (modified) (1 prop) (previous)
-
assets/screenshot-4.png (modified) (1 prop) (previous)
-
tags/3.8.4 (copied) (copied from yoco-payment-gateway/trunk)
-
tags/3.8.4/README.md (deleted)
-
tags/3.8.4/readme.txt (modified) (2 diffs)
-
tags/3.8.4/src/Gateway/Gateway.php (modified) (1 diff)
-
tags/3.8.4/src/Gateway/Notes.php (modified) (1 diff)
-
tags/3.8.4/src/Gateway/Processors/OptionsProcessor.php (modified) (1 diff)
-
tags/3.8.4/src/Gateway/Processors/RefundProcessor.php (modified) (2 diffs)
-
tags/3.8.4/src/Gateway/Refund/Request.php (modified) (1 diff)
-
tags/3.8.4/src/Gateway/Refunds/Actions.php (modified) (2 diffs)
-
tags/3.8.4/src/Gateway/Refunds/Request.php (modified) (1 diff)
-
tags/3.8.4/src/Integrations/Yoco/Requests/Checkout.php (modified) (2 diffs)
-
tags/3.8.4/src/Integrations/Yoco/Requests/Refund.php (modified) (1 diff)
-
tags/3.8.4/yoco_wc_payment_gateway.php (modified) (1 diff)
-
trunk/README.md (deleted)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/Gateway/Gateway.php (modified) (1 diff)
-
trunk/src/Gateway/Notes.php (modified) (1 diff)
-
trunk/src/Gateway/Processors/OptionsProcessor.php (modified) (1 diff)
-
trunk/src/Gateway/Processors/RefundProcessor.php (modified) (2 diffs)
-
trunk/src/Gateway/Refund/Request.php (modified) (1 diff)
-
trunk/src/Gateway/Refunds/Actions.php (modified) (2 diffs)
-
trunk/src/Gateway/Refunds/Request.php (modified) (1 diff)
-
trunk/src/Integrations/Yoco/Requests/Checkout.php (modified) (2 diffs)
-
trunk/src/Integrations/Yoco/Requests/Refund.php (modified) (1 diff)
-
trunk/yoco_wc_payment_gateway.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
yoco-payment-gateway/assets/banner-1544x500.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
yoco-payment-gateway/assets/banner-772x250.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
yoco-payment-gateway/assets/icon-128x128.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
yoco-payment-gateway/assets/icon-256x256.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
yoco-payment-gateway/assets/screenshot-1.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
yoco-payment-gateway/assets/screenshot-2.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
yoco-payment-gateway/assets/screenshot-3.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
yoco-payment-gateway/assets/screenshot-4.png
-
Property
svn:mime-type
changed from
application/octet-streamtoimage/png
-
Property
svn:mime-type
changed from
-
yoco-payment-gateway/tags/3.8.4/readme.txt
r3239360 r3253194 5 5 Tested up to: 6.7 6 6 Requires PHP: 7.4.0 7 Stable tag: 3.8. 37 Stable tag: 3.8.4 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 137 137 == Changelog == 138 138 139 = 3.8.4 = 140 141 * Fix relative checkout url. 142 139 143 = 3.8.3 = 140 144 -
yoco-payment-gateway/tags/3.8.4/src/Gateway/Gateway.php
r3177082 r3253194 29 29 $this->icon = trailingslashit( YOCO_ASSETS_URI ) . 'images/yoco-2024.svg'; 30 30 $this->has_fields = false; 31 $this->supports = array( 'products', 'refunds' );32 31 33 32 $this->title = $this->get_option( 'title', __( 'Yoco', 'yoco_wc_payment_gateway' ) ); -
yoco-payment-gateway/tags/3.8.4/src/Gateway/Notes.php
r3206321 r3253194 71 71 } 72 72 73 $order_notes = wc_get_order_notes( array( 'order_id' => $order_id ) ); 74 foreach ( $order_notes as $note ) { 75 if ( strpos( $note->content, 'refund session ID (' . $refund_id ) !== false ) { 76 return; 77 } 78 } 79 73 80 // translators: Refund ID. 74 81 $this->addNote( $order, sprintf( esc_html__( 'Yoco: Received refund session ID (%s).', 'yoco_wc_payment_gateway' ), esc_html( $refund_id ) ) ); -
yoco-payment-gateway/tags/3.8.4/src/Gateway/Processors/OptionsProcessor.php
r3102357 r3253194 35 35 $response = $installationRequest->send(); 36 36 37 // If we get 500 error, reset Idempotence Key and retry the request. 38 if ( 500 === (int) $response['code'] ) { 37 // Retry the request for 408, 409, 425, 429, 502, 503, 504 response codes. 38 if ( in_array( $response['code'], array( 408, 409, 425, 429, 502, 503, 504 ) ) ) { 39 $response = $installationRequest->send(); 40 } 41 42 // If we get 500 response code, reset Idempotence Key and retry the request. 43 if ( in_array( $response['code'], array( 500 ) ) ) { 39 44 add_filter( 'yoco_payment_gateway/installation/request/headers', array( $this, 'resetIdempotenceKey' ) ); 40 45 -
yoco-payment-gateway/tags/3.8.4/src/Gateway/Processors/RefundProcessor.php
r3177082 r3253194 6 6 use WP_Error; 7 7 use Yoco\Gateway\Metadata; 8 use Yoco\Gateway\Refunds\Actions as Refunds_Actions; 8 9 use Yoco\Gateway\Refund\Request; 9 10 use Yoco\Helpers\Logger; … … 25 26 26 27 try { 28 Refunds_Actions::sync_refunds( $order ); 27 29 $request = new Request( $order ); 28 30 $response = $request->send( $amount ); -
yoco-payment-gateway/tags/3.8.4/src/Gateway/Refund/Request.php
r3177082 r3253194 61 61 $headers = array( 62 62 'Content-Type' => 'application/json', 63 'Authorization' => $this->installation->getApiBearer( ),63 'Authorization' => $this->installation->getApiBearer( $this->order->get_meta( 'yoco_order_payment_mode', true ) ), 64 64 'X-Product' => 'woocommerce', 65 65 ); 66 66 67 $idempotency_key = $this->getIdempotencyKey(); 68 69 if ( null !== $idempotency_key ) { 70 $headers['Idempotency-Key'] = $idempotency_key; 71 } 72 67 73 return apply_filters( 'yoco_payment_gateway/refund/request/headers', $headers ); 68 74 } 75 76 private function getIdempotencyKey(): ?string { 77 if ( ! isset( $_POST['security'] ) || wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['security'] ) ), 'woocommerce-order-items' ) ) { 78 return null; 79 } 80 81 if ( ! isset( $_POST['refund_amount'] ) || ! isset( $_POST['refunded_amount'] ) ) { 82 return null; 83 } 84 85 $refund_amount = sanitize_text_field( wp_unslash( $_POST['refund_amount'] ) ); 86 $refunded_amount = sanitize_text_field( wp_unslash( $_POST['refunded_amount'] ) ); 87 88 return hash( 'SHA256', yoco( Metadata::class )->getOrderPaymentId( $this->order ) . $refund_amount . $refunded_amount ); 89 } 69 90 } -
yoco-payment-gateway/tags/3.8.4/src/Gateway/Refunds/Actions.php
r3206321 r3253194 109 109 ), 110 110 'order_id' => $order->get_id(), 111 'refund_payment' => true,111 'refund_payment' => false, 112 112 ); 113 113 … … 116 116 if ( is_wp_error( $new_refund ) ) { 117 117 yoco( Logger::class )->logError( 'Refund creation failed: ' . $new_refund->get_error_message() . ' code: ' . $new_refund->get_error_code() ); 118 return; 118 119 } 119 120 -
yoco-payment-gateway/tags/3.8.4/src/Gateway/Refunds/Request.php
r3177082 r3253194 56 56 $headers = array( 57 57 'Content-Type' => 'application/json', 58 'Authorization' => $this->installation->getApiBearer( ),58 'Authorization' => $this->installation->getApiBearer( $this->order->get_meta( 'yoco_order_payment_mode', true ) ), 59 59 'X-Product' => 'woocommerce', 60 60 ); -
yoco-payment-gateway/tags/3.8.4/src/Integrations/Yoco/Requests/Checkout.php
r3177082 r3253194 25 25 ->setAmount( $this->getOrderTotal() ) 26 26 ->setCurrency( $this->order->get_currency() ) 27 ->setSuccessUrl( $this-> order->get_checkout_order_received_url() )28 ->setCancelUrl( $this-> order->get_checkout_payment_url() )29 ->setFailureUrl( $this-> getOrderCheckoutPaymentUrl( 'failed') )27 ->setSuccessUrl( $this->absoluteUrl( $this->order->get_checkout_order_received_url() ) ) 28 ->setCancelUrl( $this->absoluteUrl( $this->order->get_checkout_payment_url() ) ) 29 ->setFailureUrl( $this->absoluteUrl( $this->getOrderCheckoutPaymentUrl( 'failed' ) ) ) 30 30 ->setMetadata( $this->buildMetadata( $this->order ) ) 31 31 ->setLineItems( $this->buildLineItems( $this->order ) ) … … 110 110 ); 111 111 } 112 113 private function absoluteUrl( string $url ): string { 114 if ( ! preg_match( '/^https?:\/\//', $url ) ) { 115 $url = home_url( $url ); 116 } 117 118 return $url; 119 } 112 120 } -
yoco-payment-gateway/tags/3.8.4/src/Integrations/Yoco/Requests/Refund.php
r3206321 r3253194 51 51 ), 52 52 'order_id' => $order->get_id(), 53 'refund_payment' => true,53 'refund_payment' => false, 54 54 ); 55 55 -
yoco-payment-gateway/tags/3.8.4/yoco_wc_payment_gateway.php
r3206321 r3253194 6 6 * Author: Yoco 7 7 * Author URI: https://www.yoco.com 8 * Version: 3.8. 18 * Version: 3.8.4 9 9 * Requires at least: 5.0.0 10 * Tested up to: 6. 610 * Tested up to: 6.7 11 11 * WC requires at least: 8.0.0 12 * WC tested up to: 9. 312 * WC tested up to: 9.7 13 13 * Requires Plugins: woocommerce 14 14 * Text Domain: yoco_wc_payment_gateway -
yoco-payment-gateway/trunk/readme.txt
r3239360 r3253194 5 5 Tested up to: 6.7 6 6 Requires PHP: 7.4.0 7 Stable tag: 3.8. 37 Stable tag: 3.8.4 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 137 137 == Changelog == 138 138 139 = 3.8.4 = 140 141 * Fix relative checkout url. 142 139 143 = 3.8.3 = 140 144 -
yoco-payment-gateway/trunk/src/Gateway/Gateway.php
r3177082 r3253194 29 29 $this->icon = trailingslashit( YOCO_ASSETS_URI ) . 'images/yoco-2024.svg'; 30 30 $this->has_fields = false; 31 $this->supports = array( 'products', 'refunds' );32 31 33 32 $this->title = $this->get_option( 'title', __( 'Yoco', 'yoco_wc_payment_gateway' ) ); -
yoco-payment-gateway/trunk/src/Gateway/Notes.php
r3206321 r3253194 71 71 } 72 72 73 $order_notes = wc_get_order_notes( array( 'order_id' => $order_id ) ); 74 foreach ( $order_notes as $note ) { 75 if ( strpos( $note->content, 'refund session ID (' . $refund_id ) !== false ) { 76 return; 77 } 78 } 79 73 80 // translators: Refund ID. 74 81 $this->addNote( $order, sprintf( esc_html__( 'Yoco: Received refund session ID (%s).', 'yoco_wc_payment_gateway' ), esc_html( $refund_id ) ) ); -
yoco-payment-gateway/trunk/src/Gateway/Processors/OptionsProcessor.php
r3102357 r3253194 35 35 $response = $installationRequest->send(); 36 36 37 // If we get 500 error, reset Idempotence Key and retry the request. 38 if ( 500 === (int) $response['code'] ) { 37 // Retry the request for 408, 409, 425, 429, 502, 503, 504 response codes. 38 if ( in_array( $response['code'], array( 408, 409, 425, 429, 502, 503, 504 ) ) ) { 39 $response = $installationRequest->send(); 40 } 41 42 // If we get 500 response code, reset Idempotence Key and retry the request. 43 if ( in_array( $response['code'], array( 500 ) ) ) { 39 44 add_filter( 'yoco_payment_gateway/installation/request/headers', array( $this, 'resetIdempotenceKey' ) ); 40 45 -
yoco-payment-gateway/trunk/src/Gateway/Processors/RefundProcessor.php
r3177082 r3253194 6 6 use WP_Error; 7 7 use Yoco\Gateway\Metadata; 8 use Yoco\Gateway\Refunds\Actions as Refunds_Actions; 8 9 use Yoco\Gateway\Refund\Request; 9 10 use Yoco\Helpers\Logger; … … 25 26 26 27 try { 28 Refunds_Actions::sync_refunds( $order ); 27 29 $request = new Request( $order ); 28 30 $response = $request->send( $amount ); -
yoco-payment-gateway/trunk/src/Gateway/Refund/Request.php
r3177082 r3253194 61 61 $headers = array( 62 62 'Content-Type' => 'application/json', 63 'Authorization' => $this->installation->getApiBearer( ),63 'Authorization' => $this->installation->getApiBearer( $this->order->get_meta( 'yoco_order_payment_mode', true ) ), 64 64 'X-Product' => 'woocommerce', 65 65 ); 66 66 67 $idempotency_key = $this->getIdempotencyKey(); 68 69 if ( null !== $idempotency_key ) { 70 $headers['Idempotency-Key'] = $idempotency_key; 71 } 72 67 73 return apply_filters( 'yoco_payment_gateway/refund/request/headers', $headers ); 68 74 } 75 76 private function getIdempotencyKey(): ?string { 77 if ( ! isset( $_POST['security'] ) || wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['security'] ) ), 'woocommerce-order-items' ) ) { 78 return null; 79 } 80 81 if ( ! isset( $_POST['refund_amount'] ) || ! isset( $_POST['refunded_amount'] ) ) { 82 return null; 83 } 84 85 $refund_amount = sanitize_text_field( wp_unslash( $_POST['refund_amount'] ) ); 86 $refunded_amount = sanitize_text_field( wp_unslash( $_POST['refunded_amount'] ) ); 87 88 return hash( 'SHA256', yoco( Metadata::class )->getOrderPaymentId( $this->order ) . $refund_amount . $refunded_amount ); 89 } 69 90 } -
yoco-payment-gateway/trunk/src/Gateway/Refunds/Actions.php
r3206321 r3253194 109 109 ), 110 110 'order_id' => $order->get_id(), 111 'refund_payment' => true,111 'refund_payment' => false, 112 112 ); 113 113 … … 116 116 if ( is_wp_error( $new_refund ) ) { 117 117 yoco( Logger::class )->logError( 'Refund creation failed: ' . $new_refund->get_error_message() . ' code: ' . $new_refund->get_error_code() ); 118 return; 118 119 } 119 120 -
yoco-payment-gateway/trunk/src/Gateway/Refunds/Request.php
r3177082 r3253194 56 56 $headers = array( 57 57 'Content-Type' => 'application/json', 58 'Authorization' => $this->installation->getApiBearer( ),58 'Authorization' => $this->installation->getApiBearer( $this->order->get_meta( 'yoco_order_payment_mode', true ) ), 59 59 'X-Product' => 'woocommerce', 60 60 ); -
yoco-payment-gateway/trunk/src/Integrations/Yoco/Requests/Checkout.php
r3177082 r3253194 25 25 ->setAmount( $this->getOrderTotal() ) 26 26 ->setCurrency( $this->order->get_currency() ) 27 ->setSuccessUrl( $this-> order->get_checkout_order_received_url() )28 ->setCancelUrl( $this-> order->get_checkout_payment_url() )29 ->setFailureUrl( $this-> getOrderCheckoutPaymentUrl( 'failed') )27 ->setSuccessUrl( $this->absoluteUrl( $this->order->get_checkout_order_received_url() ) ) 28 ->setCancelUrl( $this->absoluteUrl( $this->order->get_checkout_payment_url() ) ) 29 ->setFailureUrl( $this->absoluteUrl( $this->getOrderCheckoutPaymentUrl( 'failed' ) ) ) 30 30 ->setMetadata( $this->buildMetadata( $this->order ) ) 31 31 ->setLineItems( $this->buildLineItems( $this->order ) ) … … 110 110 ); 111 111 } 112 113 private function absoluteUrl( string $url ): string { 114 if ( ! preg_match( '/^https?:\/\//', $url ) ) { 115 $url = home_url( $url ); 116 } 117 118 return $url; 119 } 112 120 } -
yoco-payment-gateway/trunk/src/Integrations/Yoco/Requests/Refund.php
r3206321 r3253194 51 51 ), 52 52 'order_id' => $order->get_id(), 53 'refund_payment' => true,53 'refund_payment' => false, 54 54 ); 55 55 -
yoco-payment-gateway/trunk/yoco_wc_payment_gateway.php
r3206321 r3253194 6 6 * Author: Yoco 7 7 * Author URI: https://www.yoco.com 8 * Version: 3.8. 18 * Version: 3.8.4 9 9 * Requires at least: 5.0.0 10 * Tested up to: 6. 610 * Tested up to: 6.7 11 11 * WC requires at least: 8.0.0 12 * WC tested up to: 9. 312 * WC tested up to: 9.7 13 13 * Requires Plugins: woocommerce 14 14 * Text Domain: yoco_wc_payment_gateway
Note: See TracChangeset
for help on using the changeset viewer.