[jboss-user] [JBoss Seam] - credit card transactions with Seam
matt.drees
do-not-reply at jboss.com
Mon Sep 10 22:16:38 EDT 2007
I need to implement credit card transactions using authorize.net. I wanted to ask if anyone had feedback on the approach I'm planning to use, because I'm a relatively young developer and this is a pretty important thing to get right, and there are many smart and experienced people here.
I would have an action method (in a conversation-scoped bean) that looks something like this:
| public void processPayment() {
| //execute an AUTH_ONLY request, which checks funds availability etc, but doesn't transfer funds, and returns an authcode
| if (successful) {
| //create payment record (with authcode) and persist to DB. Store transaction id locally for capture step.
| raiseTransactionSuccessEvent("creditCardSuccess");
| } else {
| //prompt user for corrected info or show error screen as appropriate
| }
| }
|
| @Observer("creditCardSuccess")
| public void capturePayment() {
| //execute a PRIOR_AUTH_CAPTURE request, which does the transfer, using the stored transaction id
| if (successful) {
| //don't do much except log a success
| } else {
| //email the admin notifying him/her of failure. Admin would probably need to manually trigger a capture.
| }
| }
|
The idea is I don't want to charge the user unless I know I have a record of their payment, so I wait until the transaction completes successfully.
I've not done too much with transaction-aware code, but I think I'm using it correctly. Does this seem reasonable? Thanks for your time.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082816#4082816
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082816
More information about the jboss-user
mailing list