[ic] Donation: eBay UserTags
Grant
listbox at email.com
Wed Nov 12 15:49:10 EST 2003
Corrections below...
> I'm still working on my IC/eBay integration and it's becoming more and
> dependant on the specifics of my catalog and my particular usage of eBay.
> The good news is the UserTags themselves are working 100%
> perfectly. Here's
> a quick description of each:
>
> ebay_additem.tag:
> It adds an item to eBay based on the parameters it is passed, and sets the
> eBay item ID of the listed item to a scratch variable called
> item_id_response. The entire unparsed XML response from eBay is
> also saved
> in a scratch variable called additem_log.
>
> ebay_relistitem.tag:
> It relists an eBay item based on the parameters it is passed, and sets the
> eBay item ID of the relisted item to a scratch variable called
> item_id_response. The entire unparsed XML response from eBay is
> also saved
> in a scratch variable called relistitem_log.
>
> ebay_relistitem.tag:
> It leaves positive feedback for an eBay member based on the
> parameters it is
> passed, and sets the feedback response from eBay to a scratch variable
> called feedback_status_response. The entire unparsed XML
> response from eBay
> is also saved in a scratch variable called leavefeedback_log.
This tag is called "leavefeedback.tag".
[snip]
> Usertag ebay_additem Order applicationdata category description duration
> gallery galleryurl price quantity storecategory subtitletext title type
> Usertag ebay_additem Routine <<EOR
> use HTTP::Request::Common;
> use LWP::UserAgent;
> use XML::Simple;
> $XML::Simple::PREFERRED_PARSER = 'XML::Parser';
> sub {
> my ($applicationdata,$category,$description,$duration,$gallery,
> $galleryurl,$price,$quantity,$storecategory,$subtitletext,$title,$type) =
> @_;
> my $user_agent = new LWP::UserAgent(
> timeout => 30,
> agent => 'ebay_additem',
> );
> $title =~ s:"":":g;
> my $requestuserid = tag_data('ebay_variable', 'value', 'user_id');
> my $requestpassword = tag_data('ebay_variable', 'value',
> 'password');
> my $dev_token = tag_data('ebay_variable', 'value', 'dev_token');
> my $app_token = tag_data('ebay_variable', 'value', 'app_token');
> my $cert_token = tag_data('ebay_variable', 'value', 'cert_token');
> my $content = "<?xml version='1.0'
> encoding='iso-8859-1'?><request><RequestUserId>$requestuserid</Req
> uestUserId
> ><RequestPassword>$requestpassword</RequestPassword><ErrorLevel>1<
> /ErrorLeve
> l><DetailLevel>0</DetailLevel><SiteId>0</SiteId><Verb>AddItem</Ver
> b><Applica
> tionData>$applicationdata</ApplicationData><Category>$category</Ca
> tegory><Ch
> eckoutInstructions>Your payment instructions will be emailed to you within
> an hour of your eBay
> purchase.</CheckoutInstructions><Country>us</Country><Currency>1</
> Currency><
> Description><![CDATA[$description]]></Description><Duration>$durat
> ion</Durat
> ion><Gallery>$gallery</Gallery><GalleryURL>$galleryurl</GalleryURL
> ><Location
> >www.TrippyStore.com</Location><MinimumBid>$price</MinimumBid><Pay
You'll want to change that hard-coded "Location".
> mentSeeDes
> cription>1</PaymentSeeDescription><Quantity>$quantity</Quantity><R
> egion>0</R
> egion><StoreCategory>$storecategory</StoreCategory><SubtitleText>$
> subtitlete
> xt</SubtitleText><Title>$title</Title><Type>$type</Type></request>";
> my $request = $user_agent->request(POST tag_data('ebay_variable',
> 'value', 'request_url'),
> X_EBAY_API_COMPATIBILITY_LEVEL => '305',
> X_EBAY_API_SESSION_CERTIFICATE =>
> "$dev_token;$app_token;$cert_token",
> X_EBAY_API_DEV_NAME => $dev_token,
> X_EBAY_API_APP_NAME => $app_token,
> X_EBAY_API_CERT_NAME => $cert_token,
> X_EBAY_API_CALL_NAME => 'AddItem',
> X_EBAY_API_SITEID => '0',
> X_EBAY_API_DETAIL_LEVEL => '0',
> Content_Type => 'text/xml',
> Content => $content,
> );
> my $xml_simple = XML::Simple->new(
> KeyAttr => [ ],
> ForceArray => [ ],
> );
> my $response = $request->content;
> my $eBay = $xml_simple->XMLin($response);
> my $result = $eBay->{Item};
> $Scratch->{item_id_response} = $result->{Id};
> $Scratch->{additem_log} = $response;
> }
> EOR
[snip]
- Grant
More information about the interchange-users
mailing list