From: Steve Sutton Date: Wed, 10 Jul 2019 13:04:53 +0000 (-0400) Subject: Update for Square payment X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=6f8288da32fa607d418539e84b8d27bb15bfc24a;p=WP-Plugins%2Fglm-member-db-billing.git Update for Square payment Build data to send to square payment --- diff --git a/js/sq-payment-form.js b/js/sq-payment-form.js index 83d3a34..58091e0 100644 --- a/js/sq-payment-form.js +++ b/js/sq-payment-form.js @@ -106,38 +106,50 @@ var paymentForm = new SqPaymentForm({ */ createPaymentRequest: function () { + var lname = $('#billing_lname').val(); + var fname = $('#billing_fname').val(); + var addr1 = $('#billing_addr1').val(); + var city = $('#billing_city').val(); + var state = $('#billing_state').val(); + var zip = $('#billing_zip').val(); + var email = $('#billing_email').val(); + var amount = $('#total_amount').val(); + + var paymentRequestJson = { requestShippingAddress: false, requestBillingInfo: true, shippingContact: { - familyName: "CUSTOMER LAST NAME", - givenName: "CUSTOMER FIRST NAME", - email: "mycustomer@example.com", + familyName: lname, + givenName: fname, + email: email, country: "USA", - region: "CA", - city: "San Francisco", + region: state, + city: city, addressLines: [ - "1455 Market St #600" + addr1 ], - postalCode: "94103", - phone:"14255551212" + postalCode: zip, + phone:"" }, currencyCode: "USD", countryCode: "US", total: { - label: "MERCHANT NAME", - amount: "1.00", + label: window.merchantName, + amount: amount, pending: false }, lineItems: [ { label: "Subtotal", - amount: "1.00", + amount: amount, pending: false } ] }; + console.log(paymentRequestJson); + return paymentRequestJson; }, diff --git a/views/common/billing/paymentForm.html b/views/common/billing/paymentForm.html index 93f5ea5..a330b08 100644 --- a/views/common/billing/paymentForm.html +++ b/views/common/billing/paymentForm.html @@ -16,7 +16,7 @@ First Name
- +
@@ -24,7 +24,7 @@ Last Name
- +
{/if} @@ -33,7 +33,7 @@ Address
- +
@@ -41,7 +41,7 @@ City
- +
@@ -49,7 +49,7 @@ State / Province
- {foreach $account.fieldData.billing_state.list as $s}
- +
@@ -72,7 +72,7 @@ Email Address
- +
diff --git a/views/common/billing/squarePaymentForm.html b/views/common/billing/squarePaymentForm.html index 05b3467..f4ac88b 100644 --- a/views/common/billing/squarePaymentForm.html +++ b/views/common/billing/squarePaymentForm.html @@ -3,7 +3,8 @@ {* link to the local SqPaymentForm initialization *} diff --git a/views/front/billing/paymentForm.html b/views/front/billing/paymentForm.html index 6c04421..2697026 100644 --- a/views/front/billing/paymentForm.html +++ b/views/front/billing/paymentForm.html @@ -17,7 +17,7 @@ - + @@ -172,7 +172,7 @@ jQuery(document).ready(function($){ } $('#renew_total').html( formatter.format( member_renewing_amount ) ); - $('#total_renew_amount').val( member_renewing_amount ); + $('#total_amount').val( member_renewing_amount ); }