Skip to content

Commit

Permalink
Merge pull request #105 from krokedil/main
Browse files Browse the repository at this point in the history
Version 1.9.0
  • Loading branch information
krokedilmartin authored Oct 22, 2024
2 parents 875e55d + a0d0a42 commit 059c579
Show file tree
Hide file tree
Showing 18 changed files with 19,776 additions and 395 deletions.
2 changes: 2 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
commitlint.config.js
composer.json
composer-lock.json
composer.lock
Dockerfile
Dockerfile-*
docker-compose.phpunit.yml
Expand All @@ -32,6 +33,7 @@ readme.md
README.md
readme.dev.txt
README.md
release.config.js
renovate.json
webpack.config.js
wpcron.txt
9 changes: 7 additions & 2 deletions classes/class-ledyer-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ public function update_order_reference( $order_id, $data ) {
* @return mixed|\WP_Error
*/
public function acknowledge_order( $order_id ) {
return ( new \Ledyer\Requests\Order\Management\Acknowledge_Order( array( 'orderId' => $order_id, 'data' => array() ) ) )->request();
return ( new \Ledyer\Requests\Order\Management\Acknowledge_Order(
array(
'orderId' => $order_id,
'data' => array(),
)
) )->request();
}

/**
Expand All @@ -94,4 +99,4 @@ public function acknowledge_order( $order_id ) {
public function get_payment_status( $order_id ) {
return ( new \Ledyer\Requests\Order\Management\Get_Payment_Status( array( 'orderId' => $order_id ) ) )->request();
}
}
}
14 changes: 11 additions & 3 deletions classes/class-ledyer-confirmation.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,27 @@ public function actions() {
add_action( 'init', array( $this, 'confirm_order' ), 10, 2 );
}


/**
* Confirm the order in Woo
*/
public function confirm_order() {
$ledyer_confirm = filter_input( INPUT_GET, 'lco_confirm', FILTER_SANITIZE_URL );
$order_key = filter_input( INPUT_GET, 'key', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
$ledyer_confirm = filter_input( INPUT_GET, 'lco_confirm', FILTER_SANITIZE_URL );
$order_key = filter_input( INPUT_GET, 'key', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
$ledyer_order_id = filter_input( INPUT_GET, 'ledyer_id', FILTER_SANITIZE_FULL_SPECIAL_CHARS );

if ( empty( $ledyer_confirm ) || empty( $order_key ) ) {
return;
}
$order_id = wc_get_order_id_by_order_key( $order_key );

if ( empty( $order_id ) ) {
\Ledyer\Logger::log( 'Could not get the WooCommerce order id from order key ' . $order_key );
return;
}

$order = wc_get_order( $order_id );
if ( empty( $order ) ) {
\Ledyer\Logger::log( 'Could not get the WooCommerce order with the id ' . $order_id );
return;
}

Expand Down
13 changes: 12 additions & 1 deletion classes/class-ledyer-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,18 @@ public static function fields() {
'default' => 'yes',
'desc_tip' => true,
),
'merchant_id' => array(
'checkout_flow' => array(
'title' => __( 'Checkout flow', 'ledyer-checkout-for-woocommerce' ),
'type' => 'select',
'options' => array(
'embedded' => __( 'Embedded', 'ledyer-checkout-for-woocommerce' ),
'redirect' => __( 'Redirect', 'ledyer-checkout-for-woocommerce' ),
),
'description' => __( '<strong>Embedded:</strong> the checkout is embedded in the WooCommerce checkout page and partially replaces the checkout form. <strong>Redirect:</strong> the customer is redirected to a payment page hosted by Ledyer.', 'ledyer-checkout-for-woocommerce' ),
'default' => 'embedded',
'desc_tip' => true,
),
'merchant_id' => array(
'title' => __( 'Production Ledyer client ID', 'ledyer-checkout-for-woocommerce' ),
'type' => 'text',
'description' => __( 'Generate credentials (client ID and secret) in the Ledyer Merchant Portal under Settings -> API credentials.', 'ledyer-checkout-for-woocommerce' ),
Expand Down
28 changes: 28 additions & 0 deletions classes/class-ledyer-hpp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* File for HPP class.
*
* @package Ledyer
*/

namespace Ledyer;

defined( 'ABSPATH' ) || exit();

/**
* Class HPP
*
* @package Ledyer
*/
class HPP {
/**
* Creates the HPP URL.
*
* @param string $session_id The Ledyer Checkout session to use for the HPP request.
* @return string The HPP URL.
*/
public function create_hpp_url( $session_id ) {
$mode = 'yes' === ledyer()->get_setting( 'testmode' ) ? 'sandbox' : 'live';
return "https://pos.{$mode}.ledyer.com/?sessionId={$session_id}";
}
}
Loading

0 comments on commit 059c579

Please sign in to comment.