If things are pretty much guaranteed to happen in a few second window
(you may want to ask them of average response time), you might want to
make something like the pseudocode below:

PendingTransaction.cfc
{
 _uniqueID= createUUID();
 _data: struct
 _response : ""; // simplevalue
 function init(struct d){ this._data=d;}
function  getData(){ return _data}
function  getUniqueID(){ return _uniqueID; }
 function setResponse(struct data){ _response=data;}
 function isComplete( return not isSimplevalue(_response);}
 function getResponse(){ return _response;}
 
}

PendingTransactionManager.cfc
{
        _allTxns=structnew();
        function createTransaction(Struct data){
            t=new PendingTransaction().init(data);
            _allTxns[t.getUniqueID()]=t;
          return t;
        }  

      function updateTransaction(id, struct data){
                _allTxns[id].setResponse(data);
            // do some DB operation
        }

      function processTransaction(PendingTransaction t){
          // add data to DB
            // do payment stuff
            while(NOT t.iscomplete()){
                sleep (100 milliseconds);
                }
            return t;
      }
}

----

Then in your code you set up Application.TxnManager=new
PendingTransactionManager();

Success.cfm:
application.txnManager.updateTransaction(form.someID,form);
Error.cfm:  application.txnManager.updateTransaction(form.someID,form);
Whatever.cfm:
application.txnManager.updateTransaction(form.someID,form);

And in your act_pay.cfm you do this...

<cfscript>
Txn=Application.TxnManager.createTransaction(form);
// this blocks until you get the response
Application.TxnManager.processTransaction(txn);

Use info from txn.getResponse()
</cfscript>

-----Original Message-----
From: Michael Traher [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 28, 2006 11:30 AM
To: CF-Talk
Subject: Re: how do I reunite 2 separate requests

Thanks Russ,

Yes I guess getting the callback page to write to the database, and then
the original request read and wait for that database value is a way to
solve this. And yes we do pass a unique transaction reference to
identify the value - its just a bit clunky compared to it all being in
one request which is how our other PSP, 'datacash' (who I highly
recommend BTW) handle things.



On 12/28/06, Snake <[EMAIL PROTECTED]> wrote:
>
> This is a pretty standard callback method, most systems will use it.
> When you sent the request, you should have the option of sending a 
> custom value, such as your own generated transaction or invoiceID. If 
> not then you could always send the CFID and CFTOKEN.
> This is what you need to use on the callback page to process the 
> returned data and validate the transaction.
>
> So if your orginal request page needs to wait for approval and then do

> something, you could simply check the database for the data saved by 
> your callback page and then you will know if it failed or was
successful.
>
> Russ
>
>
> -----Original Message-----
> From: Michael Traher [mailto:[EMAIL PROTECTED]
> Sent: 28 December 2006 15:45
> To: CF-Talk
> Subject: how do I reunite 2 separate requests
>
> Need a bit help - my poor ol' brain is struggling with how best to 
> impelment this...
>
> I am just starting to integrate this payment service provider into our

> system to handle credit card payments for our customers in the Asia 
> Pacific region.
>
> I already use a PSP here in the UK and I have a cfc which nicely 
> implements the process - I feed in credit card, expiry date, amount 
> currency etc etc and after an cfhttp call the cfhttp.filecontent 
> contains the response as an XML packet... nice.
>
> For paydollar the implementation is slight different - I still do an 
> cfhttp call but then I have to declare a URL to 'receive the results 
> in realtime'
> and in addition declare 3 separate pages to display in case of error, 
> decline or success. So paydollar in effect spawn a separate request to

> pass me the results and all I get back in the cfhttp.filecontent is 
> one of the three pages I nominated.
>
> So I know broadly if it has been authorised, declined or some error - 
> but the details are in another request!
>
> Any ideas on the best way to tie the requests together again? Can the 
> results page know about the correct CF session scope?
>
> The nominated 'results URL' is not dynamic with each request by the 
> way - just declared to them once. When it is run however it has access

> to the transactio details in the form scope.
>
> I really want to abstract the whole credit card payment so that it 
> will pass to the appropriate PSP behind the scenes and pass back a 
> standard response and codes.
>
> confused of UK
>
> --
> Mike T
> Blog http://www.socialpoints.com/
>
>
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265213
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to