Split up payment view partials

react_convert
Mark Moffat 2018-01-23 19:52:45 +01:00
parent 6297639688
commit d7fcb18429
5 changed files with 75 additions and 139 deletions

View File

@ -30,56 +30,10 @@
</div> </div>
{{/if}} {{/if}}
<form id="shipping-form" class="shipping-form" action="/{{config.paymentGateway}}/checkout_action" method="post" role="form" data-toggle="validator" novalidate="false"> <form id="shipping-form" class="shipping-form" action="/{{config.paymentGateway}}/checkout_action" method="post" role="form" data-toggle="validator" novalidate="false">
<div class="col-xs-12 col-md-12"> {{> payments/shipping-form}}
<div class="form-group">
<input type="email" class="form-control customerDetails" id="shipEmail" name="shipEmail" minlength="5" placeholder="Email address" value="{{session.customer.email}}" required>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipFirstname" name="shipFirstname" placeholder="First name" value="{{session.customer.firstName}}" required>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipLastname" name="shipLastname" placeholder="Last name" value="{{session.customer.lastName}}" required>
</div>
</div>
<div class="col-xs-12 col-md-12">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipAddr1" name="shipAddr1" placeholder="Address 1" value="{{session.customer.address1}}" required>
</div>
</div>
<div class="col-xs-12 col-md-12">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipAddr2" name="shipAddr2" placeholder="Address 2 (optional)" value="{{session.customer.address1}}">
</div>
</div>
<div class="col-xs-12 col-md-4">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipCountry" name="shipCountry" placeholder="Country" value="{{session.customer.country}}" required>
</div>
</div>
<div class="col-xs-12 col-md-4">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipState" name="shipState" placeholder="State" value="{{session.customer.state}}" required>
</div>
</div>
<div class="col-xs-12 col-md-4">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipPostcode" name="shipPostcode" placeholder="Post code" value="{{session.customer.postcode}}" required>
</div>
</div>
<div class="col-xs-12 col-md-12">
<div class="form-group">
<input type="number" class="form-control customerDetails" id="shipPhoneNumber" name="shipPhoneNumber" placeholder="Phone number" value="{{session.customer.phone}}" required>
</div>
</div>
{{#if session.customer}} {{#if session.customer}}
{{#ifCond config.paymentGateway '==' 'paypal'}} {{#ifCond config.paymentGateway '==' 'paypal'}}
<div class="paypal_button col-xs-12 col-md-12 text-center"> {{> payments/paypal}}
<button id="checkout_paypal" class="btn btn-success" type="submit"><i class="fa fa-cc-paypal fa-lg" aria-hidden="true"></i> Pay with PayPal <i class="fa fa-cc-paypal fa-lg" aria-hidden="true"></i></button>
</div>
{{/ifCond}} {{/ifCond}}
{{/if}} {{/if}}
{{#unless session.customer}} {{#unless session.customer}}
@ -94,30 +48,9 @@
</form> </form>
{{#if session.customer}} {{#if session.customer}}
{{#ifCond config.paymentGateway '==' 'stripe'}} {{#ifCond config.paymentGateway '==' 'stripe'}}
<div class="col-xs-12 col-md-12 text-center"> {{> payments/stripe}}
<form method="POST" id="payment-form">
<button
type="submit"
id="stripeButton"
value="Process payment"
class="btn btn-success"
type="submit"
data-key="{{paymentConfig.publicKey}}"
data-amount="{{amountNoDecimal session.totalCartAmount}}"
data-name="{{config.cartTitle}}"
data-description="{{config.cartTitle}} Payment"
data-image="{{paymentConfig.stripeLogoURL}}"
data-locale="auto"
data-zip-code="false"
data-currency="{{paymentConfig.stripeCurrency}}">
<i class="fa fa-cc-stripe fa-lg" aria-hidden="true"></i> Process payment <i class="fa fa-cc-stripe fa-lg" aria-hidden="true"></i>
</button>
<script src="https://checkout.stripe.com/v2/checkout.js"></script>
</form>
</div>
{{/ifCond}} {{/ifCond}}
{{/if}} {{/if}}
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,3 @@
<div class="paypal_button col-xs-12 col-md-12 text-center">
<button id="checkout_paypal" class="btn btn-success" type="submit"><i class="fa fa-cc-paypal fa-lg" aria-hidden="true"></i> Pay with PayPal <i class="fa fa-cc-paypal fa-lg" aria-hidden="true"></i></button>
</div>

View File

@ -0,0 +1,45 @@
<div class="col-xs-12 col-md-12">
<div class="form-group">
<input type="email" class="form-control customerDetails" id="shipEmail" name="shipEmail" minlength="5" placeholder="Email address" value="{{session.customer.email}}" required>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipFirstname" name="shipFirstname" placeholder="First name" value="{{session.customer.firstName}}" required>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipLastname" name="shipLastname" placeholder="Last name" value="{{session.customer.lastName}}" required>
</div>
</div>
<div class="col-xs-12 col-md-12">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipAddr1" name="shipAddr1" placeholder="Address 1" value="{{session.customer.address1}}" required>
</div>
</div>
<div class="col-xs-12 col-md-12">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipAddr2" name="shipAddr2" placeholder="Address 2 (optional)" value="{{session.customer.address1}}">
</div>
</div>
<div class="col-xs-12 col-md-4">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipCountry" name="shipCountry" placeholder="Country" value="{{session.customer.country}}" required>
</div>
</div>
<div class="col-xs-12 col-md-4">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipState" name="shipState" placeholder="State" value="{{session.customer.state}}" required>
</div>
</div>
<div class="col-xs-12 col-md-4">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipPostcode" name="shipPostcode" placeholder="Post code" value="{{session.customer.postcode}}" required>
</div>
</div>
<div class="col-xs-12 col-md-12">
<div class="form-group">
<input type="number" class="form-control customerDetails" id="shipPhoneNumber" name="shipPhoneNumber" placeholder="Phone number" value="{{session.customer.phone}}" required>
</div>
</div>

View File

@ -0,0 +1,21 @@
<div class="col-xs-12 col-md-12 text-center">
<form method="POST" id="payment-form">
<button
type="submit"
id="stripeButton"
value="Process payment"
class="btn btn-success"
type="submit"
data-key="{{paymentConfig.publicKey}}"
data-amount="{{amountNoDecimal session.totalCartAmount}}"
data-name="{{config.cartTitle}}"
data-description="{{config.cartTitle}} Payment"
data-image="{{paymentConfig.stripeLogoURL}}"
data-locale="auto"
data-zip-code="false"
data-currency="{{paymentConfig.stripeCurrency}}">
<i class="fa fa-cc-stripe fa-lg" aria-hidden="true"></i> Process payment <i class="fa fa-cc-stripe fa-lg" aria-hidden="true"></i>
</button>
<script src="https://checkout.stripe.com/v2/checkout.js"></script>
</form>
</div>

View File

@ -30,56 +30,10 @@
</div> </div>
{{/if}} {{/if}}
<form id="shipping-form" class="shipping-form" action="/{{config.paymentGateway}}/checkout_action" method="post" role="form" data-toggle="validator" novalidate="false"> <form id="shipping-form" class="shipping-form" action="/{{config.paymentGateway}}/checkout_action" method="post" role="form" data-toggle="validator" novalidate="false">
<div class="col-xs-12 col-md-12"> {{> payments/shipping-form}}
<div class="form-group">
<input type="email" class="form-control customerDetails" id="shipEmail" name="shipEmail" minlength="5" placeholder="Email address" value="{{session.customer.email}}" required>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipFirstname" name="shipFirstname" placeholder="First name" value="{{session.customer.firstName}}" required>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipLastname" name="shipLastname" placeholder="Last name" value="{{session.customer.lastName}}" required>
</div>
</div>
<div class="col-xs-12 col-md-12">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipAddr1" name="shipAddr1" placeholder="Address 1" value="{{session.customer.address1}}" required>
</div>
</div>
<div class="col-xs-12 col-md-12">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipAddr2" name="shipAddr2" placeholder="Address 2 (optional)" value="{{session.customer.address1}}">
</div>
</div>
<div class="col-xs-12 col-md-4">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipCountry" name="shipCountry" placeholder="Country" value="{{session.customer.country}}" required>
</div>
</div>
<div class="col-xs-12 col-md-4">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipState" name="shipState" placeholder="State" value="{{session.customer.state}}" required>
</div>
</div>
<div class="col-xs-12 col-md-4">
<div class="form-group">
<input type="text" class="form-control customerDetails" id="shipPostcode" name="shipPostcode" placeholder="Post code" value="{{session.customer.postcode}}" required>
</div>
</div>
<div class="col-xs-12 col-md-12">
<div class="form-group">
<input type="number" class="form-control customerDetails" id="shipPhoneNumber" name="shipPhoneNumber" placeholder="Phone number" value="{{session.customer.phone}}" required>
</div>
</div>
{{#if session.customer}} {{#if session.customer}}
{{#ifCond config.paymentGateway '==' 'paypal'}} {{#ifCond config.paymentGateway '==' 'paypal'}}
<div class="paypal_button col-xs-12 col-md-12 text-center"> {{> payments/paypal}}
<button id="checkout_paypal" class="btn btn-success" type="submit"><i class="fa fa-cc-paypal fa-lg" aria-hidden="true"></i> Pay with PayPal <i class="fa fa-cc-paypal fa-lg" aria-hidden="true"></i></button>
</div>
{{/ifCond}} {{/ifCond}}
{{/if}} {{/if}}
{{#unless session.customer}} {{#unless session.customer}}
@ -94,27 +48,7 @@
</form> </form>
{{#if session.customer}} {{#if session.customer}}
{{#ifCond config.paymentGateway '==' 'stripe'}} {{#ifCond config.paymentGateway '==' 'stripe'}}
<div class="col-xs-12 col-md-12 text-center"> {{> payments/stripe}}
<form method="POST" id="payment-form">
<button
type="submit"
id="stripeButton"
value="Process payment"
class="btn btn-success"
type="submit"
data-key="{{paymentConfig.publicKey}}"
data-amount="{{amountNoDecimal session.totalCartAmount}}"
data-name="{{config.cartTitle}}"
data-description="{{config.cartTitle}} Payment"
data-image="{{paymentConfig.stripeLogoURL}}"
data-locale="auto"
data-zip-code="false"
data-currency="{{paymentConfig.stripeCurrency}}">
<i class="fa fa-cc-stripe fa-lg" aria-hidden="true"></i> Process payment <i class="fa fa-cc-stripe fa-lg" aria-hidden="true"></i>
</button>
<script src="https://checkout.stripe.com/v2/checkout.js"></script>
</form>
</div>
{{/ifCond}} {{/ifCond}}
{{/if}} {{/if}}
</div> </div>