mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-28 19:41:33 +02:00
only validate credit card an cvv if there is data in them
This commit is contained in:
@@ -69,8 +69,8 @@ block content
|
||||
.row
|
||||
.col-md-12
|
||||
.form-group
|
||||
div(ng-hide="validation.correctCvv") #{translate("invalid")} CVV
|
||||
div(ng-hide="validation.correctCardNumber") #{translate("invalid")} #{translate("credit_card_number")}
|
||||
div.alert.alert-warning.small(ng-hide="validation.correctCvv") #{translate("invalid")} CVV
|
||||
div.alert.alert-warning.small(ng-hide="validation.correctCardNumber") #{translate("invalid")} #{translate("credit_card_number")}
|
||||
.row
|
||||
.col-md-6
|
||||
.form-group(ng-class="validation.correctCardNumber ? '' : 'has-error' ")
|
||||
@@ -80,7 +80,7 @@ block content
|
||||
input.form-control(ng-model='data.cvv', ng-blur="validateCvv()", placeholder="CVV")
|
||||
.row
|
||||
.col-md-12
|
||||
div(ng-hide="validation.correctExpiry") #{translate("invalid")} #{translate("expiry")}
|
||||
div.alert.alert-warning.small(ng-hide="validation.correctExpiry") #{translate("invalid")} #{translate("expiry")}
|
||||
.col-md-2
|
||||
.form-group(ng-class="validation.correctExpiry ? '' : 'has-error' ")
|
||||
select(data-recurly='month', ng-change="validateExpiry()", ng-model='data.month')
|
||||
|
||||
@@ -15,10 +15,10 @@ define [
|
||||
$scope.paymentMethod = "credit_card"
|
||||
|
||||
$scope.data =
|
||||
number: ""
|
||||
number: undefined
|
||||
month: undefined
|
||||
year: undefined
|
||||
cvv: ""
|
||||
cvv: undefined
|
||||
first_name: ""
|
||||
last_name: ""
|
||||
postal_code: ""
|
||||
@@ -57,14 +57,16 @@ define [
|
||||
pricing.currency(newCurrency).done()
|
||||
|
||||
$scope.validateCardNumber = ->
|
||||
$scope.validation.correctCardNumber = recurly.validate.cardNumber($scope.data.number)
|
||||
if $scope.data.number?
|
||||
$scope.validation.correctCardNumber = recurly.validate.cardNumber($scope.data.number)
|
||||
|
||||
$scope.validateExpiry = ->
|
||||
if $scope.data.month? and $scope.data.year?
|
||||
$scope.validation.correctExpiry = recurly.validate.expiry($scope.data.month, $scope.data.year)
|
||||
|
||||
$scope.validateCvv = ->
|
||||
$scope.validation.correctCvv = recurly.validate.cvv($scope.data.cvv)
|
||||
if $scope.data.cvv?
|
||||
$scope.validation.correctCvv = recurly.validate.cvv($scope.data.cvv)
|
||||
|
||||
$scope.changePaymentMethod = (paymentMethod)->
|
||||
if paymentMethod == "paypal"
|
||||
|
||||
Reference in New Issue
Block a user