CVS edit link for whoastdev

We are a web development and SEM company based in Chicago. We plan to contribute modules that we developed for clients (i.e.. Chicago Lighthouse, BluePay..), for example we recently developed a Webform and BluePay Payment Integration Module. A module that enables a site administrator to allow payments through a Webform submission using the BluePay Payment Api Gateway. The module does require PHP to be built with CURL enabled in order to use BluePay Post interface.

Module Files available upon request.

CommentFileSizeAuthor
#11 bluepaywebform.zip14.63 KBsndev
#1 bluepaywebform.zip14.63 KBsndev

Comments

sndev’s picture

StatusFileSize
new14.63 KB
AjK’s picture

Status: Postponed (maintainer needs more info) » Needs review
AjK’s picture

Status: Needs review » Needs work

The SQL backticks table field names (e.g. `vid`). I maybe wrong but I'm pretty sure that's MySQL centric and the SQL will fail for postgress users.

The static string feild names should use t(). For example:

    // Transaction Info
    'x_amount' => t('Amount'),
sndev’s picture

Status: Needs work » Postponed (maintainer needs more info)

Hi Ajk, it's an api implementation: these mapped webform fields below are restricted to the BluePay API fields.

/**
 * Provide the required fields for BluePay processing
 * 
 * @return array
 *  Provide an array containing the fields that are required by BluePay
 */
function bluepaywebform_available_fields() {
  return array(  
    //Special Field to block Processing
    0 => '--Do Not Map to an BluePay field--',

    // Transaction Info
    'x_amount' => 'Amount',
    'x_payment_account' => 'Card Number',
    'x_card_cvv2' => 'Card Security Code',
    'x_memo' => 'Transaction Description',
    'x_card_expire' => 'Expiration Date (Digits Only)',
    'x_trans_id' => 'Transaction ID (Must be Mapped - Hidden Field)',
    
    //Cardholder Info
    'x_name1' => 'First Name',
    'x_name2' => 'Last Name',
    'x_addr1' => 'Address',
    'x_city' => 'City',
    'x_state' => 'State',
    'x_zip' => 'Zip',
    'x_email' => 'Email',
  );
}
sndev’s picture

Essentially these fields will not be inserted to the database with their naming API conventions of x_ but instead will be written to the database through the webform hook, with the database field names being reflecting webform conventions (nid,sid,cid,no,data).

SQL insertion done by this module I think are standards compliant. Code below:


/**
 * Implementation of hook_nodeapi()
 *
 * Intercept operations on the webform node to assure that the BluePay fields are tracked.
 */
function bluepaywebform_nodeapi(&$node, $op, $form = NULL, $page = NULL) {  
  if ( $node->type == 'webform') {

    switch ($op) {
      case 'insert':
      case 'update':
        if ( isset($node->use_bluepay) ) {
          // store the BluePay fields
          $result = db_query("DELETE FROM {bluepaywebform} where `vid` = %d", $node->vid);
          $result = db_query("INSERT INTO {bluepaywebform} (`vid`, `use`) " .
                              "VALUES (%d, %d)", $node->vid, $node->use_bluepay);
        }
        break;
      case 'validate':

        break;  
      case 'load':
        $result = db_query("SELECT `use` from {bluepaywebform} ".
                            "WHERE `vid` = %d", $node->vid); 
        // either $result has 0 or 1 rows, if we have one then add it to the node
        $row = db_fetch_array($result);

        if ( $row['use'] == '1' ) {
          $node->use_bluepay = TRUE;
        }
        else {
          $node->use_bluepay = FALSE;
        }
        break;
    }
  }
}
sndev’s picture

Status: Postponed (maintainer needs more info) » Needs review
AjK’s picture

Status: Needs review » Needs work

Are you telling me that quoting the field names with backticks will work ok on Postgres?

sndev’s picture

Status: Needs work » Needs review

Hi AjK, you may have misunderstood me and the code. Like I said in comment #4 and #5 these fields will not be inserted to the database as is, after some processing these fields will be posted to BluePay API.

And also these fields will be re-processed and inserted to the database with some processing done by the webform module (its a different module which this module is dependent upon) but that's a different scope handled by the webform module.

But to answer your question if the webform module is postgres compatible then --yes, it really depends on the webform module.

AjK’s picture

Status: Needs review » Needs work

You not understanding me. This code:-

    $result = db_query("DELETE FROM {bluepaywebform} where `vid` = %d", $node->vid);

Will it work on Postgres? I'm referring to `vid` above. Quoting the field name with backtick quotes is MySQL centric. Regardless of what $node->vid is here, I believe on Postgres this SQL query will fail. What I am asking is "are these backticks around the table field name ok with Postgres?" I don't think they are but I may be wrong.

AjK’s picture

More info:-

http://wiki.postgresql.org/wiki/Things_to_find_out_about_when_moving_fro...

  • MySQL uses ` (accent mark or backtick) to quote system identifiers, which is decidedly non-standard.
sndev’s picture

Status: Needs work » Needs review
StatusFileSize
new14.63 KB

Hey AjK,

I was thrown off with your comment #3 I thought you were pointing to those fields with that particular concern. But I got you now the attached file contains the corrected module files per your concern.

AjK’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

Component: Miscellaneous » new project application
Issue summary: View changes
Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.