Skip to content

Commit

Permalink
Merge pull request #801 from kprajapatii/master
Browse files Browse the repository at this point in the history
Add maxlength validation to CCV input - CHANGED
  • Loading branch information
kprajapatii authored Oct 2, 2024
2 parents 268e9ae + 42767da commit 99cd67e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
24 changes: 3 additions & 21 deletions includes/gateways/class-getpaid-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function __construct() {
// Gateway settings.
add_filter( "wpinv_gateway_settings_{$this->id}", array( $this, 'admin_settings' ) );

// Gateway checkout fiellds.
// Gateway checkout fields.
add_action( "wpinv_{$this->id}_cc_form", array( $this, 'payment_fields' ), 10, 2 );

// Process payment.
Expand Down Expand Up @@ -347,7 +347,7 @@ public function filter_transaction_url( $transaction_url, $invoice ) {
* Get a link to the subscription on the 3rd party gateway site (if applicable).
*
* @param string $subscription_url transaction url.
* @param WPInv_Subscription $subscription Subscription objectt.
* @param WPInv_Subscription $subscription Subscription object.
* @return string subscription URL, or empty string.
*/
public function generate_subscription_url( $subscription_url, $subscription ) {
Expand Down Expand Up @@ -501,13 +501,9 @@ public function get_cc_form( $save = false ) {

?>
<div class="<?php echo esc_attr( $this->id ); ?>-cc-form getpaid-cc-form mt-1">


<div class="getpaid-cc-card-inner">
<div class="row">

<div class="col-12">

<div class="form-group mb-3">
<label for="<?php echo esc_attr( "$id_prefix-cc-number" ); ?>"><?php esc_html_e( 'Card number', 'invoicing' ); ?></label>
<div class="input-group input-group-sm">
Expand All @@ -525,44 +521,34 @@ public function get_cc_form( $save = false ) {
<input type="text" name="<?php echo esc_attr( $this->id . '[cc_number]' ); ?>" id="<?php echo esc_attr( "$id_prefix-cc-number" ); ?>" class="form-control form-control-sm getpaid-format-card-number" autocomplete="cc-number">
</div>
</div>

</div>

<div class="col-12">
<div class="form-group mb-3">
<label><?php esc_html_e( 'Expiration', 'invoicing' ); ?></label>
<div class="form-row row">

<div class="col">
<select class="form-control form-control-sm" autocomplete="cc-exp-month" name="<?php echo esc_attr( $this->id ); ?>[cc_expire_month]">
<option disabled selected="selected"><?php esc_html_e( 'MM', 'invoicing' ); ?></option>

<?php
foreach ( $months as $key => $month ) {
echo "<option value='" . esc_attr( $key ) . "'>" . esc_html( $month ) . '</option>';
}
?>

</select>
</div>

<div class="col">
<select class="form-control form-control-sm" autocomplete="cc-exp-year" name="<?php echo esc_attr( $this->id ); ?>[cc_expire_year]">
<option disabled selected="selected"><?php esc_html_e( 'YY', 'invoicing' ); ?></option>

<?php
foreach ( $years as $key => $year ) {
echo "<option value='" . esc_attr( $key ) . "'>" . esc_html( $year ) . '</option>';
}
?>

</select>
</div>

</div>
</div>
</div>

<div class="col-12">
<?php
aui()->input(
Expand All @@ -574,24 +560,20 @@ public function get_cc_form( $save = false ) {
'class' => 'form-control-sm',
'extra_attributes' => array(
'autocomplete' => 'cc-csc',
'maxlength' => 4
),
),
true
);
?>
</div>

</div>

<?php

if ( $save ) {
$this->save_payment_method_checkbox();
}

?>
</div>

</div>
<?php

Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ Automatic updates should work seamlessly. To avoid unforeseen problems, we alway

== Changelog ==

= 2.8.15 - TBD =
* Add maxlength validation to CCV input - CHANGED

= 2.8.14 - 2024-09-26 =
* wpinv_get_pages() using prepare when not needed causes PHP notice - FIXED

Expand Down

0 comments on commit 99cd67e

Please sign in to comment.