The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SOAP::Amazon::MerchantTransport - An easy to connect to Amazon Merchant Services

VERSION

Version 0.02 $Id: MerchantTransport.pm,v 1.1 2006/01/30 17:58:42 nathan Exp $

SYNOPSIS

This module provides a simple way to access Amazon's Merchant Services via SOAP. It is based on SOAP::Lite.

    use SOAP::Amazon::MerchantTransport;  

    my $a = SOAP::Amazon::MerchantTransport->new(
          merchantname => 'Bill Shop',
              merchant => 'Q_M_FOOBAR_1234',
              username => 'joe@schmo.com.com',
              password => 'SDNDJNDNFJDJ',
                   url => 'https://merchant-api-qa.amazon.com/foobar/'
    );

    $som = $a->getAllPendingDocumentInfo($doctype);
    $som = $a->getDocument($documentID);
    $som = $a->postDocument($requesttype, $document); 
    $som = $a->postDocumentDownloadAck(@documentIdentifiers)

All of these methods, by default return a SOAP::SOM Object unless you specify a handler for the return values.

NOTE: It is possible to write your own handlers to return a different object, but no such modules have been created at the time of this writing. Therefore the documentation will always refer to the return value of the get/post documents as being a SOAP::SOM, but obviously if you specify a handler the return object will be different.

If you want to debug, simply import SOAP::Lite with debugging options on into your script. This has the global effect of turning debugging on. e.g.

  use SOAP::Lite +trace => [qw( debug )];

Module Scope

This module is to ease the submission of XML Feeds to Amazon.

This module does not write your Amazon XML Feeds, it only simplifies the submission of those feeds. If you need help writing the Amazon XML Feeds for pricing, inventory, orders, etc. view the sample feeds in the Amazon Documentation. Contact your integration manager for access to these.

Also this module does not handle SOAP errors for you. It uses SOAP::Lite to submit the XML requests and returns a SOAP::SOM object, unless another handler is specified.

CONSTRUCTOR AND STARTUP

$sub->new( );

Creating a new MerchantTransport object is easy: my $a = SOAP::Amazon::MerchantTransport->new( merchantname => 'Bill Shop', merchant => 'Q_M_FOOBAR_1234', username => 'joe@schmo.com.com', password => 'SDNDJNDNFJDJ', url => 'https://merchant-api-qa.amazon.com/foobar/' );

All of these parameters are required.

If you want the response to be something other than an SOAP::SOM object you can pass in the qualified name of the module you want to use as the return values. e.g. ... handler => 'SOAP::Amazon::MSReturnVal', ... This module is currently ficticious. See "Writing Your Own Response Handler" for more information.

METHODS

$a->getAllPendingDocumentInfo( $doctype )

Given a type of document to retrieve, returns an array of TODO s.

Valid values for the $doctype are: orders, or payments. You can also pass the exact values Amazon calls for: _GET_ORDERS_DATA_ or _GET_PAYMENT_SETTLEMENT_DATA_, but the first method is preferred.

$a->getDocumentProcessingStatus( $documentID )

Given the documentTransactionID (given to you by Amazon) returns a SOAP::SOM containing the document.

$a->getDocument( $documentID )

Given the DocumentID received from getAllPendingDocumentInfo returns the a SOAP::SOM containing the return values.

$a->postDocument( $requesttype, $localID, $content )

Given a request type string, local identifier, and an Amazon xml content string returns a SOAP::SOM containing the return values.

Valid Request Types are:

        product
        productRelationship
        productOverrides
        productImage
        productPricing
        inventoryAvailability
        testOrders
        orderAck
        orderFulfillment
        paymentAdjustment
        storeData 

$localID is a local identifier. You could try Data::UUID.

$content is a string containing the XML you want to post to Amazon.

$a->postDocumentDownloadAck( @documentIdentifiers )

TODO

$a->merchantname( [$merchantname] ) =head2 $a->merchant( [$merchant] ) =head2 $a->username( [$username] ) =head2 $a->password( [$password] ) =head2 $a->url( [$url] )

If no argument is given it returns the appropriate value. If there is an argument the value is set.

Examples:

    $a->merchantname('Foo Bar Merch');
    $a->merchant('Q_M_FOOBAR_1234');
    $a->username('joe@schmo.com');
    $a->password('raboof');
    $a->url('https://merchant-api-qa.amazon.com/whatever/');

    my $m = $a->merchant; # $m is now 'Q_M_FOOBAR_1234'
    etc...

Writing Your Own Response Handler

TODO: this feauture is not yet complete.

AUTHOR

Nate Murray, <nate at natemurray.com>

KNOWN BUGS AND LIMITATIONS

There are no known bugs as of version 0.2, just a couple incomplete features.

Please report any bugs or feature requests to bug-soap-amazon-merchantservices at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SOAP-Amazon-MerchantTransport. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc SOAP::Amazon::MerchantTransport

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2006 Nate Murray, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.