Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add translation support for the AltaPay Payment Actions grid #107

Merged
merged 11 commits into from
Jul 26, 2024
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.

## [3.6.8]
- Add translation support for the AltaPay Payment Actions grid in the following WordPress-supported languages:

`Danish, German, Estonian, Finnish, French, Czech, German (Austria), German (Switzerland, informal), German (formal), German (Switzerland), French (Belgium), French (Canada), Italian, Lithuanian, Dutch, Dutch (Belgium), Dutch (Formal), Norwegian Nynorsk, Polish, Romanian, Swedish.`

## [3.6.7]
- Extend support to include all languages that the gateway supports.

Expand Down
28 changes: 20 additions & 8 deletions altapay.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
* Description: Payment Gateway to use with WordPress WooCommerce
* Author: AltaPay
* Author URI: https://altapay.com
* Version: 3.6.7
* Text Domain: altapay
* Domain Path: /languages
* Version: 3.6.8
* Name: SDM_Altapay
* WC requires at least: 3.9.0
* WC tested up to: 9.0.2
* WC tested up to: 9.1.2
*
* @package Altapay
*/
Expand Down Expand Up @@ -39,7 +41,7 @@
}

if ( ! defined( 'ALTAPAY_PLUGIN_VERSION' ) ) {
define( 'ALTAPAY_PLUGIN_VERSION', '3.6.7' );
define( 'ALTAPAY_PLUGIN_VERSION', '3.6.8' );
}

// Include the autoloader, so we can dynamically include the rest of the classes.
Expand Down Expand Up @@ -81,6 +83,7 @@ function init_altapay_settings() {
if ( empty( $altapay_terminal_classes_recreated ) ) {
Core\AltapaySettings::recreateTerminalData( $settings );
}

}

/**
Expand Down Expand Up @@ -270,6 +273,9 @@ function altapayAddMetaBoxes() {
* @return void
*/
function altapay_meta_box_side( $post_or_order_object ) {
global $post;
$order_post = $post;

$order = ( $post_or_order_object instanceof WP_Post ) ? wc_get_order( $post_or_order_object->ID ) : $post_or_order_object;

if ( ! $order ) {
Expand Down Expand Up @@ -344,6 +350,8 @@ function altapay_meta_box_side( $post_or_order_object ) {
wp_reset_postdata();
}

$post = $order_post;

if ( $payments ) {
foreach ( $payments as $pay ) {
$reserved = $pay->ReservedAmount;
Expand All @@ -353,7 +361,7 @@ function altapay_meta_box_side( $post_or_order_object ) {
$type = $pay->AuthType;

if ( $status === 'released' ) {
echo '<strong>' . __( 'Payment released', 'altapay' ) . '</strong>';
echo '<strong>' . __( 'Payment Released.', 'altapay' ) . '</strong>';
} else {
$charge = $reserved - $captured - $refunded;
if ( $charge <= 0 ) {
Expand Down Expand Up @@ -701,6 +709,7 @@ function altapayCaptureCallback() {
'refunded' => $refunded,
'chargeable' => round( $charge, 2 ),
'note' => $noteHtml,
'message' => __( 'Payment Captured.', 'altapay' )
)
);
}
Expand Down Expand Up @@ -824,9 +833,10 @@ function altapayRefundPayment( $orderID, $amount, $reason, $isAjax ) {
$reconciliation = new Core\AltapayReconciliation();
$reconciliation->saveReconciliationIdentifier( (int) $orderID, $transaction['TransactionId'], $reconciliationId, 'refunded' );
} elseif ( strtolower( $response->Result ) === 'open' ) {
$order->add_order_note( __( 'Payment refund is in progress.', 'altapay' ) );
$note = __( 'Payment refund is in progress.', 'altapay' );
$order->add_order_note( $note );
return array(
'message' => 'Payment refund is in progress.',
'message' => $note,
'success' => true,
);
} else {
Expand Down Expand Up @@ -906,7 +916,7 @@ function altapayRefundPayment( $orderID, $amount, $reason, $isAjax ) {
'refunded' => $refunded,
'chargeable' => round( $charge, 2 ),
'note' => $noteHtml,
'message' => __( 'Payment refunded.', 'altapay' ),
'message' => __( 'Payment Refunded.', 'altapay' ),
'success' => true,
);
}
Expand Down Expand Up @@ -962,7 +972,7 @@ function altapayReleasePayment() {
$order->update_meta_data( '_released', true );
$order->add_order_note( __( 'Order released: "The order has been released"', 'altapay' ) );
$order->save();
wp_send_json_success( array( 'message' => 'Payment Released' ) );
wp_send_json_success( array( 'message' => __ ( 'Payment Released.', 'altapay') ) );
}
} else {
$order->add_order_note( __( 'Release failed: ' . $response->MerchantErrorMessage, 'altapay' ) );
Expand Down Expand Up @@ -1069,6 +1079,8 @@ function altapay_checkout_blocks_style() {
plugin_dir_url( __FILE__ ) . 'assets/css/blocks.css',
);
}


add_action( 'wp_enqueue_scripts', 'altapay_checkout_blocks_style' );
add_action( 'woocommerce_blocks_loaded', 'altapay_wc_checkout_block_support' );
add_filter( 'woocommerce_payment_gateways', 'altapay_add_gateway' );
Expand Down
2 changes: 1 addition & 1 deletion assets/js/capture.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jQuery( document ).ready(
function (response) {
var result = response.data;
if (response.success === true) {
jQuery( '.capture-status' ).html( '<strong class="green">Payment captured.</strong>' );
jQuery( '.capture-status' ).html( '<strong class="green">' + result.message + '</strong>' );
jQuery( '.payment-reserved' ).text( result.reserved );
jQuery( '.payment-captured' ).text( result.captured );
jQuery( '.payment-refunded' ).text( result.refunded );
Expand Down
5 changes: 2 additions & 3 deletions assets/js/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ jQuery( document ).ready(
function (response) {
var result = response.data;
if (response.success === true) {
jQuery( '.release-status' ).html( '<strong class="green">Payment released.</strong>' );
alert( 'Payment released' );
location.reload();
jQuery( '.release-status' ).html( '<strong class="green">' + result.message + '</strong>' );
window.setTimeout(function(){location.reload()}, 1000);
} else {
jQuery( '.release-status' ).html( '<strong class="red">Release failed: ' + result.error + '</strong>' );
}
Expand Down
Binary file added languages/altapay-cs_CZ.mo
Binary file not shown.
Binary file added languages/altapay-da_DK.mo
Binary file not shown.
Binary file added languages/altapay-de_AT.mo
Binary file not shown.
Binary file added languages/altapay-de_CH.mo
Binary file not shown.
Binary file added languages/altapay-de_CH_informal.mo
Binary file not shown.
Binary file added languages/altapay-de_DE.mo
Binary file not shown.
Binary file added languages/altapay-de_DE_formal.mo
Binary file not shown.
Binary file added languages/altapay-et.mo
Binary file not shown.
Binary file added languages/altapay-fi.mo
Binary file not shown.
Binary file added languages/altapay-fr_BE.mo
Binary file not shown.
Binary file added languages/altapay-fr_CA.mo
Binary file not shown.
Binary file added languages/altapay-fr_FR.mo
Binary file not shown.
Binary file added languages/altapay-it_IT.mo
Binary file not shown.
Binary file added languages/altapay-lt_LT.mo
Binary file not shown.
Binary file added languages/altapay-nl_BE.mo
Binary file not shown.
Binary file added languages/altapay-nl_NL.mo
Binary file not shown.
Binary file added languages/altapay-nl_NL_formal.mo
Binary file not shown.
Binary file added languages/altapay-nn_NO.mo
Binary file not shown.
Binary file added languages/altapay-pl_PL.mo
Binary file not shown.
Binary file added languages/altapay-ro_RO.mo
Binary file not shown.
Binary file added languages/altapay-sv_SE.mo
Binary file not shown.
8 changes: 6 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Tags: AltaPay, Gateway, Payments, WooCommerce, Payment Card Industry
Requires PHP: 7.4
Requires at least: 5.0
Tested up to: 6.6
Stable tag: 3.6.7
Stable tag: 3.6.8
License: MIT
WC requires at least: 3.9.0
WC tested up to: 9.0.2
WC tested up to: 9.1.2
License URI: http://www.gnu.org/licenses/gpl-2.0.html

A plugin that integrates your WooCommerce web shop to the AltaPay payments gateway.
Expand Down Expand Up @@ -39,6 +39,10 @@ AltaPay's Payment Gateway for WooCommerce provides merchants with access to a fu

== Changelog ==

= 3.6.8 =
* Add translation support for the AltaPay Payment Actions grid in the following WordPress-supported languages:
Danish, German, Estonian, Finnish, French, Czech, German (Austria), German (Switzerland, informal), German (formal), German (Switzerland), French (Belgium), French (Canada), Italian, Lithuanian, Dutch, Dutch (Belgium), Dutch (Formal), Norwegian Nynorsk, Polish, Romanian, Swedish.

= 3.6.7 =
* Extend support to include all languages that the gateway supports.
Supported languages: https://documentation.altapay.com/Content/Ecom/Reference/Supported%20languages.htm
Expand Down
14 changes: 7 additions & 7 deletions views/tables/capture.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
<tr style="font-weight: bold; border-collapse: collapse; padding: 15px;">
<thead>
<tr>
<th width="40%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white">Product name</th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white">Price with tax</th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white">Price without tax</th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white">Ordered</th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white">Discount Percent</th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white">Quantity</th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white">Total amount</th>
<th width="40%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white"><?php esc_html_e( 'Product name', 'altapay' ); ?></th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white"><?php esc_html_e( 'Price with tax', 'altapay' ); ?></th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white"><?php esc_html_e( 'Price without tax', 'altapay' ); ?></th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white"><?php esc_html_e( 'Ordered', 'altapay' ); ?></th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white"><?php esc_html_e( 'Discount Percent', 'altapay' ); ?></th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white"><?php esc_html_e( 'Quantity', 'altapay' ); ?></th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white"><?php esc_html_e( 'Total amount', 'altapay' ); ?></th>
</tr>
</thead>
</tr>
Expand Down
32 changes: 16 additions & 16 deletions views/tables/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@
<div>
<input class="action-select filled-in" name="allow-orderlines"
type="checkbox" id="ap-allow-orderlines" checked="checked"/>
<label for="ap-allow-orderlines" class="form-check-label"> Send order lines</label>
<label for="ap-allow-orderlines" class="form-check-label"> <?php esc_html_e( 'Send order lines', 'altapay' ); ?></label>
</div>
</div>
<br>
<div>
<input type="text" pattern="[0-9]+(\.[0-9]{0,2})?%?" id="capture-amount"
name="capture-amount" value="{{max($toBeCaptured, 0)}}"
placeholder="Amount"/>
placeholder="<?php esc_html_e( 'Amount', 'altapay' ); ?>"/>
<a id="altapay_capture" class="f7 link dim ph4 pv2 mb1 dib white"
style="margin-left:20px; color:white; background-color:#006064; cursor:pointer; border-radius: 4px;">Capture</a>
style="margin-left:20px; color:white; background-color:#006064; cursor:pointer; border-radius: 4px;"><?php esc_html_e( 'Capture', 'altapay' ); ?></a>
</div>
</div>
@endif
Expand All @@ -93,15 +93,15 @@
<div>
<input class="action-select filled-in" name="allow-refund-orderlines"
type="checkbox" id="ap-allow-refund-orderlines" checked="checked"/>
<label for="ap-allow-refund-orderlines" class="form-check-label"> Send order lines</label>
<label for="ap-allow-refund-orderlines" class="form-check-label"> <?php esc_html_e( 'Send order lines', 'altapay' ); ?></label>
</div>
</div>
<br>
<div>
<input type="text" pattern="[0-9]+(\.[0-9]{0,2})?%?" id="refund-amount" name="refund-amount"
value="{{max($toBeRefunded, 0)}}" placeholder="Amount"/>
value="{{max($toBeRefunded, 0)}}" placeholder="<?php esc_html_e( 'Amount', 'altapay' ); ?>"/>
<a id="altapay_refund" class="f7 link dim ph4 pv2 mb1 dib white"
style="margin-left:20px; color:white; background-color:#006064; cursor:pointer; border-radius: 4px;">Refund</a>
style="margin-left:20px; color:white; background-color:#006064; cursor:pointer; border-radius: 4px;"><?php esc_html_e( 'Refund', 'altapay' ); ?></a>
</div>
</div>
@endif
Expand All @@ -111,43 +111,43 @@
<div>
<div class="release-status" style="margin-bottom:10px;"></div>
<div>
<strong>Transaction ID:</strong>
<strong><?php esc_html_e( 'Transaction ID', 'altapay' ); ?>:</strong>
<span>{{$transaction_id}}</span>
</div>
<br>
<div>
<strong>Reserved:</strong>
<strong><?php esc_html_e( 'Reserved', 'altapay' ); ?>:</strong>
<span class="payment-reserved">{{number_format($reserved, 2)}}</span> {{$order->get_currency()}}
</div>
<br>
<div>
<strong>Chargeable:</strong>
<strong><?php esc_html_e( 'Chargeable', 'altapay' ); ?>:</strong>
<span class="payment-chargeable">{{number_format($charge, 2)}}</span> {{$order->get_currency()}}
</div>
<br>
<div>
<strong>Captured:</strong>
<strong><?php esc_html_e( 'Captured', 'altapay' ); ?>:</strong>
<span class="payment-captured">{{number_format($captured, 2)}}</span> {{$order->get_currency()}}
</div>
<br>
<div>
<strong>Refunded:</strong>
<strong><?php esc_html_e( 'Refunded', 'altapay' ); ?>:</strong>
<span class="payment-refunded">{{number_format($refunded, 2)}}</span> {{$order->get_currency()}}
</div>
@if ( $captured < $reserved )
<br>
<a id="openCaptureModal" title="Capture Payment" href="#TB_inline?&width=800&inlineId=captureModal" class="thickbox f7 link dim ph4 pv2 mb1 dib white"
style="color:white; background-color:#006064; cursor:pointer; border-radius: 4px; width: 100%;text-align: center;font-weight: bold;margin-bottom: 15px;">Capture</a>
<a id="openCaptureModal" title="<?php esc_html_e( 'Capture Payment', 'altapay' ); ?>" href="#TB_inline?&width=800&inlineId=captureModal" class="thickbox f7 link dim ph4 pv2 mb1 dib white"
style="color:white; background-color:#006064; cursor:pointer; border-radius: 4px; width: 100%;text-align: center;font-weight: bold;margin-bottom: 15px;"><?php esc_html_e( 'Capture', 'altapay' ); ?></a>
@endif
@if ( $refunded < $reserved and $captured)
<br>
<a id="openRefundModal" title="Refund Payment" href="#TB_inline?&width=800&inlineId=refundModal" class="thickbox f7 link dim ph4 pv2 mb1 dib white"
style="color:white; background-color:#006064; cursor:pointer; border-radius: 4px; width: 100%;text-align: center;font-weight: bold;margin-bottom: 15px;">Refund</a>
<a id="openRefundModal" title="<?php esc_html_e( 'Refund Payment', 'altapay' ); ?>" href="#TB_inline?&width=800&inlineId=refundModal" class="thickbox f7 link dim ph4 pv2 mb1 dib white"
style="color:white; background-color:#006064; cursor:pointer; border-radius: 4px; width: 100%;text-align: center;font-weight: bold;margin-bottom: 15px;"><?php esc_html_e( 'Refund', 'altapay' ); ?></a>
@endif
@if ($order->get_transaction_id() && $captured == 0)
<br>
<a id="altapay_release_payment" class="f7 link dim ph4 pv2 mb1 dib white"
style="color:white; background-color:#ed2939; cursor:pointer; border-radius: 4px; width: 100%;text-align: center;font-weight: bold;margin-bottom: 15px;">Release Payment</a>
style="color:white; background-color:#ed2939; cursor:pointer; border-radius: 4px; width: 100%;text-align: center;font-weight: bold;margin-bottom: 15px;"><?php esc_html_e( 'Release Payment', 'altapay' ); ?></a>
@endif
</div>
</body>
Expand Down
14 changes: 7 additions & 7 deletions views/tables/refund.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
<tr style="font-weight: bold; border-collapse: collapse; padding: 15px;">
<thead>
<tr>
<th width="40%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white">Product name</th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white">Price with tax</th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white">Price without tax</th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white">Ordered</th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white">Discount Percent</th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white">Quantity</th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white">Total amount</th>
<th width="40%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white"><?php esc_html_e( 'Product name', 'altapay' ); ?></th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white"><?php esc_html_e( 'Price with tax', 'altapay' ); ?></th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white"><?php esc_html_e( 'Price without tax', 'altapay' ); ?></th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white"><?php esc_html_e( 'Ordered', 'altapay' ); ?></th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white"><?php esc_html_e( 'Discount Percent', 'altapay' ); ?></th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white"><?php esc_html_e( 'Quantity', 'altapay' ); ?></th>
<th width="10%" class="fw6 bb b--black-20 tl pb3 pr3 bg-white"><?php esc_html_e( 'Total amount', 'altapay' ); ?></th>
</tr>
</thead>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions wiki.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,13 @@ In order to reconcile payments please follow the steps below:

Minimum system requirements are:
- WordPress min. 5.0 – max. 6.6
- WooCommerce min. 3.9.0 – max. 9.0.2
- WooCommerce min. 3.9.0 – max. 9.1.2
- PHP 7.4 and above
- PHP-bcmath library installed.
- PHP-curl MUST be enabled.

The latest tested version is:
- WordPress 6.6, WooCommerce 9.0.2 and PHP 8.1
- WordPress 6.6, WooCommerce 9.1.2 and PHP 8.1


## Troubleshooting
Expand Down
Loading