[ic] Paypal Code!!

Bryan D Gmyrek gmyrek at U.Arizona.EDU
Fri May 14 03:08:42 EDT 2004


Original post from Scott Kennedy:
http://www.icdevgroup.org/pipermail/interchange-users/2002-May/021173.html

>I have developed some code to handle paying by PayPal that I would like
>to share with you all.  This code is used on the receipt web page found
>in "etc" in your catalog's subdirectory.  I hope that you all find this
>code to be useful.  I've spent quite a bit of time developing this and
>debugging everything.  I tried to send it to the list a few days ago
>but I was unable to because the listserver refused to post the message.
>I guess it didn't like the attachment.  Are attachments not allowed on
>this list or did I send it in an incorrect manner?  Anyway, you can
>download it at here,
...
>By the way, how would I specify PayPal as a "standard" payment method?

Scott,

Thanks for this code, it works great!  As for getting paypal as an
'official' option on the checkout page (maybe you have done that already)
here is some advice.
Basically the thing to do is to go into your catalog *and* your main
interchange directory and grepping for POSTAL.  Then copy what is done for
that but for PayPal instead.  Here is a summary of what I mean:

$cd /opt/catalogs/store

$grep POSTAL include/* -r
include/checkout/payment_select:[if variable POSTAL_ACCEPTED]
(( also look in  include/meta/mv_metadata.asc for
POSTAL ... grep output gets blarged by strange chars ))

$grep POSTAL etc/* -r
etc/profiles.order:&set = prof_mode_accepted [var POSTAL_ACCEPTED]

$grep POSTAL products/variable.txt
POSTAL_ACCEPTED 1       Payment



$cd /opt/interchange

 $grep POSTAL foundation/* -r

foundation/config/additional_fields:!PAYPOSTAL
(actually, I ignored the above one)

foundation/etc/profiles.order:&set = prof_mode_accepted [var POSTAL_ACCEPTED]
foundation/include/checkout/payment_select: [if variable POSTAL_ACCEPTED]

(( again might want to open with vi or whatever the following and inspect
manually:
./lib/UI/pages/include/meta/mv_metadata.asc
./foundation/products/mv_metadata.asc
))

$grep POSTAL lib/* -r

lib/UI/pages/admin/entry.html: [if variable POSTAL_ACCEPTED]

lib/UI/pages/admin/payment.html: $Scratch->{POSTAL_ACCEPTED} = $CGI->{postal};

lib/UI/pages/admin/payment.html:[loop list="CREDIT_CARDS_ACCEPTED PO_ACCEPTED COD_ACCEPTED CHECK_ACCEPTED POSTAL_ACCEPTED PAYPAL_ACCEPTED
PHONE_ACCEPTED"]

lib/UI/pages/admin/payment.html:
for (qw/PO_ACCEPTED COD_ACCEPTED CHECK_ACCEPTED POSTAL_ACCEPTED PAYPAL_ACCEPTED PHONE_ACCEPTED/) {

lib/UI/pages/admin/payment.html:<option value="1" [if scratch POSTAL_ACCEPTED]SELECTED[/if]> [L]Accepted[/L]

lib/UI/pages/admin/payment.html:[loop list="CREDIT_CARDS_ACCEPTED PO_ACCEPTED COD_ACCEPTED CHECK_ACCEPTED POSTAL_ACCEPTED PAYPAL_ACCEPTED
PHONE_ACCPETED"]

lib/UI/pages/include/meta/mv_metadata.asc:variable::Variable::POSTAL_ACCEPTED   select                                                  =No1=Yes          Accept postal orders?


So open each of these files and copy what is done for the
POSTAL payment method.

As you can see, I've already added paypal as a method
to some of those lists.  However, beware that for some
files, such as profiles.order, you must replicate a lot
of code ...  For example in profiles.order copy all of
 the POSTAL stuff between __NEW__ and __END__ and alter
it to be paypal specific (change mail_order to paypal...)

Your catalog setup may vary but the idea is the same.

Hope this helps.

Bryan



More information about the interchange-users mailing list