Merge pull request #9553 from woothemes/issue/simplify-commerce-address-fields
Fix - address fields were not properly being passed to Simplify via t…
This commit is contained in:
commit
3959d4fe3e
|
@ -19,7 +19,14 @@
|
|||
|
||||
var card = $( '#simplify_commerce-card-number' ).val(),
|
||||
cvc = $( '#simplify_commerce-card-cvc' ).val(),
|
||||
expiry = $.payment.cardExpiryVal( $( '#simplify_commerce-card-expiry' ).val() );
|
||||
expiry = $.payment.cardExpiryVal( $( '#simplify_commerce-card-expiry' ).val() ),
|
||||
address1 = $form.find( '#billing_address_1' ).val(),
|
||||
address2 = $form.find( '#billing_address_2' ).val(),
|
||||
addressCountry = $form.find( '#billing_country' ).val(),
|
||||
addressState = $form.find( '#billing_state' ).val(),
|
||||
addressCity = $form.find( '#billing_city' ).val(),
|
||||
addressZip = $form.find( '#billing_postcode' ).val(),
|
||||
name = $form.find( '#billing_first_name' ).val() + ' ' + $form.find( '#billing_last_name' ).val();
|
||||
|
||||
card = card.replace( /\s/g, '' );
|
||||
|
||||
|
@ -29,7 +36,14 @@
|
|||
number: card,
|
||||
cvc: cvc,
|
||||
expMonth: expiry.month,
|
||||
expYear: ( expiry.year - 2000 )
|
||||
expYear: ( expiry.year - 2000 ),
|
||||
addressLine1: address1,
|
||||
addressLine2: address2,
|
||||
addressCountry: addressCountry,
|
||||
addressState: addressState,
|
||||
addressZip: addressZip,
|
||||
addressCity: addressCity,
|
||||
name: name
|
||||
}
|
||||
}, simplifyResponseHandler );
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
!function(a){function b(){var b=a("form.checkout, form#order_review");if(a("#payment_method_simplify_commerce").is(":checked")&&0===a("input.simplify-token").size()){b.block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var d=a("#simplify_commerce-card-number").val(),e=a("#simplify_commerce-card-cvc").val(),f=a.payment.cardExpiryVal(a("#simplify_commerce-card-expiry").val());return d=d.replace(/\s/g,""),SimplifyCommerce.generateToken({key:Simplify_commerce_params.key,card:{number:d,cvc:e,expMonth:f.month,expYear:f.year-2e3}},c),!1}return!0}function c(b){var c=a("form.checkout, form#order_review"),d=a("#simplify_commerce-cc-form");if(b.error){if(a(".woocommerce-error, .simplify-token",d).remove(),c.unblock(),"validation"===b.error.code){for(var e=b.error.fieldErrors,f=e.length,g="",h=0;f>h;h++)g+="<li>"+Simplify_commerce_params[e[h].field]+" "+Simplify_commerce_params.is_invalid+" - "+e[h].message+".</li>";d.prepend('<ul class="woocommerce-error">'+g+"</ul>")}}else d.append('<input type="hidden" class="simplify-token" name="simplify_token" value="'+b.id+'"/>'),c.submit()}a(function(){a(document.body).on("checkout_error",function(){a(".simplify-token").remove()}),a("form.checkout").on("checkout_place_order_simplify_commerce",function(){return b()}),a("form#order_review").on("submit",function(){return b()}),a("form.checkout, form#order_review").on("change","#simplify_commerce-cc-form input",function(){a(".simplify-token").remove()})})}(jQuery);
|
||||
!function(e){function r(){var r=e("form.checkout, form#order_review");if(e("#payment_method_simplify_commerce").is(":checked")&&0===e("input.simplify-token").size()){r.block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var o=e("#simplify_commerce-card-number").val(),n=e("#simplify_commerce-card-cvc").val(),c=e.payment.cardExpiryVal(e("#simplify_commerce-card-expiry").val()),m=r.find("#billing_address_1").val(),l=r.find("#billing_address_2").val(),a=r.find("#billing_country").val(),f=r.find("#billing_state").val(),s=r.find("#billing_city").val(),t=r.find("#billing_postcode").val(),d=r.find("#billing_first_name").val()+" "+r.find("#billing_last_name").val();return o=o.replace(/\s/g,""),SimplifyCommerce.generateToken({key:Simplify_commerce_params.key,card:{number:o,cvc:n,expMonth:c.month,expYear:c.year-2e3,addressLine1:m,addressLine2:l,addressCountry:a,addressState:f,addressZip:t,addressCity:s,name:d}},i),!1}return!0}function i(r){var i=e("form.checkout, form#order_review"),o=e("#simplify_commerce-cc-form");if(r.error){if(e(".woocommerce-error, .simplify-token",o).remove(),i.unblock(),"validation"===r.error.code){for(var n=r.error.fieldErrors,c=n.length,m="",l=0;c>l;l++)m+="<li>"+Simplify_commerce_params[n[l].field]+" "+Simplify_commerce_params.is_invalid+" - "+n[l].message+".</li>";o.prepend('<ul class="woocommerce-error">'+m+"</ul>")}}else o.append('<input type="hidden" class="simplify-token" name="simplify_token" value="'+r.id+'"/>'),i.submit()}e(function(){e(document.body).on("checkout_error",function(){e(".simplify-token").remove()}),e("form.checkout").on("checkout_place_order_simplify_commerce",function(){return r()}),e("form#order_review").on("submit",function(){return r()}),e("form.checkout, form#order_review").on("change","#simplify_commerce-cc-form input",function(){e(".simplify-token").remove()})})}(jQuery);
|
|
@ -304,13 +304,7 @@ class WC_Addons_Gateway_Simplify_Commerce extends WC_Gateway_Simplify_Commerce {
|
|||
'customer' => $customer_id,
|
||||
'description' => sprintf( __( '%s - Order #%s', 'woocommerce' ), esc_html( get_bloginfo( 'name', 'display' ) ), $order->get_order_number() ),
|
||||
'currency' => strtoupper( get_woocommerce_currency() ),
|
||||
'reference' => $order->id,
|
||||
'card.addressCity' => $order->billing_city,
|
||||
'card.addressCountry' => $order->billing_country,
|
||||
'card.addressLine1' => $order->billing_address_1,
|
||||
'card.addressLine2' => $order->billing_address_2,
|
||||
'card.addressState' => $order->billing_state,
|
||||
'card.addressZip' => $order->billing_postcode
|
||||
'reference' => $order->id
|
||||
) );
|
||||
|
||||
} catch ( Exception $e ) {
|
||||
|
@ -445,13 +439,7 @@ class WC_Addons_Gateway_Simplify_Commerce extends WC_Gateway_Simplify_Commerce {
|
|||
'customer' => $customer_id,
|
||||
'description' => trim( substr( $pre_order_name, 0, 1024 ) ),
|
||||
'currency' => strtoupper( get_woocommerce_currency() ),
|
||||
'reference' => $order->id,
|
||||
'card.addressCity' => $order->billing_city,
|
||||
'card.addressCountry' => $order->billing_country,
|
||||
'card.addressLine1' => $order->billing_address_1,
|
||||
'card.addressLine2' => $order->billing_address_2,
|
||||
'card.addressState' => $order->billing_state,
|
||||
'card.addressZip' => $order->billing_postcode
|
||||
'reference' => $order->id
|
||||
) );
|
||||
|
||||
if ( 'APPROVED' == $payment->paymentStatus ) {
|
||||
|
|
|
@ -327,13 +327,7 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway {
|
|||
'token' => $cart_token,
|
||||
'description' => sprintf( __( '%s - Order #%s', 'woocommerce' ), esc_html( get_bloginfo( 'name', 'display' ) ), $order->get_order_number() ),
|
||||
'currency' => strtoupper( get_woocommerce_currency() ),
|
||||
'reference' => $order->id,
|
||||
'card.addressCity' => $order->billing_city,
|
||||
'card.addressCountry' => $order->billing_country,
|
||||
'card.addressLine1' => $order->billing_address_1,
|
||||
'card.addressLine2' => $order->billing_address_2,
|
||||
'card.addressState' => $order->billing_state,
|
||||
'card.addressZip' => $order->billing_postcode
|
||||
'reference' => $order->id
|
||||
) );
|
||||
|
||||
$order_complete = $this->process_order_status( $order, $payment->id, $payment->paymentStatus, $payment->authCode );
|
||||
|
@ -411,7 +405,12 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway {
|
|||
'description' => sprintf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ),
|
||||
'receipt' => 'false',
|
||||
'color' => $this->modal_color,
|
||||
'redirect-url' => WC()->api_request_url( 'WC_Gateway_Simplify_Commerce' )
|
||||
'redirect-url' => WC()->api_request_url( 'WC_Gateway_Simplify_Commerce' ),
|
||||
'address' => $order->billing_address_1 . ' ' . $order->billing_address_2,
|
||||
'address-city' => $order->billing_city,
|
||||
'address-state' => $order->billing_state,
|
||||
'address-zip' => $order->billing_postcode,
|
||||
'address-country' => $order->billing_country
|
||||
), $order->id );
|
||||
|
||||
return $args;
|
||||
|
|
Loading…
Reference in New Issue