Skip to content

Commit

Permalink
Agrega estado del pago.
Browse files Browse the repository at this point in the history
Elimina Webpay
  • Loading branch information
JKacicM committed Mar 10, 2022
1 parent bf5c0a6 commit b81b0cd
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 292 deletions.
8 changes: 6 additions & 2 deletions includes/abstract-wc-gateway-khipu.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function create_payment($order_id)
$configuration = new Khipu\Configuration();
$configuration->setSecret($this->secret);
$configuration->setReceiverId($this->receiver_id);
$configuration->setPlatform('woocommerce-khipu', '3.0');
$configuration->setPlatform('woocommerce-khipu', '3.1');
// $configuration->setDebug(true);

$client = new Khipu\ApiClient($configuration);
Expand Down Expand Up @@ -89,7 +89,7 @@ private function get_payment_response($notification_token)
$configuration = new Khipu\Configuration();
$configuration->setSecret($this->secret);
$configuration->setReceiverId($this->receiver_id);
$configuration->setPlatform('woocommerce-khipu', '3.0');
$configuration->setPlatform('woocommerce-khipu', '3.1');

$client = new Khipu\ApiClient($configuration);
$payments = new Khipu\Client\PaymentsApi($client);
Expand Down Expand Up @@ -144,6 +144,10 @@ function check_ipn_response()
}
$order->add_order_note(sprintf(__('Pago verificado con código único de verificación khipu %s', 'woocommerce-gateway-khipu'), $paymentResponse->getPaymentId()));
$order->payment_complete($paymentResponse->getPaymentId());
$defined_status = get_option('woocommerce_gateway_khipu_after_payment_status');
if ($defined_status) {
$order->update_status($defined_status);
}
exit('Notification processed');
}

Expand Down
137 changes: 0 additions & 137 deletions includes/class-wc-gateway-khipu-payme.php

This file was deleted.

1 change: 1 addition & 0 deletions includes/class-wc-gateway-khipu-regular-transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function __construct()
$this->receiver_id = get_option('woocommerce_gateway_khipu_receiver_id');
$this->secret = get_option('woocommerce_gateway_khipu_secret');
$this->icon = $this->get_payment_method_icon('REGULAR_TRANSFER');
$this->after_payment_status = get_option('woocommerce_gateway_khipu_after_payment_status');

add_action('woocommerce_receipt_' . $this->id, array($this, 'receipt_page'));
add_action('woocommerce_update_options_payment_gateways_' . $this->id,
Expand Down
1 change: 1 addition & 0 deletions includes/class-wc-gateway-khipu-simplified-transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function __construct()
$this->receiver_id = get_option('woocommerce_gateway_khipu_receiver_id');
$this->secret = get_option('woocommerce_gateway_khipu_secret');
$this->icon = $this->get_payment_method_icon('SIMPLIFIED_TRANSFER');
$this->after_payment_status = get_option('woocommerce_gateway_khipu_after_payment_status');

add_action('woocommerce_receipt_' . $this->id, array($this, 'receipt_page'));
add_action('woocommerce_update_options_payment_gateways_' . $this->id,
Expand Down
140 changes: 0 additions & 140 deletions includes/class-wc-gateway-khipu-webpay.php

This file was deleted.

18 changes: 16 additions & 2 deletions includes/class-wc-gateway-khipu.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function __construct()
$this->id = 'khipu';
$this->has_fields = false;
$this->method_title = __('khipu configuración básica', 'woocommerce-gateway-khipu');
$this->method_description = sprintf( __( 'khipu permite aceptar pagos con transferencia, tarjetas de crédito y débito. <a href="%1$s" target="_blank">Crea un cuenta khipu</a> y <a href="%2$s" target="_blank">obten tus credenciales para WooCommerce</a>.', 'woocommerce-gateway-khipu' ), 'https://khipu.com/page/precios', 'https://khipu.com/merchant/profile' );
$this->method_description = sprintf( __( 'khipu permite aceptar pagos con transferencia bancaria. <a href="%1$s" target="_blank">Crea un cuenta khipu</a> y <a href="%2$s" target="_blank">obten tus credenciales para WooCommerce</a>.', 'woocommerce-gateway-khipu' ), 'https://khipu.com/page/precios', 'https://khipu.com/merchant/profile' );


// Load the settings and init variables.
Expand All @@ -23,6 +23,7 @@ public function __construct()
$this->title = __('khipu configuración básica', 'woocommerce-gateway-khipu');
$this->receiver_id = $this->get_option('receiver_id');
$this->secret = $this->get_option('secret');
$this->after_payment_status = get_option('woocommerce_gateway_khipu_after_payment_status');

// Actions
add_action('woocommerce_update_options_payment_gateways_' . $this->id,
Expand Down Expand Up @@ -52,6 +53,7 @@ function process_admin_options() {
update_option('woocommerce_gateway_khipu_receiver_id', $post_data['woocommerce_khipu_receiver_id']);
update_option('woocommerce_gateway_khipu_secret', $post_data['woocommerce_khipu_secret']);
update_option('woocommerce_gateway_khipu_payment_methods', '');
update_option('woocommerce_gateway_khipu_after_payment_status', $post_data['woocommerce_khipu_after_payment_status']);
}

/**
Expand All @@ -75,8 +77,20 @@ function init_form_fields()
'woocommerce-gateway-khipu'),
'default' => '',
'desc_tip' => true
),
'after_payment_status' => array(
'title' => __('Estado del pedido pagado.'),
'type' => 'select',
'description' => __('Seleccione estado con el que desea dejar sus órdenes luego de pagadas.', 'woocommerce-gateway-khipu'),
'type' => 'select',
'options' => array(
'wc-processing' => __('Procesando', 'woocommerce-gateway-khipu'),
'wc-completed' => __('Completado', 'woocommerce-gateway-khipu'),
),
'default' => 'wc-processing',
'desc_tip' => true
)
);
);

}

Expand Down
7 changes: 4 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ Donate link:
Tags: payment gateway, khipu, woocommerce, chile
Requires at least: 3.3
Tested up to: 4.1
Stable tag: 3.0
Stable tag: 3.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Permite el uso de khipu en WooCommerce, khipu es un medio de pago que permite pagar usando Cuentas Bancarias, tarjetas de crédito, débito y prepago.
Permite el uso de khipu en WooCommerce, khipu es un medio de pago que permite pagar usando Cuentas Bancarias.

== Description ==

Permite el uso de khipu en WooCommerce, khipu es un medio de pago que permite pagar usando Cuentas Bancarias, tarjetas de crédito, débito y prepago.
Permite el uso de khipu en WooCommerce, khipu es un medio de pago que permite pagar usando Cuentas Bancarias.

== Installation ==

Expand All @@ -31,6 +31,7 @@ No hay preguntas aún.
3. https://s3.amazonaws.com/static.khipu.com/id-cobrador.png

== Changelog ==
3.1 Permite elegir estado luego del apgo recibido.
3.0 Uso del timeout de woocommerce para recuperación de stock al crear un pago, detección automática de medios de pago disponibles.
2.9 Cambio de nombre en configuración de woocommerce
2.8.1 Corrección de URL de cancelación para permitir al usuario volver al carro
Expand Down
Loading

0 comments on commit b81b0cd

Please sign in to comment.