Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.6.8

Request #1265 Add handler support to typeFieldMap
Submitted: 2004-04-23 04:33 UTC
From: aashley at optimiser dot com Assigned:
Status: Closed Package: Payment_Process
PHP Version: 5.0.0RC1 (Release Candidate 1) OS: All
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 31 - 13 = ?

 
 [2004-04-23 04:33 UTC] aashley at optimiser dot com
Description: ------------ Added handler support to setPayment. The processor I'm building requires the expiry month and year as seperate fields, so I've added the handler code from _process to setPayment() in Common.php patch: --- /usr/share/pear/Payment/Process/Common.php 2004-04-13 15:45:48.000000000 +0800 +++ Common.php 2004-04-21 22:37:25.000000000 +0800 @@ -229,10 +229,25 @@ // Map over the payment specific fiels. Check out // $_typeFieldMap for more information. $paymentType = $payment->getType(); - foreach ($this->_typeFieldMap[$paymentType] as $key => $val) { - if(!isset($this->_data[$val])) { - $this->_data[$val] = $this->_payment->$key; + foreach ($this->_typeFieldMap[$paymentType] as $generic => $specific) { + $func = '_handle'.ucfirst($generic); + if (method_exists($this, $func)) { + //$this->debug("Calling {$func} to handle {$generic}"); + $result = $this->$func(); + if (PEAR::isError($result)) { + return $result; + } + } else { + // TODO This may screw things up - the problem is that + // CC information is no longer member variables, so we + // can't overwrite it. You could always handle this with + // a _handle funciton. I don't think it will cause problems, + // but it could. + if (!isset($this->_data[$specific])) { + $this->_data[$specific] = $this->_payment->$generic; + } } + } return true;

Comments

 [2004-04-28 20:19 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2004-04-30 07:54 UTC] aashley at optimiser dot com
here's the patch again, if this doesnt work give us a yell and ill send it via email. --- Common.orig.php 2004-04-30 16:02:08.905151105 +0800 +++ Common.php 2004-04-21 22:37:25.000000000 +0800 @@ -229,10 +229,25 @@ // Map over the payment specific fiels. Check out // $_typeFieldMap for more information. $paymentType = $payment->getType(); - foreach ($this->_typeFieldMap[$paymentType] as $key => $val) { - if(!isset($this->_data[$val])) { - $this->_data[$val] = $this->_payment->$key; + foreach ($this->_typeFieldMap[$paymentType] as $generic => $specific) { + $func = '_handle'.ucfirst($generic); + if (method_exists($this, $func)) { + //$this->debug("Calling {$func} to handle {$generic}"); + $result = $this->$func(); + if (PEAR::isError($result)) { + return $result; + } + } else { + // TODO This may screw things up - the problem is that + // CC information is no longer member variables, so we + // can't overwrite it. You could always handle this with + // a _handle funciton. I don't think it will cause problems, + // but it could. + if (!isset($this->_data[$specific])) { + $this->_data[$specific] = $this->_payment->$generic; + } } + } return true;
 [2004-04-30 15:47 UTC] joe at joestump dot net
It's still borking - could you email me the patch?
 [2004-06-18 05:09 UTC] aashley at optimiser dot com
I've updated the patch for so it works with Payment Process 0.5.7 Its available at http://frood.cernun.net/stuff/Common.php-handle-support-typeFieldMap.patch I've also made changes to the patch so that in setPayment() the payment object is passed in by reference and linked to the current object by reference, no copying.
 [2004-06-21 21:59 UTC] daviidu at everydns dot net
Can you clarify what (why) you are doing this in your patch: + if(isset($this->_payment->$generic)) + { + $this->_data[$specific] = $this->_payment->$generic; + } What's the order that things should happen with what I pasted above and what is just above that in your patch? -davidu
 [2004-06-22 00:59 UTC] aashley at optimiser dot com
why i was doing? something to do with writing code at 3am :), ive updated the patch with the intended behaviour
 [2004-07-11 22:43 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-07-08 00:24 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!