Merge pull request #853 from joshuadwire/payments-changes

Payments bug fixes
This commit is contained in:
Hillel Coren 2016-05-11 18:42:16 +03:00
commit 0f47cbef51
3 changed files with 6 additions and 9 deletions

View File

@ -558,14 +558,8 @@ class PaymentService extends BaseService
if (!empty($paymentDetails['card'])) { if (!empty($paymentDetails['card'])) {
$card = $paymentDetails['card']; $card = $paymentDetails['card'];
$payment->last4 = substr($card->number, -4); $payment->last4 = $card->getNumberLastFour();
$year = $card->expiryYear; $payment->payment_type_id = $this->detectCardType($card->getNumber());
if (strlen($year) == 2) {
$year = '20' . $year;
}
$payment->expiration = $year . '-' . $card->expiryMonth . '-00';
$payment->payment_type_id = $this->detectCardType($card->number);
} }
if ($accountGateway->gateway_id == GATEWAY_STRIPE) { if ($accountGateway->gateway_id == GATEWAY_STRIPE) {
@ -863,7 +857,7 @@ class PaymentService extends BaseService
function ($model) { function ($model) {
$max_refund = number_format($model->amount - $model->refunded, 2); $max_refund = number_format($model->amount - $model->refunded, 2);
$formatted = Utils::formatMoney($max_refund, $model->currency_id, $model->country_id); $formatted = Utils::formatMoney($max_refund, $model->currency_id, $model->country_id);
$symbol = Utils::getFromCache($model->currency_id, 'currencies')->symbol; $symbol = Utils::getFromCache($model->currency_id ? $model->currency_id : 1, 'currencies')->symbol ;
return "javascript:showRefundModal({$model->public_id}, '{$max_refund}', '{$formatted}', '{$symbol}')"; return "javascript:showRefundModal({$model->public_id}, '{$max_refund}', '{$formatted}', '{$symbol}')";
}, },
function ($model) { function ($model) {

View File

@ -488,6 +488,7 @@
<input type="hidden" name="payment_method_nonce" value="{{$sourceId}}"> <input type="hidden" name="payment_method_nonce" value="{{$sourceId}}">
<input type="hidden" name="first_name" value="{{$paypalDetails->firstName}}"> <input type="hidden" name="first_name" value="{{$paypalDetails->firstName}}">
<input type="hidden" name="last_name" value="{{$paypalDetails->lastName}}"> <input type="hidden" name="last_name" value="{{$paypalDetails->lastName}}">
<input type="hidden" name="email" value="{{$paypalDetails->email}}">
<p>&nbsp;</p> <p>&nbsp;</p>
@if (isset($amount) && $client && $account->showTokenCheckbox()) @if (isset($amount) && $client && $account->showTokenCheckbox())
<input id="token_billing" type="checkbox" name="token_billing" {{ $account->selectTokenCheckbox() ? 'CHECKED' : '' }} value="1" style="margin-left:0px; vertical-align:top"> <input id="token_billing" type="checkbox" name="token_billing" {{ $account->selectTokenCheckbox() ? 'CHECKED' : '' }} value="1" style="margin-left:0px; vertical-align:top">

View File

@ -82,6 +82,7 @@
@endforeach @endforeach
@endif @endif
@if($gateway->gateway_id != GATEWAY_STRIPE || $gateway->getPublishableStripeKey())
<center> <center>
{!! Button::success(strtoupper(trans('texts.add_credit_card'))) {!! Button::success(strtoupper(trans('texts.add_credit_card')))
->asLinkTo(URL::to('/client/paymentmethods/add/'.($gateway->getPaymentType() == PAYMENT_TYPE_STRIPE ? 'stripe_credit_card' : 'credit_card'))) !!} ->asLinkTo(URL::to('/client/paymentmethods/add/'.($gateway->getPaymentType() == PAYMENT_TYPE_STRIPE ? 'stripe_credit_card' : 'credit_card'))) !!}
@ -98,6 +99,7 @@
<div id="paypal-container"></div> <div id="paypal-container"></div>
@endif @endif
</center> </center>
@endif
<div class="modal fade" id="completeVerificationModal" tabindex="-1" role="dialog" aria-labelledby="completeVerificationModalLabel" aria-hidden="true"> <div class="modal fade" id="completeVerificationModal" tabindex="-1" role="dialog" aria-labelledby="completeVerificationModalLabel" aria-hidden="true">
<div class="modal-dialog" style="min-width:150px"> <div class="modal-dialog" style="min-width:150px">