Ejegg has uploaded a new change for review.
https://gerrit.wikimedia.org/r/225349
Change subject: WIP Check CPF is numeric when exists, require for AstroPay
......................................................................
WIP Check CPF is numeric when exists, require for AstroPay
This should make sure it's a valid format when it's given,
and require it for AstroPay. Doesn't cover some edge cases,
like decimals and zero.
TODO: only good for Brazil. Figure out real validation formats
Bug: T106171
Change-Id: If4640367b84edcb8cfb3900c0ca79ede7450b03d
---
M astropay_gateway/astropay.adapter.php
M gateway_common/DataValidator.php
M gateway_common/gateway.adapter.php
3 files changed, 8 insertions(+), 0 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface
refs/changes/49/225349/1
diff --git a/astropay_gateway/astropay.adapter.php
b/astropay_gateway/astropay.adapter.php
index 9d19f15..0b98998 100644
--- a/astropay_gateway/astropay.adapter.php
+++ b/astropay_gateway/astropay.adapter.php
@@ -245,6 +245,7 @@
'validation' => array(
'name' => true,
'email' => true,
+ 'fiscal_number' => true,
),
);
@@ -252,6 +253,7 @@
'validation' => array(
'name' => true,
'email' => true,
+ 'fiscal_number' => true,
),
);
diff --git a/gateway_common/DataValidator.php b/gateway_common/DataValidator.php
index 7c4e396..6161b0a 100644
--- a/gateway_common/DataValidator.php
+++ b/gateway_common/DataValidator.php
@@ -35,6 +35,7 @@
case 'card_num':
case 'card_type':
case 'cvv':
+ case 'fiscal_number':
case 'fname':
case 'lname':
case 'city':
@@ -66,6 +67,7 @@
'card_num' => '',
'card_type' => '',
'cvv' => '',
+ 'fiscal_number' => '',
'fname' => '',
'lname' => '',
'city' => '',
@@ -224,6 +226,7 @@
'anonymous' => 'validate_boolean',
'contribution_tracking_id' =>
'validate_numeric',
'currency_code' => 'validate_alphanumeric',
+ 'fiscal_number' => 'validate_numeric', //
technically, should be a natural number
'gateway' => 'validate_alphanumeric',
'numAttempt' => 'validate_numeric',
'optout' => 'validate_boolean',
diff --git a/gateway_common/gateway.adapter.php
b/gateway_common/gateway.adapter.php
index 6f56b68..d81ffa9 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -2720,6 +2720,9 @@
'lname'
);
break;
+ case 'fiscal_number' :
+ $check_not_empty = array(
'fiscal_number' );
+ break;
default:
$this->logger->error( "bad required
group name: {$type}" );
continue;
--
To view, visit https://gerrit.wikimedia.org/r/225349
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If4640367b84edcb8cfb3900c0ca79ede7450b03d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits