Example #1
0
  bool credit( void )
  {
    bool bret = false;
    m_result = "CREDIT REVERSAL - ";
    // only if Id
    if( Id && Patron_Payment_Service_Id ) 
    {
      if( Order_Status_Id == os_shipped || Order_Status_Id ==os_recieved ) 
      {
        Patron_Payment_Service pps;
        pps.key(Patron_Payment_Service_Id);
        if( pps.get_data() ) 
        {
          Payment_Service ps;
          ps.key(pps.Payment_Service_Id);
          if( ps.get_data() && ps.getPaymentServiceParameters()  )
          {
            ocTCLink tcLink;

            // Get Param_Types pt_all and pt_reverse
            pushParams( tcLink, ps, pps, pt_reverse );  

            // send it
            if( tcLink.Send().IsGood() )     
            {
              m_result += "Successful";
              Order_Status_Id = os_cancelled;
              bret = true;
            }
            else
            {
              m_result += "Payment Transaction Failed: ";
              m_result +=tcLink.TransactionInfo();
            }
          }      
        }  
      }
      else
      {
        m_result += "No Payment Transaction reversal until payment is made!";
      }
      // re-increment product stock   
      // incrementStock();
    }
    return bret;
  }
Example #2
0
 bool postauth( void )
 {
   bool bret = false;
   m_result = "POST-AUTHORIZATION - ";
   // only if Id
   if( Id && Patron_Payment_Service_Id )
   { 
     Patron_Payment_Service pps;
     pps.key(Patron_Payment_Service_Id);
     if( pps.get_data() ) 
     {
       Payment_Service ps;
       ps.key(pps.Payment_Service_Id);
       if( ps.get_data() && ps.getPaymentServiceParameters()  )
       {
         ocTCLink tcLink;
         
         // Get Param_Types pt_all and pt_postauthorize
         pushParams( tcLink, ps, pps, pt_postauthorize );  
         
         // send it
         if( tcLink.Send().IsGood() )     
         {
           m_result += "Successful";
           bret = true;
         }
         else
         {
           m_result += "Payment Transaction Failed: ";
           m_result +=tcLink.TransactionInfo();
         }
       }      
     }      
   }
   return bret;
 }
Example #3
0
code *cdsetjmp(elem *e,regm_t *pretregs)
{   code cs;
    code *c;
    regm_t retregs;
    unsigned stackpushsave;
    unsigned flag;

    c = NULL;
    stackpushsave = stackpush;
#if SCPP
    if (CPP && (funcsym_p->Sfunc->Fflags3 & Fcppeh || usednteh & NTEHcpp))
    {
        /*  If in C++ try block
            If the frame that is calling setjmp has a try,catch block then
            the call to setjmp3 is as follows:
              __setjmp3(environment,3,__cpp_longjmp_unwind,trylevel,funcdata);

            __cpp_longjmp_unwind is a routine in the RTL. This is a
            stdcall routine that will deal with unwinding for CPP Frames.
            trylevel is the value that gets incremented at each catch,
            constructor invocation.
            funcdata is the same value that you put into EAX prior to
            cppframehandler getting called.
         */
        symbol *s;

        s = except_gensym();
        if (!s)
            goto L1;

        c = gencs(c,0x68,0,FLextern,s);                 // PUSH &scope_table
        stackpush += 4;
        genadjesp(c,4);

        c = genc1(c,0xFF,modregrm(1,6,BP),FLconst,(targ_uns)-4);
        // PUSH trylevel
        stackpush += 4;
        genadjesp(c,4);

        cs.Iop = 0x68;
        cs.Iflags = CFoff;
        cs.Irex = 0;
        cs.IFL2 = FLextern;
        cs.IEVsym2 = getRtlsym(RTLSYM_CPP_LONGJMP);
        cs.IEVoffset2 = 0;
        c = gen(c,&cs);                         // PUSH &_cpp_longjmp_unwind
        stackpush += 4;
        genadjesp(c,4);

        flag = 3;
    }
    else
#endif
        if (funcsym_p->Sfunc->Fflags3 & Fnteh)
        {
            /*  If in NT SEH try block
                If the frame that is calling setjmp has a try, except block
                then the call to setjmp3 is as follows:
                  __setjmp3(environment,2,__seh_longjmp_unwind,trylevel);
                __seth_longjmp_unwind is supplied by the RTL and is a stdcall
                function. It is the name that MSOFT uses, we should
                probably use the same one.
                trylevel is the value that you increment at each try and
                decrement at the close of the try.  This corresponds to the
                index field of the ehrec.
             */
            int sindex_off;

            sindex_off = 20;                // offset of __context.sindex
            cs.Iop = 0xFF;
            cs.Irm = modregrm(2,6,BPRM);
            cs.Iflags = 0;
            cs.Irex = 0;
            cs.IFL1 = FLbprel;
            cs.IEVsym1 = nteh_contextsym();
            cs.IEVoffset1 = sindex_off;
            c = gen(c,&cs);                 // PUSH scope_index
            stackpush += 4;
            genadjesp(c,4);

            cs.Iop = 0x68;
            cs.Iflags = CFoff;
            cs.Irex = 0;
            cs.IFL2 = FLextern;
            cs.IEVsym2 = getRtlsym(RTLSYM_LONGJMP);
            cs.IEVoffset2 = 0;
            c = gen(c,&cs);                 // PUSH &_seh_longjmp_unwind
            stackpush += 4;
            genadjesp(c,4);

            flag = 2;
        }
        else
        {
            /*  If the frame calling setjmp has neither a try..except, nor a
                try..catch, then call setjmp3 as follows:
                _setjmp3(environment,0)
             */
L1:
            flag = 0;
        }

    cs.Iop = 0x68;
    cs.Iflags = 0;
    cs.Irex = 0;
    cs.IFL2 = FLconst;
    cs.IEV2.Vint = flag;
    c = gen(c,&cs);                     // PUSH flag
    stackpush += 4;
    genadjesp(c,4);

    c = cat(c,pushParams(e->E1,REGSIZE));

    c = cat(c,getregs(~getRtlsym(RTLSYM_SETJMP3)->Sregsaved & (ALLREGS | mES)));
    gencs(c,0xE8,0,FLfunc,getRtlsym(RTLSYM_SETJMP3));      // CALL __setjmp3

    c = cod3_stackadj(c, -(stackpush - stackpushsave));
    genadjesp(c,-(stackpush - stackpushsave));

    stackpush = stackpushsave;
    retregs = regmask(e->Ety, TYnfunc);
    return cat(c,fixresult(e,retregs,pretregs));
}
Example #4
0
  bool preauth( long long Payment_Service_Id )
  {
    bool bret = false;

    setShipping();
    setTax();    

    Payment_Service ps;
    ps.key(Payment_Service_Id);

    if( ps.get_data() && ps.getPaymentServiceParameters()  )
    {
      Patron_Payment_Service pps;      
      ocString where = "Patron_Id = ";
      where.append(Patron_Id);
      where += " and Payment_Service_Id = ";
      where.append(Payment_Service_Id);

      if( pps.get_data(where) && pps.getParameters() )
      {
      
        Patron_Payment_Service_Id = pps.Id;
        ocTCLink tcLink;
        
        // Get Param_Types pt_all and pt_preauthorize
        pushParams( tcLink, ps, pps, pt_preauthorize );        
        
        // get the user payment setup
        size_t pos2;
        for( pos2=0; pos2<pps.params.size();++pos2)
        {
          tcLink.PushParam(pps.params[pos2].Machine_Name,pps.params[pos2].Value);
        } 
        // now finalize
        if( tcLink.Send().IsGood() )     
        {
          // get the transaction id and save the order
          Transactions_Id = tcLink.TransactionId();
          bret = db_insert();
          Id = key();
          if( bret )  
          {
            bret = saveOrderedItems();            
            // decrement product stock   
            decrementStock();
          }  
        }
        else
        {
          m_result += "Payment Transaction Failed: ";
          m_result +=tcLink.TransactionInfo();
        }
      }
      else
      {
        m_result += "patron payment setup failed: ";
        m_result += pps.last_result();
      }
    }
    else
    {
      m_result += "payment setup load failed: ";
      m_result +=  ps.last_result();
    }
    return bret; 
  }