|
|
@@ -3,7 +3,7 @@
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Plugin Name: Монета | PayAnyWay
|
|
|
|
* Plugin Name: Монета | PayAnyWay
|
|
|
|
* Description: PayAnyWay - Приём платежей для бизнеса на сайтах, в соцсетях и приложениях
|
|
|
|
* Description: PayAnyWay - Приём платежей для бизнеса на сайтах, в соцсетях и приложениях
|
|
|
|
* Version: 1.5.0
|
|
|
|
* Version: 1.5.3
|
|
|
|
* Author: PayAnyWay
|
|
|
|
* Author: PayAnyWay
|
|
|
|
* Author URI: https://payanyway.ru
|
|
|
|
* Author URI: https://payanyway.ru
|
|
|
|
* Requires Plugins: woocommerce
|
|
|
|
* Requires Plugins: woocommerce
|
|
|
@@ -25,7 +25,7 @@ function woocommerce_payanyway() {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
class WC_Payanyway extends WC_Payment_Gateway {
|
|
|
|
class WC_Payanyway extends WC_Payment_Gateway {
|
|
|
|
const MODULE_VERSION = '1.5.0';
|
|
|
|
const MODULE_VERSION = '1.5.3';
|
|
|
|
const MODULE_NAME = 'payanyway';
|
|
|
|
const MODULE_NAME = 'payanyway';
|
|
|
|
|
|
|
|
|
|
|
|
const PROD_ENDPOINT = 'https://www.payanyway.ru/assistant.htm';
|
|
|
|
const PROD_ENDPOINT = 'https://www.payanyway.ru/assistant.htm';
|
|
|
@@ -38,7 +38,7 @@ function woocommerce_payanyway() {
|
|
|
|
const XML_CONTENT_TYPE = 'application/xml';
|
|
|
|
const XML_CONTENT_TYPE = 'application/xml';
|
|
|
|
const JSON_CONTENT_TYPE = 'application/json';
|
|
|
|
const JSON_CONTENT_TYPE = 'application/json';
|
|
|
|
const TEXT_CONTENT_TYPE = 'text/plain; charset=UTF-8';
|
|
|
|
const TEXT_CONTENT_TYPE = 'text/plain; charset=UTF-8';
|
|
|
|
const TRANSACTION_ID_STRING_DELIMITER = '|';
|
|
|
|
const TRANSACTION_ID_STRING_DELIMITER = '_';
|
|
|
|
const DESCRIPTION_MAX_LENGTH = 500;
|
|
|
|
const DESCRIPTION_MAX_LENGTH = 500;
|
|
|
|
|
|
|
|
|
|
|
|
const CLIENT_NAME_MAX_LENGTH = 256;
|
|
|
|
const CLIENT_NAME_MAX_LENGTH = 256;
|
|
|
@@ -443,7 +443,7 @@ function woocommerce_payanyway() {
|
|
|
|
$description = $this->isPayedOrder($order) ? 'Order already paid' : 'Order success paid';
|
|
|
|
$description = $this->isPayedOrder($order) ? 'Order already paid' : 'Order success paid';
|
|
|
|
if (!$this->isPayedOrder($order)) {
|
|
|
|
if (!$this->isPayedOrder($order)) {
|
|
|
|
$order->add_order_note(__('Платеж успешно завершен', 'woocommerce_gateway_payanyway'));
|
|
|
|
$order->add_order_note(__('Платеж успешно завершен', 'woocommerce_gateway_payanyway'));
|
|
|
|
$order->update_status(OrderStatus::COMPLETED, __('Платеж успешно оплачен', 'woocommerce_gateway_payanyway'));
|
|
|
|
$order->update_status(OrderStatus::PROCESSING, __('Платеж успешно оплачен', 'woocommerce_gateway_payanyway'));
|
|
|
|
$order->payment_complete();
|
|
|
|
$order->payment_complete();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@@ -602,6 +602,9 @@ function woocommerce_payanyway() {
|
|
|
|
|
|
|
|
|
|
|
|
$name = (isset($item['name'])) ? $item['name'] : $item->get_name();
|
|
|
|
$name = (isset($item['name'])) ? $item['name'] : $item->get_name();
|
|
|
|
$price = wc_get_price_including_tax($product);
|
|
|
|
$price = wc_get_price_including_tax($product);
|
|
|
|
|
|
|
|
if (0.0 === $price) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
$quantity = (isset($item['item_meta']['_qty'][0])) ? $item['item_meta']['_qty'][0] : $item->get_quantity();
|
|
|
|
$quantity = (isset($item['item_meta']['_qty'][0])) ? $item['item_meta']['_qty'][0] : $item->get_quantity();
|
|
|
|
$rate = $product->is_taxable() ? $this->getItemTaxRate($item) : null;
|
|
|
|
$rate = $product->is_taxable() ? $this->getItemTaxRate($item) : null;
|
|
|
|
|
|
|
|
|
|
|
@@ -658,6 +661,9 @@ function woocommerce_payanyway() {
|
|
|
|
$shippingTotal = (float)$order->get_shipping_total();
|
|
|
|
$shippingTotal = (float)$order->get_shipping_total();
|
|
|
|
$shippingTax = (float)$order->get_shipping_tax();
|
|
|
|
$shippingTax = (float)$order->get_shipping_tax();
|
|
|
|
$shippingPrice = $shippingTotal + $shippingTax;
|
|
|
|
$shippingPrice = $shippingTotal + $shippingTax;
|
|
|
|
|
|
|
|
if (0.0 === $shippingPrice) {
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$shippingRate = (0.0 !== $shippingTotal) ? ($shippingTax / $shippingTotal) * 100 : null;
|
|
|
|
$shippingRate = (0.0 !== $shippingTotal) ? ($shippingTax / $shippingTotal) * 100 : null;
|
|
|
|
|
|
|
|
|
|
|
@@ -1006,7 +1012,7 @@ function woocommerce_payanyway() {
|
|
|
|
private function getCmsModuleVersion()
|
|
|
|
private function getCmsModuleVersion()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return sprintf(
|
|
|
|
return sprintf(
|
|
|
|
'WooCommerce v%s (WordPress v%s)|PHP %s|%s v%s',
|
|
|
|
'WooCommerce v%s (WordPress v%s)_PHP %s_%s v%s',
|
|
|
|
$this->getWooCommerceVersion(),
|
|
|
|
$this->getWooCommerceVersion(),
|
|
|
|
$this->getWordPressVersion(),
|
|
|
|
$this->getWordPressVersion(),
|
|
|
|
PHP_VERSION,
|
|
|
|
PHP_VERSION,
|
|
|
|