2

我正在使用 eBay API 并尝试接收以下通知:

  • 已售出物品
  • 固定价格交易
  • 拍卖结束

但是,我收到的唯一通知是“FixedPriceTransaction”。

我用来“设置”我收到的通知的代码如下所示:

    $opts = array(
        'ApplicationDeliveryPreferences' => array(
            'ApplicationEnable'  => 'Enable',
            'ApplicationURL'     => 'http://my.domain/ebay_notifications.php',
        ),
        'UserDeliveryPreferenceArray' => array(
            'NotificationEnable' => array(
                'EventType'   => 'ItemSold',
                'EventEnable' => 'Enable'
            ),
            'NotificationEnable' => array(
                'EventType'   => 'EndOfAuction',
                'EventEnable' => 'Enable'
            ),
            'NotificationEnable' => array(
                'EventType'   => 'FixedPriceTransaction',
                'EventEnable' => 'Enable'
            )      
        )
    );

知道我做错了什么吗?

4

2 回答 2

2

我帐户上的男生错误。

'UserDeliveryPreferanceArray' 数组包含多个数组。

它们都有相同的关键标题:'NotificationEnable'

这意味着只使用最后一个 - 包含“FixedPriceNotification”事件的那个。

为了解决这个问题,使每个“通知事件”成为索引数组的一部分:

'NotificationEnable' => array(

                1   =>  array(
                    'EventType'   => 'ItemSold',
                    'EventEnable' => 'Enable' 
                ),

                2   =>  array(
                    'EventType'   => 'EndOfAuction',
                    'EventEnable' => 'Enable' 
                ),

                3   =>  array(
                    'EventType'   => 'FixedPriceTransaction',
                    'EventEnable' => 'Enable' 
                )
            )

快乐的时光。

于 2013-09-30T11:13:59.247 回答
1

好的,也许我错了,但工作代码应该是:

$opts = array(
    'ApplicationDeliveryPreferences' => array(
        'ApplicationEnable'  => 'Enable',
        'ApplicationURL'     => 'http://my.domain/ebay_notifications.php',
    ),
    
        'NotificationEnable' => array(

            1   =>  array(
                'EventType'   => 'ItemSold',
                'EventEnable' => 'Enable' 
            ),

            2   =>  array(
                'EventType'   => 'AskSellerQuestion',
                'EventEnable' => 'Enable' 
            ),

            3   =>  array(
                'EventType'   => 'FixedPriceTransaction',
                'EventEnable' => 'Enable' 
            )
            
    )
);

而不是我想的那样:

$opts = array(
    'ApplicationDeliveryPreferences' => array(
        'ApplicationEnable'  => 'Enable',
        'ApplicationURL'     => 'http://my.domain/ebay_notifications.php',
    ),
    'UserDeliveryPreferenceArray' => array(
        'NotificationEnable' => array(

            1   =>  array(
                'EventType'   => 'ItemSold',
                'EventEnable' => 'Enable' 
            ),

            2   =>  array(
                'EventType'   => 'EndOfAuction',
                'EventEnable' => 'Enable' 
            ),

            3   =>  array(
                'EventType'   => 'FixedPriceTransaction',
                'EventEnable' => 'Enable' 
            )
        )
);

到目前为止,第一个似乎运作良好。最后一个产生 37 个错误。无论如何,谢谢你的巨大建议。

于 2016-04-05T20:31:31.973 回答