Hi all,
Since I'm only now starting with service contracts, I've decided to
submit my thoughts to the community to make sure I'm looking at this
right, and also to try to solve some questions.
So I'm writing a service contract for a Paypal payment gateway (along
with its implementation). The way I need to do this, the customer will
be given the choice, at checkout time, as to what payment method s/he
wants to use (s/he will be presented with a list of available
payments, registered through the appropriate service contracts in the
ecommerce package). That choice will be saved for future purchases, if
the user so desires.
To give a little background, what needs to happen for Paypal
authorization to happen is this:
- Send customer paypal acct, merchant paypal acct, shopping cart
items (with prices), a URL that Paypal will POST back to. All this via
POST to a Paypal https URL.
- Customer will then be on Paypal's shopping cart pages, looking at
the items, just like on your site.
- Customer will go through Paypal's checkout foo, and after payment
is completed, Paypal will POST back to our site to the notify_url
passed earlier. In the POST will come an encrypted string that we need
to POST back to Paypal.
- We POST back to Paypal everything that it sent, including the
encrypted string. Paypal then responds with a payment_status variable.
I'm new to service contracts (so please feel free to pitch in), but
this is what I'm envisioning the following for the service contract
(Neophytos, are you reading this? 😊):
Operation: Charge
Input takes:
response_code:string,reason:string,paypal_transaction_id:string
Output returns:
response_code:string,reason:string,paypal_transaction_id:string
Operation: Refund
Input and Output similar to Charge.
My questions are the following:
Should I pass a Tcl array (err, hash) with all the shopping cart
items or just let the appropriate implementation function grab that
off the DB? If I should pass the array, do I just specify
"cart_items:array" in the acs_sc_msg_type_new declaration?
In this case, where the "Charge" operation will take multiple steps
and will not immediately return a value, do I need to do something
special with respect to the service contract or its implementation?
Anything obvious that I'm missing? Suggestions/criticism
appreciated. Obviously, all of this will go back to the OpenACS tree.