-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from NicolasBarbey/main
fix order payment
- Loading branch information
Showing
15 changed files
with
274 additions
and
14 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<form id="paypal-express-checkout" method="post" action="{url path='/module/paypal/express/checkout'}" class="pull-right"></form> | ||
<script> | ||
window.paypalCheckoutReady = function() { | ||
paypal.checkout.setup('{$paypal_merchantid}', { | ||
environment: '{$paypal_mode}', | ||
container: 'paypal-express-checkout', | ||
locale: '{lang attr="locale"}' | ||
}); | ||
}; | ||
</script> | ||
<script src="//www.paypalobjects.com/api/checkout.js" async></script> |
85 changes: 85 additions & 0 deletions
85
templates/frontOffice/default/paypal/form/extra-credit-card.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<fieldset class="col-xs-11 col-xs-offset-1"> | ||
<input type="radio" id="{$label_attr.for}{$choice->label}" class="paypal-method" name="{$name}" data-content="#content-paypal-credit-card" value="{$choice->label}" {if $value == $choice->label}checked{/if}/> | ||
<label class="control-label" for="{$label_attr.for}{$choice->label}"><strong>{intl l=$choice->label d="paypal.fo.default"}</strong> :<br />{if $required} <span class="required">*</span>{/if}</label> | ||
<img src="{image file='assets/cards-logo.jpg' source="PayPal"}" border="0" alt="CB / VISA / Mastercard" /> | ||
|
||
<div id="content-paypal-credit-card" class="hidden"> | ||
{form_field field='paypal_credit_card_type.card_type'} | ||
<div class="form-group row{if $error} has-error{/if}"> | ||
<label class="control-label col-sm-3" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label> | ||
<div class="control-input col-sm-5"> | ||
|
||
<select name="{$name}" id="{$label_attr.for}"> | ||
{foreach from=$choices item=type} | ||
<option value="{$type->value}">{$type->label}</option> | ||
{/foreach} | ||
</select> | ||
{if $error } | ||
<span class="help-block">{$message}</span> | ||
{assign var="error_focus" value="true"} | ||
{/if} | ||
</div> | ||
</div> | ||
{/form_field} | ||
|
||
{form_field field='paypal_credit_card_type.card_number'} | ||
<div class="form-group row{if $error} has-error{/if}"> | ||
<label class="control-label col-sm-3" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label> | ||
<div class="control-input col-sm-5"> | ||
<input type="text" name="{$name}" id="{$label_attr.for}" value="" /> | ||
</div> | ||
{if $error } | ||
<span class="help-block">{$message}</span> | ||
{assign var="error_focus" value="true"} | ||
{/if} | ||
</div> | ||
{/form_field} | ||
|
||
{form_field field='paypal_credit_card_type.card_expire_month'} | ||
<div class="form-group row{if $error} has-error{/if}"> | ||
<label class="control-label col-sm-3" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label> | ||
<div class="control-input col-sm-5"> | ||
<select name="{$name}" id="{$label_attr.for}"> | ||
{foreach from=$choices item=type} | ||
<option value="{$type->value}">{$type->label}</option> | ||
{/foreach} | ||
</select> | ||
{if $error } | ||
<span class="help-block">{$message}</span> | ||
{assign var="error_focus" value="true"} | ||
{/if} | ||
</div> | ||
</div> | ||
{/form_field} | ||
|
||
{form_field field='paypal_credit_card_type.card_expire_year'} | ||
<div class="form-group row{if $error} has-error{/if}"> | ||
<label class="control-label col-sm-3" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label> | ||
<div class="control-input col-sm-5"> | ||
<select name="{$name}" id="{$label_attr.for}"> | ||
{foreach from=$choices item=type} | ||
<option value="{$type->value}">{$type->label}</option> | ||
{/foreach} | ||
</select> | ||
{if $error } | ||
<span class="help-block">{$message}</span> | ||
{assign var="error_focus" value="true"} | ||
{/if} | ||
</div> | ||
</div> | ||
{/form_field} | ||
|
||
{form_field field='paypal_credit_card_type.card_cvv'} | ||
<div class="form-group row{if $error} has-error{/if}"> | ||
<label class="control-label col-sm-3" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label> | ||
<div class="control-input col-sm-5"> | ||
<input type="text" name="{$name}" id="{$label_attr.for}" value="" /> | ||
{if $error } | ||
<span class="help-block">{$message}</span> | ||
{assign var="error_focus" value="true"} | ||
{/if} | ||
</div> | ||
</div> | ||
{/form_field} | ||
</div> | ||
</fieldset> |
17 changes: 17 additions & 0 deletions
17
templates/frontOffice/default/paypal/form/extra-paypal.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<fieldset class="col-xs-11 col-xs-offset-1"> | ||
{if $method_paypal_with_in_context} | ||
<input type="radio" id="{$label_attr.for}{$choice->label}-express" class="paypal-method paypal-express-method" name="{$name}" value="{$choice->label}" {if $value == $choice->label}checked{/if}/> | ||
<label class="control-label" for="{$label_attr.for}{$choice->label}-express"> | ||
<strong>{intl l=$choice->label d="paypal.fo.default"}</strong> : | ||
<img src="{image file='assets/paypal-logo.png' source="PayPal"}" border="0" alt="PayPal account" /> | ||
</label> | ||
{else} | ||
<input type="radio" id="{$label_attr.for}{$choice->label}" class="paypal-method" name="{$name}" value="{$choice->label}" {if $value == $choice->label}checked{/if}/> | ||
<label class="control-label" for="{$label_attr.for}{$choice->label}"> | ||
<strong>{intl l=$choice->label d="paypal.fo.default"}</strong> : | ||
<img src="{image file='assets/paypal-logo.png' source="PayPal"}" border="0" alt="PayPal account" /> | ||
</label> | ||
{/if} | ||
|
||
|
||
</fieldset> |
26 changes: 26 additions & 0 deletions
26
templates/frontOffice/default/paypal/form/extra-planified-payment.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{assign var="methodName" value=$name} | ||
{form_field field='paypal_planified_payment'} | ||
{if count($choices) > 0} | ||
<fieldset class="col-xs-11 col-xs-offset-1"> | ||
<input type="radio" id="{$label_attr.for}{$choice->label}" class="paypal-method" name="{$methodName}" data-content="#content-paypal-planified-payment" value="{$choice->label}" {if $value == $choice->label}checked{/if}/> | ||
<label class="control-label" for="{$label_attr.for}{$choice->label}"><strong>{intl l=$choice->label d="paypal.fo.default"}</strong> :<br />{if $required} <span class="required">*</span>{/if}</label> | ||
<div id="content-paypal-planified-payment" class="hidden"> | ||
{foreach $choices as $choice} | ||
{assign var="planifiedPayment" value=$choice->data} | ||
<div class="form-group row{if $error} has-error{/if}"> | ||
<div class="control-input col-sm-5"> | ||
<input type="radio" id="{$label_attr.for}{$planifiedPayment->getId()}" name="{$name}" value="{$planifiedPayment->getId()}" {if $value == $planifiedPayment->getId()}checked{/if}/> | ||
<label class="control-label" for="{$label_attr.for}{$planifiedPayment->getId()}"><strong>{$planifiedPayment->getTitle()}</strong> :<br />{if $required} <span class="required">*</span>{/if}</label> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
{$planifiedPayment->getDescription()} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{/foreach} | ||
</div> | ||
</fieldset> | ||
{/if} | ||
{/form_field} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<article> | ||
<span id='lippButton'></span> | ||
<script src='https://www.paypalobjects.com/js/external/api.js'></script> | ||
<script> | ||
paypal.use( ['login'], function (login) { | ||
login.render ({ | ||
"appid":'{$paypal_appid}', | ||
"authend":'{$paypal_authend}', | ||
"scopes":"profile email address phone https://uri.paypal.com/services/paypalattributes", | ||
"containerid":"lippButton", | ||
"locale":"fr-fr", | ||
"returnurl":'{url path="/module/paypal/login/ok"}' | ||
}); | ||
}); | ||
</script> | ||
</article> |
7 changes: 7 additions & 0 deletions
7
templates/frontOffice/default/paypal/order-delivery-bottom-js.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script> | ||
$('#form-cart-delivery button:submit').each(function() { | ||
if (!$(this).hasClass('paypal')) { | ||
$(this).addClass('hidden'); | ||
} | ||
}); | ||
</script> |
4 changes: 4 additions & 0 deletions
4
templates/frontOffice/default/paypal/order-delivery-bottom.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<button class="btn btn-primary pull-right paypal" type="submit"> | ||
<i class="fa fa-chevron-right"></i> | ||
{intl l='Finish payment with PayPal' d='paypal.fo.default'} | ||
</button> |
11 changes: 11 additions & 0 deletions
11
templates/frontOffice/default/paypal/order-invoice-bottom.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<form id="paypal-express-checkout" method="post" action="{url path='/module/paypal/invoice/express/checkout'}" class="hidden"></form> | ||
<script> | ||
window.paypalCheckoutReady = function() { | ||
paypal.checkout.setup('{$paypal_merchantid}', { | ||
environment: '{$paypal_mode}', | ||
container: 'paypal-express-checkout', | ||
locale: '{lang attr="locale"}' | ||
}); | ||
}; | ||
</script> | ||
<script src="//www.paypalobjects.com/api/checkout.js" async></script> |
58 changes: 58 additions & 0 deletions
58
templates/frontOffice/default/paypal/order-invoice-js.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<script type="text/javascript"> | ||
var payPalModuleId = '{$module_id}'; | ||
|
||
(function ($) { | ||
|
||
{literal} | ||
$(document).ready(function () { | ||
var $payPal = $('#payment_' + payPalModuleId) | ||
, $payPalMethod = $('input:radio[class=paypal-method]') | ||
, hasSelection = false | ||
; | ||
|
||
if ($payPal.prop('checked')) { | ||
$('#paypal-methods').removeClass('hidden'); | ||
} | ||
|
||
$('#payment-method input:radio').on('change', function() { | ||
if ($(this).attr('name') === 'thelia_order_payment[payment-module]') { | ||
if ($(this).attr('id') === $payPal.attr('id')) { | ||
$('#paypal-methods').removeClass('hidden'); | ||
} else { | ||
$('#paypal-methods').addClass('hidden'); | ||
} | ||
} | ||
}); | ||
|
||
$payPalMethod.on('change', function() { | ||
//$payPalMethod.prop('checked', true); | ||
$($(this).data('content')).removeClass('hidden'); | ||
|
||
$('input:radio').each(function(){ | ||
if ($(this).attr('name') == "thelia_order_payment[paypal_method]" && $(this).prop('checked')) { | ||
hasSelection = true; | ||
$($(this).data('content')).removeClass('hidden'); | ||
} else { | ||
$($(this).data('content')).addClass('hidden'); | ||
} | ||
}); | ||
}); | ||
|
||
$('input:radio').each(function(){ | ||
|
||
if ($(this).attr('name') == "thelia_order_payment[paypal_method]" && $(this).prop('checked')) { | ||
hasSelection = true; | ||
$($(this).data('content')).removeClass('hidden'); | ||
} | ||
}); | ||
|
||
$('.paypal-express-method').on('click', function(){ | ||
$('#paypal-express-checkout button').each(function(){ | ||
$(this).trigger('click'); | ||
}); | ||
}); | ||
|
||
}); | ||
{/literal} | ||
})(jQuery); | ||
</script> |
21 changes: 21 additions & 0 deletions
21
templates/frontOffice/default/paypal/order-invoice-payment-extra.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{form name="thelia.order.payment"} | ||
<div id="paypal-methods" class="row hidden"> | ||
<hr> | ||
{form_field field='paypal_method'} | ||
{foreach from=$choices item=choice} | ||
|
||
{if $choice->label == 'paypal' && {module_config key="method_paypal" module="PayPal" locale="en_US"} == 1} | ||
{include file="paypal/form/extra-paypal.html"} | ||
{/if} | ||
|
||
{if $choice->label == 'credit_card' && {module_config key="method_credit_card" module="PayPal" locale="en_US"} == 1} | ||
{include file="paypal/form/extra-credit-card.html"} | ||
{/if} | ||
|
||
{if $choice->label == 'planified_payment' && {module_config key="method_planified_payment" module="PayPal" locale="en_US"} == 1} | ||
{include file="paypal/form/extra-planified-payment.html"} | ||
{/if} | ||
{/foreach} | ||
{/form_field} | ||
</div> | ||
{/form} |
6 changes: 6 additions & 0 deletions
6
templates/frontOffice/default/paypal/order-placed-additional-payment-info.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{loop type="paypal_order" name="paypal_order" id=$placed_order_id limit=1} | ||
{if $paypal_order->getPlanifiedCycle() > 0} | ||
<strong>{intl l="Planified payment" d="paypal.fo.default"}</strong> : | ||
{intl l="Payment in %x times every %frequency_interval %frequency" x=$paypal_order->getPlanifiedCycle() frequency_interval=$paypal_order->getPlanifiedFrequencyInterval() frequency="{intl l=$paypal_order->getPlanifiedFrequency() d="paypal.fo.default"}" d="paypal.fo.default"} | ||
{/if} | ||
{/loop} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters