sonnenglas / amazon-mws-laravel

A library to connect to Amazon's MWS web services in an object oriented manner
Apache License 2.0
64 stars 73 forks source link

The MWSAuthToken is used to make requests on behalf of other amazon users #8

Closed vaneavasco closed 6 years ago

vaneavasco commented 7 years ago

The MWSAuthToken is used to make requests on behalf of other amazon users, useful for developers working on amazon mws apps.

developer-gurpreet commented 6 years ago

I want to pass the dynamic credentials however component get credentials from config folder. Can you please let me know how Can I pass dynamic credentials ? e.g $amz = new AmazonOrderList("mystore"); It load the mystore array from config file. but here I want to pass all info from database. Thanks in advance.

ecybertech commented 6 years ago

@Gurpreet68 did you find a solution for this please give me idea of that

vaneavasco commented 6 years ago

Just ignore the config folder, if you check out the AmazonCore class you can see that it gets config data from the Config facade:

 public function setStore($s)
    {
        // if (file_exists($this->config)){
        //     include($this->config);
        // } else {
        //     throw new \Exception("Config file does not exist!");
        // }

        $store = Config::get('amazon-mws.store');

You should do something like this in your own code to set the config data:

    /**
     * @param array $config
     *
     * @return $this
     */
    public function setConfig(array $config)
    {
        $this->uniqueKey = $config['uniqueKey'];

        Config::set(
            'amazon-mws.store.' . $this->uniqueKey,
            [
                'merchantId'       => $config['merchantId'],
                'marketplaceId'    => $config['marketplaceId'],
                'keyId'            => $config['keyId'],
                'secretKey'        => $config['secretKey'],
                'amazonServiceUrl' => $config['amazonServiceUrl'],
                'authToken'        => $config['authToken']
            ]
        );

        return $this;
    }