Skip to content

Commit

Permalink
Merge pull request #21 from wirecard/translations
Browse files Browse the repository at this point in the history
Add translations
  • Loading branch information
jpy committed May 9, 2017
2 parents 4dc6d0e + 69cd1e8 commit ee809d9
Show file tree
Hide file tree
Showing 11 changed files with 1,655 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ public function __construct() {
'datastorage_return'
)
);
add_action(
'woocommerce_receipt_' . $this->id,
array(
$this,
'payment_page'
)
);
}

/**
Expand Down Expand Up @@ -339,18 +346,38 @@ public function process_refund( $order_id, $amount = null, $reason = '' ) {
function process_payment( $order_id ) {
$order = wc_get_order( $order_id );

$redirect = $this->initiate_payment( $order, $_POST['wcs_payment_method'] );
$payment_type = $_POST['wcs_payment_method'];
WC()->session->wirecard_checkout_seamless_payment_type = $payment_type;

if ( ! $redirect ) {
return;
}
$page_url = $order->get_checkout_payment_url(true);
$page_url = add_query_arg( 'key', $order->get_order_key(), $page_url );
$page_url = add_query_arg( 'order-pay', $order_id, $page_url );
$page_url = add_query_arg( 'storage-id', $_POST['storageId'], $page_url );

return array(
'result' => 'success',
'redirect' => $redirect
'redirect' => $page_url
);
}

/**
* Handles iframe on payment page
*
* @since 1.0.0
*
* @param $order_id
*/
function payment_page( $order_id ) {
$order = new WC_Order( $order_id );

$iframeUrl = $this->initiate_payment( $order, WC()->session->wirecard_checkout_seamless_payment_type );
?>
<iframe src="<?php echo $iframeUrl ?>" width="100%" height="700px" border="0" frameborder="0">
<p>Your browser does not support iframes.</p>
</iframe>
<?php
}

/**
* Initialization of Wirecard payment
*
Expand Down Expand Up @@ -405,7 +432,7 @@ function initiate_payment( $order, $payment_type ) {
->setServiceUrl( $service_url )
->setAutoDeposit( $auto_deposit )
->setConsumerData( $consumer_data )
->setStorageId( $_POST['storageId'] )
->setStorageId( $_GET['storage-id'] )
->setOrderIdent( md5( implode( "", ( array_keys( $cart->cart_contents ) ) ) ) )
->createConsumerMerchantCrmId( $order->get_billing_email() );

Expand Down Expand Up @@ -686,6 +713,24 @@ function return_request() {

header( 'Location: ' . $redirectUrl );
}

if ( !array_key_exists( 'redirected', $_REQUEST ) ) {
$url = add_query_arg( array(
'wc-api' => 'WC_Gateway_Wirecard_Checkout_Seamless_Return',
'order-id' => $_REQUEST['order-id'],
'paymetState' => $_REQUEST['paymentState']
), site_url( '/', is_ssl() ? 'https' : 'http' ) );
wc_get_template(
'templates/back.php',
array(
'url' => $url
),
WOOCOMMERCE_GATEWAY_WCS_BASEDIR,
WOOCOMMERCE_GATEWAY_WCS_BASEDIR
);
die();
}

$order_id = $_REQUEST['order-id'];
$order = new WC_Order( $order_id );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
),
'woo_wcs_installment_billing_shipping_equal' => array(
'type' => 'switch',
'title' => __( 'Billing/shipping address musst be identical', 'woocommerce-wirecard-checkout-seamless' )
'title' => __( 'Billing/shipping address must be identical', 'woocommerce-wirecard-checkout-seamless' )
),
'woo_wcs_installment_allowed_billing_countries' => array(
'type' => 'multiselect',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ public function get_payment_fields() {

$html .= "<p class='form-row'>";

$html .= "<label><input type='checkbox' name='wcs_installment_consent'>" . __( 'I agree that the data which are necessary for the liquidation of purchase on account and which are used to complete the identity and credit check are transmitted to payolution. My ' . $consent_link . ' can be revoked at any time with effect for the future.',
'woocommerce-wirecard-checkout-seamless' ) . "</label>";
$html .= "<label><input type='checkbox' name='wcs_installment_consent'>"
. __( 'I agree that the data which are necessary for the liquidation of purchase on account and which are used to complete the identity and credit check are transmitted to payolution. My ', 'woocommerce-wirecard-checkout-seamless' )
. $consent_link
. __( ' can be revoked at any time with effect for the future.', 'woocommerce-wirecard-checkout-seamless' ) . "</label>";

$html .= "</p>";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ public function get_payment_fields() {

$html .= "<p class='form-row'>";

$html .= "<label><input type='checkbox' name='consent'>" . __( 'I agree that the data which are necessary for the liquidation of purchase on account and which are used to complete the identity and credit check are transmitted to payolution. My ' . $consent_link . ' can be revoked at any time with effect for the future.',
'woocommerce-wirecard-checkout-seamless' ) . "</label>";
$html .= "<label><input type='checkbox' name='consent'>"
. __( 'I agree that the data which are necessary for the liquidation of purchase on account and which are used to complete the identity and credit check are transmitted to payolution. My ', 'woocommerce-wirecard-checkout-seamless' )
. $consent_link
. __(' can be revoked at any time with effect for the future.', 'woocommerce-wirecard-checkout-seamless' ) . "</label>";

$html .= "</p>";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ public function get_payment_fields() {

$html .= "<p class='form-row'>";

$html .= "<label><input type='checkbox' name='b2b_consent' id='woo_wcs_b2b_consent'>" . __( 'I agree that the data which are necessary for the liquidation of purchase on account and which are used to complete the identity and credit check are transmitted to payolution. My ' . $consent_link . ' can be revoked at any time with effect for the future.',
'woocommerce-wirecard-checkout-seamless' ) . "</label>";
$html .= "<label><input type='checkbox' name='b2b_consent' id='woo_wcs_b2b_consent'>"
. __( 'I agree that the data which are necessary for the liquidation of purchase on account and which are used to complete the identity and credit check are transmitted to payolution. My ', 'woocommerce-wirecard-checkout-seamless' )
. $consent_link
. __( ' can be revoked at any time with effect for the future.', 'woocommerce-wirecard-checkout-seamless' ) . "</label>";

$html .= "</p>";
}
Expand Down Expand Up @@ -301,7 +303,7 @@ public function validate_payment_fields( $data ) {
}

if ( empty( $customer->get_billing_company() ) )
$errors[] = "&bull; " . __( 'For Invoice B2B, <a href="#billing_company">Company name</a> must not be empty.', 'woocommerce-wirecard-checkout-seamless' );
$errors[] = "&bull; " . __( 'For Invoice B2B, <a href=\'#billing_company\'>Company name</a> must not be empty.', 'woocommerce-wirecard-checkout-seamless' );

return count( $errors ) == 0 ? true : join( "<br>", $errors );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function validate_payment_fields( $data ) {
$errors = [ ];

if ( empty( $data['bankAccountIban'] ) ) {
$errors[] = "&bull; " . __( 'Paybox number must not be empty.',
$errors[] = "&bull; " . __( 'IBAN must not be empty.',
'woocommerce-wirecard-checkout-seamless' );
}

Expand Down
Binary file not shown.
Loading

0 comments on commit ee809d9

Please sign in to comment.