On 16 Feb 2001, at 19:30, Jeremy Howard wrote:
I've searched the web and have looked at the examples provided with the wampum product but cannot find a real world example. Is there anyone out there that is using this product and can offer some help. The only thing I need to know is how one gets the results back after making a call to the processorder method. TIA
"I'm trained to Help you!" (uh, that's what they taught us to say at CPR class)
From the http://www.AdirondackCraft.com website:
Hope this pastes without wrapping. Here are two methods from my Order class. def chargeCard(self,REQUEST,ccash,Rec): """Using the ccash object, charge the card return None or an error message """ rc = None try: results = ccash.processorder(REQUEST,order_id=self.ordernumber, amount='usd '+'%5.2f' % self.totalchargeamount, card_number=Rec.cardnumber, card_exp=Rec.expiremonth+'/'+Rec.expireyear, card_name=self.customername, card_address=self.billingaddress1, card_city=self.billingcity, card_zip=self.billingpostalcode, card_state=self.billingstateprovince, card_country=self.billingcountry) except WampumExceptions.WampumException, e: """record the exception""" self.LogCCError('Cybercash Error:'+str(e)) try: rc = e.MErrMsg except: rc = 'Unexpected Procssing Error, Please call 518-891-6525 for assistance' self.logCCError("Couldn't return MErrMsg to customer!") print "returning result 1",rc self.status = 'Error' self.errormessage = rc self.update() self.db.commit() return rc except Exception, e: self.logCCError("Unexpected python exception"+str(e)) rc = 'Internal Error. Please call 518-891-6525 for assistance' print "returning result 2",rc self.status = 'Error' self.errormessage = rc self.update() self.db.commit() return rc else: rc = None try: self.updateChargeResults(results,Rec) except Exception, e: traceback.print_exc() self.logCCError("Unexpected exception recording successful charge "+str(results)) self.logCCError("The exception is "+str(e)) rc = "Your credit card was charged, but we were unable to properly record the results in our database, Please call 518-891-6525 for assistance" print "returning result 3",rc return rc def updateChargeResults(self,inst,Rec): """Given a cybercash instance, update ourselves""" print "got inst ",str(inst) if getattr(inst,'MStatus','') == 'success': self.status = 'Submitted' else: self.status = 'Error' try: self.cclast4digits = Rec.cardnumber[-4:] self.ccexpiredate = Rec.expiremonth+'/'+'30/'+Rec.expireyear self.authorizationcode = getattr(inst,'auth_code',None) self.actualbookamount= float(string.split(getattr(inst,'paid_amount','0'))[-1]) self.actualbookamounttext = getattr(inst,'paid_amount',None) self.referencecode = getattr(inst,'ref_code',None) self.chargestatus = getattr(inst,'MStatus',None) self.avscode = getattr(inst,'avs_code',None) self.actioncode = getattr(inst,'action_code',None) try: self.errormessage = getattr(inst,'aux_msg',None) self.transactionid = getattr(inst,'cust_txn',None) except: traceback.print_exc() except: traceback.print_exc() self.update() print "commiting charge" self.db.commit() Brad Clements, bkc@murkworks.com (315)268-1000 http://www.murkworks.com (315)268-9812 Fax netmeeting: ils://ils.murkworks.com AOL-IM: BKClements