Plugin Directory

Changeset 1959692


Ignore:
Timestamp:
10/20/2018 10:25:40 AM (7 years ago)
Author:
satoshipay
Message:

update to 1.5

Location:
satoshipay/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • satoshipay/trunk/readme.txt

    r1951997 r1959692  
    55Requires at least: 4.4.5
    66Tested up to: 4.9.8
    7 Stable tag: 1.4
     7Stable tag: 1.5
    88License: MIT
    99License URI: https://opensource.org/licenses/MIT
     
    8080== Changelog ==
    8181
     82= 1.5 =
     83
     84* Fixed bug where API credentials cannot be added or updated.
     85
    8286= 1.4 =
    8387
     
    8892= 1.3 =
    8993
    90 * Fixed wrong versioning. 
     94* Fixed wrong versioning.
    9195
    9296= 1.2 =
  • satoshipay/trunk/satoshipay.php

    r1951997 r1959692  
    1212 * Plugin URI:        https://wordpress.org/plugins/satoshipay/
    1313 * Description:       Integrates SatoshiPay into WordPress. Quick start: 1) Select SatoshiPay from the left-hand admin menu, 2) add SatoshiPay API credentials, 3) edit a post, 4) activate "Paid Post" in SatoshiPay meta box, 5) set a price, 6) publish and view post. The SatoshiPay widget will appear and allow readers to pay for the post.
    14  * Version:           1.4
     14 * Version:           1.5
    1515 * Author:            SatoshiPay
    1616 * Author URI:        https://satoshipay.io
     
    3030// Plugin version, used in user-agent string for API calls; keep in sync with
    3131// version in plugin description above!
    32 define('SATOSHIPAY_VERSION', '1.4');
     32define('SATOSHIPAY_VERSION', '1.5');
    3333
    3434// Plugin root file
     
    3939
    4040// Read environment variables, will override config
    41 if (!defined('SATOSHIPAY_API_URL') && getenv('SATOSHIPAY_API_URL')) {
    42     define('SATOSHIPAY_API_URL', getenv('SATOSHIPAY_API_URL'));
     41if (!defined('SATOSHIPAY_PRODUCT_SERVICE_URL') && getenv('SATOSHIPAY_PRODUCT_SERVICE_URL')) {
     42    define('SATOSHIPAY_PRODUCT_SERVICE_URL', getenv('SATOSHIPAY_PRODUCT_SERVICE_URL'));
     43}
     44if (!defined('SATOSHIPAY_PUBLISHER_SERVICE_URL') && getenv('SATOSHIPAY_PUBLISHER_SERVICE_URL')) {
     45    define('SATOSHIPAY_PUBLISHER_SERVICE_URL', getenv('SATOSHIPAY_PUBLISHER_SERVICE_URL'));
    4346}
    4447if (!defined('SATOSHIPAY_CLIENT_URL') && getenv('SATOSHIPAY_CLIENT_URL')) {
     
    6568    define('SATOSHIPAY_SCRIPT_POST', plugins_url('assets/js/script_post.js', __FILE__));
    6669}
    67 if (!defined('SATOSHIPAY_API_URL')) {
    68     define('SATOSHIPAY_API_URL', 'https://api.satoshipay.io/mainnet');
     70if (!defined('SATOSHIPAY_PRODUCT_SERVICE_URL')) {
     71    define('SATOSHIPAY_PRODUCT_SERVICE_URL', 'https://api.satoshipay.io/v2');
     72}
     73if (!defined('SATOSHIPAY_PUBLISHER_SERVICE_URL')) {
     74    define('SATOSHIPAY_PUBLISHER_SERVICE_URL', 'https://api.satoshipay.io/mainnet/publisher');
    6975}
    7076if (!defined('SATOSHIPAY_CLIENT_URL')) {
  • satoshipay/trunk/src/SatoshiPay/Api/Client.php

    r1948680 r1959692  
    1818     * @var string
    1919     */
    20     protected $apiEndpointPrefix = '/v2';
    21 
    22     /**
    23      * @var string
    24      */
    25     protected $serverUrl = '';
     20    protected $productServiceUrl = '';
     21
     22    /**
     23     * @var string
     24     */
     25    protected $publisherServiceUrl = '';
    2626
    2727    /**
     
    4848     * Constructor.
    4949     *
    50      * @param array $options $serverUrl
     50     * @param array $options $productServiceUrl
     51     * @param array $options $publisherServiceUrl
    5152     * @param string $authKey
    5253     * @param string $authSecret
     
    5455    public function __construct(array $config = array())
    5556    {
    56         $this->serverUrl = SATOSHIPAY_API_URL;
     57        $this->productServiceUrl = SATOSHIPAY_PRODUCT_SERVICE_URL;
     58        $this->publisherServiceUrl = SATOSHIPAY_PUBLISHER_SERVICE_URL;
    5759        $this->defaultMaxProductPrice = SATOSHIPAY_DEFAULT_MAX_PRODUCT_PRICE;
    5860
     
    8284        $goodData['price'] *= 10000000;
    8385
    84         $url = rtrim($this->serverUrl, '/') . $this->apiEndpointPrefix . '/goods';
     86        $url = rtrim($this->productServiceUrl, '/') . '/goods';
    8587        $body = json_encode($goodData);
    8688        $responseData = json_decode($this->post($url, $body), true);
     
    108110        $goodData['price'] *= 10000000;
    109111
    110         $url = rtrim($this->serverUrl, '/') . $this->apiEndpointPrefix . '/goods/' . (string)$goodId;
     112        $url = rtrim($this->productServiceUrl, '/') . '/goods/' . (string)$goodId;
    111113        $body = json_encode($goodData);
    112114        $responseData = json_decode($this->put($url, $body), true);
     
    127129            return;
    128130        }
    129         $url = rtrim($this->serverUrl, '/') . $this->apiEndpointPrefix . '/goods/' . (string)$goodId;
     131        $url = rtrim($this->productServiceUrl, '/') . '/goods/' . (string)$goodId;
    130132        $responseData = json_decode($this->delete($url), true);
    131133        return isset($responseData['id']) ? $responseData['id'] : 0;
     
    140142    public function testCredentials()
    141143    {
    142         $url = rtrim($this->serverUrl, '/') . $this->apiEndpointPrefix . '/permissions';
     144        $url = rtrim($this->productServiceUrl, '/') . '/permissions';
     145        $args = array(
     146            'method' => 'GET'
     147        );
     148
    143149        try {
    144150            $request = $this->request($url, $args);
     
    158164    public function batch(array $batchObjects)
    159165    {
    160         $url = rtrim($this->serverUrl, '/') . $this->apiEndpointPrefix . '/batch';
     166        $url = rtrim($this->productServiceUrl, '/') . '/batch';
    161167        $body = json_encode(array("requests" => $batchObjects));
    162168        $responseData = json_decode($this->post($url, $body), true);
     
    176182            return;
    177183        }
    178         $url = rtrim($this->serverUrl, '/') . '/publisher/' . (string)$publisherId . '/limits';
     184        $url = rtrim($this->publisherServiceUrl, '/') . '/' . (string)$publisherId . '/limits';
    179185        $responseData = json_decode($this->get($url), true);
    180186        return isset($responseData['maxProductPrice']) ? $responseData['maxProductPrice'] : $this->defaultMaxProductPrice;
Note: See TracChangeset for help on using the changeset viewer.