Skip to content

Commit

Permalink
Merge pull request #68 from wirecard/TPWDCEE-1258
Browse files Browse the repository at this point in the history
#67 set email from billing address for guest checkout
  • Loading branch information
gregorkosmina authored May 3, 2018
2 parents c41c177 + 8d0c9dd commit 6eca796
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/*
Original file line number Diff line number Diff line change
Expand Up @@ -238,21 +238,26 @@ public function get_consumer_data( $order, $gateway, $checkout_data ) {
$consumerData->setUserAgent( $_SERVER['HTTP_USER_AGENT'] );

$user_data = get_userdata( $order->get_user_id() );
$consumerData->setEmail( isset( $user_data->user_email ) ? $user_data->user_email : '' );
$email = isset( $user_data->user_email ) ? $user_data->user_email : '';

if ( $gateway->get_option( 'woo_wcs_forwardconsumerbillingdata' ) || $this->force_consumer_data( $checkout_data['wcs_payment_method'] ) ) {
$billing_address = $this->get_address_data( $order, 'billing' );
$consumerData->addAddressInformation( $billing_address );

if (!strlen($email)) {
$email = $order->get_billing_email();
}
}
if ( $gateway->get_option( 'woo_wcs_forwardconsumershippingdata' ) || $this->force_consumer_data( $checkout_data['wcs_payment_method'] ) ) {
$shipping_address = $this->get_address_data( $order, 'shipping' );
$consumerData->addAddressInformation( $shipping_address );
}
if ($checkout_data['wcs_payment_method'] == WirecardCEE_Stdlib_PaymentTypeAbstract::INVOICE ||
if ($checkout_data['wcs_payment_method'] == WirecardCEE_Stdlib_PaymentTypeAbstract::INVOICE ||
$checkout_data['wcs_payment_method'] == WirecardCEE_Stdlib_PaymentTypeAbstract::INSTALLMENT) {
$birth_date = new DateTime( $checkout_data['dob_year'] . '-' . $checkout_data['dob_month'] . '-' . $checkout_data['dob_day'] );
$consumerData->setBirthDate($birth_date);
}
$birth_date = new DateTime( $checkout_data['dob_year'] . '-' . $checkout_data['dob_month'] . '-' . $checkout_data['dob_day'] );
$consumerData->setBirthDate($birth_date);
}
$consumerData->setEmail( $email );

return $consumerData;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Wirecard Checkout Seamless
* Plugin URI: https://github.com/wirecard/woocommerce-wcs
* Description: Wirecard Checkout Seamless plugin for WooCommerce
* Version: 1.0.16
* Version: 1.0.17
* Author: Wirecard
* Author URI: https://www.wirecard.at/
* License: GPL2
Expand Down

0 comments on commit 6eca796

Please sign in to comment.