diff --git a/src/Luno/AbstractClient.php b/src/Luno/AbstractClient.php index 02a382f..42a1fb1 100644 --- a/src/Luno/AbstractClient.php +++ b/src/Luno/AbstractClient.php @@ -45,8 +45,7 @@ public function setAuth(string $apiKeyID, string $apiKeySecret) */ public function setBaseURL(string $baseURL) { - $flags = \FILTER_FLAG_SCHEME_REQUIRED | \FILTER_FLAG_HOST_REQUIRED; - $valid = filter_var($baseURL, \FILTER_VALIDATE_URL, $flags); + $valid = filter_var($baseURL, \FILTER_VALIDATE_URL); if (!$valid) { throw new \InvalidArgumentException('baseURL should be a valid URL'); } diff --git a/src/Luno/Client.php b/src/Luno/Client.php index 18c4b9a..ede9540 100644 --- a/src/Luno/Client.php +++ b/src/Luno/Client.php @@ -22,7 +22,7 @@ public function CancelWithdrawal(Request\CancelWithdrawal $req): Response\Cancel /** * CreateAccount makes a call to POST /api/1/accounts. * - * Create an additional account for the specified currency. + * This request creates an Account for the specified currency. Please note that the balances for the Account will be displayed based on the asset value, which is the currency the Account is based on. * * Permissions required: Perm_W_Addresses */ @@ -127,7 +127,7 @@ public function ExerciseQuote(Request\ExerciseQuote $req): Response\ExerciseQuot /** * GetBalances makes a call to GET /api/1/balance. * - * Return the list of all accounts and their respective balances. + * The list of all Accounts and their respective balances for the requesting user. * * Permissions required: Perm_R_Balance */ @@ -141,8 +141,7 @@ public function GetBalances(Request\GetBalances $req): Response\GetBalances /** * GetFeeInfo makes a call to GET /api/1/fee_info. * - * Returns your fees and 30 day trading volume (as of midnight) for a given - * pair. + * Returns the fees and 30 day trading volume (as of midnight) for a given currency pair. For complete details, please see Fees & Features. * * Permissions required: Perm_R_Orders */ @@ -157,11 +156,10 @@ public function GetFeeInfo(Request\GetFeeInfo $req): Response\GetFeeInfo * GetFundingAddress makes a call to GET /api/1/funding_address. * * Returns the default receive address associated with your account and the - * amount received via the address. You can specify an optional address - * parameter to return information for a non-default receive address. In the - * response, total_received is the total confirmed Bitcoin amount received - * excluding unconfirmed transactions. total_unconfirmed is the total sum of - * unconfirmed receive transactions. + * amount received via the address. Users can specify an optional address parameter to return information for a non-default receive address. + * + * In the response, total_received is the total confirmed amount received excluding unconfirmed transactions. + * total_unconfirmed is the total sum of unconfirmed receive transactions. * * Permissions required: Perm_R_Addresses */ @@ -172,6 +170,23 @@ public function GetFundingAddress(Request\GetFundingAddress $req): Response\GetF return $mapper->map($res, new Response\GetFundingAddress); } + /** + * GetLightningReceive makes a call to GET /api/1/lightning/receive/{id}. + * + * Alpha warning! The Lightning API is still in Alpha stage. + * The risks are limited api availability and channel capacity. + * + * Lookup the status of a Lightning Receive Invoice. + * + * Permissions required: Perm_W_Send + */ + public function GetLightningReceive(Request\GetLightningReceive $req): Response\GetLightningReceive + { + $res = $this->do("GET", "/api/1/lightning/receive/{id}", $req, true); + $mapper = new \JsonMapper(); + return $mapper->map($res, new Response\GetLightningReceive); + } + /** * GetOrder makes a call to GET /api/1/orders/{id}. * @@ -189,9 +204,12 @@ public function GetOrder(Request\GetOrder $req): Response\GetOrder /** * GetOrderBook makes a call to GET /api/1/orderbook_top. * - * Returns a list of the top 100 bids and asks in the order book. - * Ask orders are sorted by price ascending. - * Bid orders are sorted by price descending. + * Returns a list of the top 100 bids and asks for the currency pair specified in the Order Book. + * + * Ask Orders are sorted by price ascending. + * + * Bid Orders are sorted by price descending. + * * Orders of the same price are aggregated. */ public function GetOrderBook(Request\GetOrderBook $req): Response\GetOrderBook @@ -204,13 +222,17 @@ public function GetOrderBook(Request\GetOrderBook $req): Response\GetOrderBook /** * GetOrderBookFull makes a call to GET /api/1/orderbook. * - * Returns a list of all bids and asks in the order book. + * This request returns a list of all bids and asks for the currency pair specified in the Order Book. + * * Ask orders are sorted by price ascending. + * * Bid orders are sorted by price descending. + * * Multiple orders at the same price are not aggregated. * - * Warning: This may return a large amount of data. Generally you should rather - * use GetOrderBook or the Streaming API. + * Warning: This may return a large amount of data. + * Users are recommended to use the top 100 bids and asks + * or the Streaming API. */ public function GetOrderBookFull(Request\GetOrderBookFull $req): Response\GetOrderBookFull { @@ -274,10 +296,10 @@ public function GetWithdrawal(Request\GetWithdrawal $req): Response\GetWithdrawa /** * ListOrders makes a call to GET /api/1/listorders. * - * Returns a list of the most recently placed orders. You can specify an - * optional state=PENDING parameter to restrict the results to only - * open orders. You can also specify the market by using the optional pair - * parameter. The list is truncated after 100 items. + * Returns a list of the most recently placed Orders. + * Users can specify an optional state=PENDING parameter to restrict the results to only open Orders. + * Users can also specify the market by using the optional currency pair parameter. + * The list is truncated after 100 items. * * Permissions required: Perm_R_Orders */ @@ -291,10 +313,9 @@ public function ListOrders(Request\ListOrders $req): Response\ListOrders /** * ListPendingTransactions makes a call to GET /api/1/accounts/{id}/pending. * - * Return a list of all pending transactions related to the account. + * Return a list of all transactions that have not completed for the Account. * - * Unlike account entries, pending transactions are not numbered, and may be - * reordered, deleted or updated at any time. + * Pending transactions are not numbered, and may be reordered, deleted or updated at any time. * * Permissions required: Perm_R_Transactions */ @@ -308,8 +329,8 @@ public function ListPendingTransactions(Request\ListPendingTransactions $req): R /** * ListTrades makes a call to GET /api/1/trades. * - * Returns a list of the most recent trades. At most 100 results are returned - * per call. + * Returns a list of the most recent trades that happened in the last 24h. At + * most 100 results are returned per call. */ public function ListTrades(Request\ListTrades $req): Response\ListTrades { @@ -344,16 +365,13 @@ public function ListTransactions(Request\ListTransactions $req): Response\ListTr /** * ListUserTrades makes a call to GET /api/1/listtrades. * - * Returns a list of your recent trades for a given pair, sorted by oldest - * first. If before is specified, then the trades are returned - * sorted by most-recent first. + * Returns a list of the recent Trades for a given currency pair for this user, sorted by oldest first. + * If before is specified, then Trades are returned sorted by most-recent first. * - * type in the response indicates the type of order that you placed - * in order to participate in the trade. Possible types: BID, - * ASK. + * type in the response indicates the type of Order that was placed to participate in the trade. + * Possible types: BID, ASK. * - * If is_buy in the response is true, then the order which - * completed the trade (market taker) was a bid order. + * If is_buy in the response is true, then the Order which completed the trade (market taker) was a Bid Order. * * Results of this query may lag behind the latest data. * @@ -405,18 +423,15 @@ public function PostLimitOrder(Request\PostLimitOrder $req): Response\PostLimitO /** * PostMarketOrder makes a call to POST /api/1/marketorder. * - * Create a new market order. + * Create a new Market Order. * - * A market order executes immediately, and either buys as much Bitcoin or - * Ethereum that can be bought for a set amount of fiat currency, or sells a - * set amount of Bitcoin or Ethereum for as much fiat as possible. + * A Market Order executes immediately, and either buys as much of the asset that can be bought for a set amount of fiat currency, or sells a set amount of the asset for as much as possible. * - * Warning! Orders cannot be reversed once they have executed. Please ensure - * your program has been thoroughly tested before submitting orders. + * Warning! Orders cannot be reversed once they have executed. + * Please ensure your program has been thoroughly tested before submitting Orders. * - * If no base_account_id or counter_account_id are specified, your default base - * currency or counter currency account will be used. You can find your account - * IDs by calling the Balances API. + * If no base_account_id or counter_account_id are specified, the default base currency or counter currency account will be used. + * Users can find their account IDs by calling the Balances request. * * Permissions required: Perm_W_Orders */ @@ -427,6 +442,24 @@ public function PostMarketOrder(Request\PostMarketOrder $req): Response\PostMark return $mapper->map($res, new Response\PostMarketOrder); } + /** + * ReceiveLightning makes a call to POST /api/1/lightning/receive. + * + * Alpha warning! The Lightning API is still in Alpha stage. + * The risks are limited api availability and channel capacity. + * + * Create a lightning invoice which can be used to receive + * BTC payments over the lightning network. + * + * Permissions required: Perm_W_Send + */ + public function ReceiveLightning(Request\ReceiveLightning $req): Response\ReceiveLightning + { + $res = $this->do("POST", "/api/1/lightning/receive", $req, true); + $mapper = new \JsonMapper(); + return $mapper->map($res, new Response\ReceiveLightning); + } + /** * Send makes a call to POST /api/1/send. * @@ -448,6 +481,26 @@ public function Send(Request\Send $req): Response\Send return $mapper->map($res, new Response\Send); } + /** + * SendLightning makes a call to POST /api/1/lightning/send. + * + * Alpha warning! The Lightning API is still in Alpha stage. + * The risks are limited api availability and channel capacity. + * + * Send Bitcoin over the Lightning network from your Bitcoin Account. + * + * Warning! Cryptocurrency transactions are irreversible. Please ensure your + * program has been thoroughly tested before using this call. + * + * Permissions required: Perm_W_Send + */ + public function SendLightning(Request\SendLightning $req): Response\SendLightning + { + $res = $this->do("POST", "/api/1/lightning/send", $req, true); + $mapper = new \JsonMapper(); + return $mapper->map($res, new Response\SendLightning); + } + /** * StopOrder makes a call to POST /api/1/stoporder. * diff --git a/src/Luno/Request/CancelWithdrawal.php b/src/Luno/Request/CancelWithdrawal.php index 3b21ad0..896b867 100644 --- a/src/Luno/Request/CancelWithdrawal.php +++ b/src/Luno/Request/CancelWithdrawal.php @@ -10,20 +10,20 @@ class CancelWithdrawal extends AbstractRequest protected $id; /** - * @return string + * @return int */ - public function getId(): string + public function getId(): int { if (!isset($this->id)) { - return ""; + return 0; } return $this->id; } /** - * @param string $id + * @param int $id */ - public function setId(string $id) + public function setId(int $id) { $this->id = $id; } diff --git a/src/Luno/Request/CreateAccount.php b/src/Luno/Request/CreateAccount.php index d369caf..cb030f6 100644 --- a/src/Luno/Request/CreateAccount.php +++ b/src/Luno/Request/CreateAccount.php @@ -5,10 +5,11 @@ class CreateAccount extends AbstractRequest { /** - * The currency code for the account you want to create + * The currency code for the Account you want to create. Please see the Currency section for a detailed list of currencies supported by the Luno platform. * - * You must be verified to trade currency in order to be able to create an - * account. A user has a limit of 4 accounts per currency. + * Users must be verified to trade currency in order to be able to create an Account. For more information on the verification process, please see How do I verify my identity?. + * + * Users have a limit of 4 accounts per currency. */ protected $currency; diff --git a/src/Luno/Request/CreateFundingAddress.php b/src/Luno/Request/CreateFundingAddress.php index 9424c27..1d8b158 100644 --- a/src/Luno/Request/CreateFundingAddress.php +++ b/src/Luno/Request/CreateFundingAddress.php @@ -10,7 +10,7 @@ class CreateFundingAddress extends AbstractRequest protected $asset; /** - * An optional name for the new address + * An optional name for the new Receive Address */ protected $name; diff --git a/src/Luno/Request/CreateQuote.php b/src/Luno/Request/CreateQuote.php index 3e751b9..59c7942 100644 --- a/src/Luno/Request/CreateQuote.php +++ b/src/Luno/Request/CreateQuote.php @@ -4,6 +4,11 @@ class CreateQuote extends AbstractRequest { + /** + * BUY or SELL. + */ + protected $type; + /** * Amount to buy or sell in the pair base currency. */ @@ -15,11 +20,6 @@ class CreateQuote extends AbstractRequest */ protected $pair; - /** - * BUY or SELL. - */ - protected $type; - /** * Optional account for the pair's base currency. */ @@ -30,6 +30,25 @@ class CreateQuote extends AbstractRequest */ protected $counter_account_id; + /** + * @return string + */ + public function getType(): string + { + if (!isset($this->type)) { + return ""; + } + return $this->type; + } + + /** + * @param string $type + */ + public function setType(string $type) + { + $this->type = $type; + } + /** * @return float */ @@ -69,58 +88,39 @@ public function setPair(string $pair) } /** - * @return string + * @return int */ - public function getType(): string - { - if (!isset($this->type)) { - return ""; - } - return $this->type; - } - - /** - * @param string $type - */ - public function setType(string $type) - { - $this->type = $type; - } - - /** - * @return string - */ - public function getBaseAccountId(): string + public function getBaseAccountId(): int { if (!isset($this->base_account_id)) { - return ""; + return 0; } return $this->base_account_id; } /** - * @param string $baseAccountId + * @param int $baseAccountId */ - public function setBaseAccountId(string $baseAccountId) + public function setBaseAccountId(int $baseAccountId) { $this->base_account_id = $baseAccountId; } /** - * @return string + * @return int */ - public function getCounterAccountId(): string + public function getCounterAccountId(): int { if (!isset($this->counter_account_id)) { - return ""; + return 0; } return $this->counter_account_id; } /** - * @param string $counterAccountId + * @param int $counterAccountId */ - public function setCounterAccountId(string $counterAccountId) + public function setCounterAccountId(int $counterAccountId) { $this->counter_account_id = $counterAccountId; } diff --git a/src/Luno/Request/CreateWithdrawal.php b/src/Luno/Request/CreateWithdrawal.php index 3b909d6..15e307c 100644 --- a/src/Luno/Request/CreateWithdrawal.php +++ b/src/Luno/Request/CreateWithdrawal.php @@ -5,14 +5,14 @@ class CreateWithdrawal extends AbstractRequest { /** - * Amount to withdraw. The currency depends on the type. + * Withdrawal type. */ - protected $amount; + protected $type; /** - * Withdrawal type. + * Amount to withdraw. The currency depends on the type. */ - protected $type; + protected $amount; /** * The beneficiary ID of the bank account the withdrawal will be paid out @@ -22,18 +22,37 @@ class CreateWithdrawal extends AbstractRequest */ protected $beneficiary_id; + /** + * For internal use. + */ + protected $reference; + /** * Optional unique ID to associate with this withdrawal. Useful to prevent * duplicate sends in case of failure. It supports all alphanumeric * characters, as well as "-" and "_". */ protected $external_id; + + /** + * @return string + */ + public function getType(): string + { + if (!isset($this->type)) { + return ""; + } + return $this->type; + } /** - * For internal use. + * @param string $type */ - protected $reference; - + public function setType(string $type) + { + $this->type = $type; + } + /** * @return float */ @@ -54,41 +73,41 @@ public function setAmount(float $amount) } /** - * @return string + * @return int */ - public function getType(): string + public function getBeneficiaryId(): int { - if (!isset($this->type)) { - return ""; + if (!isset($this->beneficiary_id)) { + return 0; } - return $this->type; + return $this->beneficiary_id; } /** - * @param string $type + * @param int $beneficiaryId */ - public function setType(string $type) + public function setBeneficiaryId(int $beneficiaryId) { - $this->type = $type; + $this->beneficiary_id = $beneficiaryId; } /** * @return string */ - public function getBeneficiaryId(): string + public function getReference(): string { - if (!isset($this->beneficiary_id)) { + if (!isset($this->reference)) { return ""; } - return $this->beneficiary_id; + return $this->reference; } /** - * @param string $beneficiaryId + * @param string $reference */ - public function setBeneficiaryId(string $beneficiaryId) + public function setReference(string $reference) { - $this->beneficiary_id = $beneficiaryId; + $this->reference = $reference; } /** @@ -109,25 +128,6 @@ public function setExternalId(string $externalId) { $this->external_id = $externalId; } - - /** - * @return string - */ - public function getReference(): string - { - if (!isset($this->reference)) { - return ""; - } - return $this->reference; - } - - /** - * @param string $reference - */ - public function setReference(string $reference) - { - $this->reference = $reference; - } } // vi: ft=php diff --git a/src/Luno/Request/DiscardQuote.php b/src/Luno/Request/DiscardQuote.php index 10dc6df..6af93fb 100644 --- a/src/Luno/Request/DiscardQuote.php +++ b/src/Luno/Request/DiscardQuote.php @@ -10,20 +10,20 @@ class DiscardQuote extends AbstractRequest protected $id; /** - * @return string + * @return int */ - public function getId(): string + public function getId(): int { if (!isset($this->id)) { - return ""; + return 0; } return $this->id; } /** - * @param string $id + * @param int $id */ - public function setId(string $id) + public function setId(int $id) { $this->id = $id; } diff --git a/src/Luno/Request/ExerciseQuote.php b/src/Luno/Request/ExerciseQuote.php index 3005bfc..319a3f9 100644 --- a/src/Luno/Request/ExerciseQuote.php +++ b/src/Luno/Request/ExerciseQuote.php @@ -10,20 +10,20 @@ class ExerciseQuote extends AbstractRequest protected $id; /** - * @return string + * @return int */ - public function getId(): string + public function getId(): int { if (!isset($this->id)) { - return ""; + return 0; } return $this->id; } /** - * @param string $id + * @param int $id */ - public function setId(string $id) + public function setId(int $id) { $this->id = $id; } diff --git a/src/Luno/Request/GetFundingAddress.php b/src/Luno/Request/GetFundingAddress.php index cfb5466..14d3836 100644 --- a/src/Luno/Request/GetFundingAddress.php +++ b/src/Luno/Request/GetFundingAddress.php @@ -10,7 +10,7 @@ class GetFundingAddress extends AbstractRequest protected $asset; /** - * Specific Bitcoin or Ethereum address to retrieve. If not provided, the + * Specific cryptocurrency address to retrieve. If not provided, the * default address will be used. */ protected $address; diff --git a/src/Luno/Request/GetLightningReceive.php b/src/Luno/Request/GetLightningReceive.php new file mode 100644 index 0000000..a05fe6f --- /dev/null +++ b/src/Luno/Request/GetLightningReceive.php @@ -0,0 +1,32 @@ +id)) { + return 0; + } + return $this->id; + } + + /** + * @param int $id + */ + public function setId(int $id) + { + $this->id = $id; + } +} + +// vi: ft=php diff --git a/src/Luno/Request/GetOrderBook.php b/src/Luno/Request/GetOrderBook.php index ff8f104..a151ea1 100644 --- a/src/Luno/Request/GetOrderBook.php +++ b/src/Luno/Request/GetOrderBook.php @@ -5,7 +5,7 @@ class GetOrderBook extends AbstractRequest { /** - * Currency pair + * Currency pair of the Orders to retrieve */ protected $pair; diff --git a/src/Luno/Request/GetOrderBookFull.php b/src/Luno/Request/GetOrderBookFull.php index 83c3d2a..06fb824 100644 --- a/src/Luno/Request/GetOrderBookFull.php +++ b/src/Luno/Request/GetOrderBookFull.php @@ -5,7 +5,7 @@ class GetOrderBookFull extends AbstractRequest { /** - * Currency pair + * Currency pair of the Orders to retrieve */ protected $pair; diff --git a/src/Luno/Request/GetQuote.php b/src/Luno/Request/GetQuote.php index 6244a70..b604ea2 100644 --- a/src/Luno/Request/GetQuote.php +++ b/src/Luno/Request/GetQuote.php @@ -10,20 +10,20 @@ class GetQuote extends AbstractRequest protected $id; /** - * @return string + * @return int */ - public function getId(): string + public function getId(): int { if (!isset($this->id)) { - return ""; + return 0; } return $this->id; } /** - * @param string $id + * @param int $id */ - public function setId(string $id) + public function setId(int $id) { $this->id = $id; } diff --git a/src/Luno/Request/GetWithdrawal.php b/src/Luno/Request/GetWithdrawal.php index e8ebb57..297f660 100644 --- a/src/Luno/Request/GetWithdrawal.php +++ b/src/Luno/Request/GetWithdrawal.php @@ -10,20 +10,20 @@ class GetWithdrawal extends AbstractRequest protected $id; /** - * @return string + * @return int */ - public function getId(): string + public function getId(): int { if (!isset($this->id)) { - return ""; + return 0; } return $this->id; } /** - * @param string $id + * @param int $id */ - public function setId(string $id) + public function setId(int $id) { $this->id = $id; } diff --git a/src/Luno/Request/ListOrders.php b/src/Luno/Request/ListOrders.php index 3e17752..fd6e5d0 100644 --- a/src/Luno/Request/ListOrders.php +++ b/src/Luno/Request/ListOrders.php @@ -5,99 +5,99 @@ class ListOrders extends AbstractRequest { /** - * Filter to orders created before this timestamp (Unix milliseconds) + * Filter to only orders of this state */ - protected $created_before; + protected $state; /** - * Limit to this many orders + * Filter to only orders of this currency pair */ - protected $limit; + protected $pair; /** - * Filter to only orders of this currency pair + * Filter to orders created before this timestamp (Unix milliseconds) */ - protected $pair; + protected $created_before; /** - * Filter to only orders of this state + * Limit to this many orders */ - protected $state; + protected $limit; /** - * @return int + * @return string */ - public function getCreatedBefore(): int + public function getState(): string { - if (!isset($this->created_before)) { - return 0; + if (!isset($this->state)) { + return ""; } - return $this->created_before; + return $this->state; } /** - * @param int $createdBefore + * @param string $state */ - public function setCreatedBefore(int $createdBefore) + public function setState(string $state) { - $this->created_before = $createdBefore; + $this->state = $state; } /** - * @return int + * @return string */ - public function getLimit(): int + public function getPair(): string { - if (!isset($this->limit)) { - return 0; + if (!isset($this->pair)) { + return ""; } - return $this->limit; + return $this->pair; } /** - * @param int $limit + * @param string $pair */ - public function setLimit(int $limit) + public function setPair(string $pair) { - $this->limit = $limit; + $this->pair = $pair; } /** - * @return string + * @return int */ - public function getPair(): string + public function getCreatedBefore(): int { - if (!isset($this->pair)) { - return ""; + if (!isset($this->created_before)) { + return 0; } - return $this->pair; + return $this->created_before; } /** - * @param string $pair + * @param int $createdBefore */ - public function setPair(string $pair) + public function setCreatedBefore(int $createdBefore) { - $this->pair = $pair; + $this->created_before = $createdBefore; } /** - * @return string + * @return int */ - public function getState(): string + public function getLimit(): int { - if (!isset($this->state)) { - return ""; + if (!isset($this->limit)) { + return 0; } - return $this->state; + return $this->limit; } /** - * @param string $state + * @param int $limit */ - public function setState(string $state) + public function setLimit(int $limit) { - $this->state = $state; + $this->limit = $limit; } } diff --git a/src/Luno/Request/ListPendingTransactions.php b/src/Luno/Request/ListPendingTransactions.php index 6518684..e3d0907 100644 --- a/src/Luno/Request/ListPendingTransactions.php +++ b/src/Luno/Request/ListPendingTransactions.php @@ -10,20 +10,20 @@ class ListPendingTransactions extends AbstractRequest protected $id; /** - * @return string + * @return int */ - public function getId(): string + public function getId(): int { if (!isset($this->id)) { - return ""; + return 0; } return $this->id; } /** - * @param string $id + * @param int $id */ - public function setId(string $id) + public function setId(int $id) { $this->id = $id; } diff --git a/src/Luno/Request/ListTransactions.php b/src/Luno/Request/ListTransactions.php index 9f07b01..e868b6b 100644 --- a/src/Luno/Request/ListTransactions.php +++ b/src/Luno/Request/ListTransactions.php @@ -5,35 +5,35 @@ class ListTransactions extends AbstractRequest { /** - * Account ID + * Account ID - the unique identifier for the specific Account. */ protected $id; /** - * Maximum of the row range to return (exclusive) + * Minimum of the row range to return (inclusive) */ - protected $max_row; + protected $min_row; /** - * Minimum of the row range to return (inclusive) + * Maximum of the row range to return (exclusive) */ - protected $min_row; + protected $max_row; /** - * @return string + * @return int */ - public function getId(): string + public function getId(): int { if (!isset($this->id)) { - return ""; + return 0; } return $this->id; } /** - * @param string $id + * @param int $id */ - public function setId(string $id) + public function setId(int $id) { $this->id = $id; } @@ -41,39 +41,39 @@ public function setId(string $id) /** * @return int */ - public function getMaxRow(): int + public function getMinRow(): int { - if (!isset($this->max_row)) { + if (!isset($this->min_row)) { return 0; } - return $this->max_row; + return $this->min_row; } /** - * @param int $maxRow + * @param int $minRow */ - public function setMaxRow(int $maxRow) + public function setMinRow(int $minRow) { - $this->max_row = $maxRow; + $this->min_row = $minRow; } /** * @return int */ - public function getMinRow(): int + public function getMaxRow(): int { - if (!isset($this->min_row)) { + if (!isset($this->max_row)) { return 0; } - return $this->min_row; + return $this->max_row; } /** - * @param int $minRow + * @param int $maxRow */ - public function setMinRow(int $minRow) + public function setMaxRow(int $maxRow) { - $this->min_row = $minRow; + $this->max_row = $maxRow; } } diff --git a/src/Luno/Request/ListUserTrades.php b/src/Luno/Request/ListUserTrades.php index 1caed82..dcf21ee 100644 --- a/src/Luno/Request/ListUserTrades.php +++ b/src/Luno/Request/ListUserTrades.php @@ -10,10 +10,9 @@ class ListUserTrades extends AbstractRequest protected $pair; /** - * Filter to trades from (including) this sequence number. - * Default behaviour is not to include this filter. + * Filter to trades on or after this timestamp. */ - protected $after_seq; + protected $since; /** * Filter to trades before this timestamp. @@ -21,26 +20,27 @@ class ListUserTrades extends AbstractRequest protected $before; /** - * Filter to trades before (excluding) this sequence number. + * Filter to trades from (including) this sequence number. * Default behaviour is not to include this filter. */ - protected $before_seq; - - /** - * Limit to this number of trades (default 100). - */ - protected $limit; + protected $after_seq; /** - * Filter to trades on or after this timestamp. + * Filter to trades before (excluding) this sequence number. + * Default behaviour is not to include this filter. */ - protected $since; + protected $before_seq; /** * If set to true, sorts trades in descending order, otherwise ascending * order will be assumed. */ protected $sort_desc; + + /** + * Limit to this number of trades (default 100). + */ + protected $limit; /** * @return string @@ -64,20 +64,20 @@ public function setPair(string $pair) /** * @return int */ - public function getAfterSeq(): int + public function getSince(): int { - if (!isset($this->after_seq)) { + if (!isset($this->since)) { return 0; } - return $this->after_seq; + return $this->since; } /** - * @param int $afterSeq + * @param int $since */ - public function setAfterSeq(int $afterSeq) + public function setSince(int $since) { - $this->after_seq = $afterSeq; + $this->since = $since; } /** @@ -102,77 +102,77 @@ public function setBefore(int $before) /** * @return int */ - public function getBeforeSeq(): int + public function getAfterSeq(): int { - if (!isset($this->before_seq)) { + if (!isset($this->after_seq)) { return 0; } - return $this->before_seq; + return $this->after_seq; } /** - * @param int $beforeSeq + * @param int $afterSeq */ - public function setBeforeSeq(int $beforeSeq) + public function setAfterSeq(int $afterSeq) { - $this->before_seq = $beforeSeq; + $this->after_seq = $afterSeq; } /** * @return int */ - public function getLimit(): int + public function getBeforeSeq(): int { - if (!isset($this->limit)) { + if (!isset($this->before_seq)) { return 0; } - return $this->limit; + return $this->before_seq; } /** - * @param int $limit + * @param int $beforeSeq */ - public function setLimit(int $limit) + public function setBeforeSeq(int $beforeSeq) { - $this->limit = $limit; + $this->before_seq = $beforeSeq; } /** - * @return int + * @return bool */ - public function getSince(): int + public function getSortDesc(): bool { - if (!isset($this->since)) { - return 0; + if (!isset($this->sort_desc)) { + return false; } - return $this->since; + return $this->sort_desc; } /** - * @param int $since + * @param bool $sortDesc */ - public function setSince(int $since) + public function setSortDesc(bool $sortDesc) { - $this->since = $since; + $this->sort_desc = $sortDesc; } /** - * @return bool + * @return int */ - public function getSortDesc(): bool + public function getLimit(): int { - if (!isset($this->sort_desc)) { - return false; + if (!isset($this->limit)) { + return 0; } - return $this->sort_desc; + return $this->limit; } /** - * @param bool $sortDesc + * @param int $limit */ - public function setSortDesc(bool $sortDesc) + public function setLimit(int $limit) { - $this->sort_desc = $sortDesc; + $this->limit = $limit; } } diff --git a/src/Luno/Request/PostLimitOrder.php b/src/Luno/Request/PostLimitOrder.php index 5d25a97..7698349 100644 --- a/src/Luno/Request/PostLimitOrder.php +++ b/src/Luno/Request/PostLimitOrder.php @@ -9,23 +9,32 @@ class PostLimitOrder extends AbstractRequest */ protected $pair; - /** - * Limit price as a decimal string in units of ZAR/BTC. - */ - protected $price; - /** * BID for a bid (buy) limit order
* ASK for ab ask (sell) limit order */ protected $type; + /** + * Post-only orders will be cancelled if they would otherwise have traded + * immediately. For example, if there's a bid at ZAR 100,000 and you place + * a post-only ask at ZAR 100,000, your order will be cancelled instead of + * trading. If the best bid is ZAR 100,000 and you place a post-only ask at + * ZAR 101,000, your order won't trade but will go into the order book. + */ + protected $post_only; + /** * Amount of Bitcoin or Ethereum to buy or sell as a decimal string in units * of the currency. */ protected $volume; + /** + * Limit price as a decimal string in units of ZAR/BTC. + */ + protected $price; + /** * The base currency account to use in the trade. */ @@ -35,15 +44,6 @@ class PostLimitOrder extends AbstractRequest * The counter currency account to use in the trade. */ protected $counter_account_id; - - /** - * Post-only orders will be cancelled if they would otherwise have traded - * immediately. For example, if there's a bid at ZAR 100,000 and you place - * a post-only ask at ZAR 100,000, your order will be cancelled instead of - * trading. If the best bid is ZAR 100,000 and you place a post-only ask at - * ZAR 101,000, your order won't trade but will go into the order book. - */ - protected $post_only; /** * @return string @@ -65,41 +65,41 @@ public function setPair(string $pair) } /** - * @return float + * @return string */ - public function getPrice(): float + public function getType(): string { - if (!isset($this->price)) { - return 0; + if (!isset($this->type)) { + return ""; } - return $this->price; + return $this->type; } /** - * @param float $price + * @param string $type */ - public function setPrice(float $price) + public function setType(string $type) { - $this->price = $price; + $this->type = $type; } /** - * @return string + * @return bool */ - public function getType(): string + public function getPostOnly(): bool { - if (!isset($this->type)) { - return ""; + if (!isset($this->post_only)) { + return false; } - return $this->type; + return $this->post_only; } /** - * @param string $type + * @param bool $postOnly */ - public function setType(string $type) + public function setPostOnly(bool $postOnly) { - $this->type = $type; + $this->post_only = $postOnly; } /** @@ -122,60 +122,60 @@ public function setVolume(float $volume) } /** - * @return string + * @return float */ - public function getBaseAccountId(): string + public function getPrice(): float { - if (!isset($this->base_account_id)) { - return ""; + if (!isset($this->price)) { + return 0; } - return $this->base_account_id; + return $this->price; } /** - * @param string $baseAccountId + * @param float $price */ - public function setBaseAccountId(string $baseAccountId) + public function setPrice(float $price) { - $this->base_account_id = $baseAccountId; + $this->price = $price; } /** - * @return string + * @return int */ - public function getCounterAccountId(): string + public function getBaseAccountId(): int { - if (!isset($this->counter_account_id)) { - return ""; + if (!isset($this->base_account_id)) { + return 0; } - return $this->counter_account_id; + return $this->base_account_id; } /** - * @param string $counterAccountId + * @param int $baseAccountId */ - public function setCounterAccountId(string $counterAccountId) + public function setBaseAccountId(int $baseAccountId) { - $this->counter_account_id = $counterAccountId; + $this->base_account_id = $baseAccountId; } /** - * @return bool + * @return int */ - public function getPostOnly(): bool + public function getCounterAccountId(): int { - if (!isset($this->post_only)) { - return false; + if (!isset($this->counter_account_id)) { + return 0; } - return $this->post_only; + return $this->counter_account_id; } /** - * @param bool $postOnly + * @param int $counterAccountId */ - public function setPostOnly(bool $postOnly) + public function setCounterAccountId(int $counterAccountId) { - $this->post_only = $postOnly; + $this->counter_account_id = $counterAccountId; } } diff --git a/src/Luno/Request/PostMarketOrder.php b/src/Luno/Request/PostMarketOrder.php index 594ac82..53d4b42 100644 --- a/src/Luno/Request/PostMarketOrder.php +++ b/src/Luno/Request/PostMarketOrder.php @@ -10,32 +10,30 @@ class PostMarketOrder extends AbstractRequest protected $pair; /** - * BUY to buy Bitcoin or Ethereum
- * SELL to sell Bitcoin or Ethereum + * BUY to buy an asset
+ * SELL to sell an asset */ protected $type; /** - * The base currency account to use in the trade. + * For a BUY order: amount of the counter currency to use (e.g. how much EUR to use to buy BTC in the BTC/EUR market) */ - protected $base_account_id; + protected $counter_volume; /** - * For a SELL order: amount of Bitcoin to sell as a decimal - * string in units of BTC or ETH. + * For a SELL order: amount of the base currency to use (e.g. how much BTC to sell for EUR in the BTC/EUR market) */ protected $base_volume; /** - * The counter currency account to use in the trade. + * The base currency account to use in the trade. */ - protected $counter_account_id; + protected $base_account_id; /** - * For a BUY order: amount of local currency (e.g. ZAR, MYR) to - * spend as a decimal string in units of the local currency. + * The counter currency account to use in the trade. */ - protected $counter_volume; + protected $counter_account_id; /** * @return string @@ -76,22 +74,22 @@ public function setType(string $type) } /** - * @return string + * @return float */ - public function getBaseAccountId(): string + public function getCounterVolume(): float { - if (!isset($this->base_account_id)) { - return ""; + if (!isset($this->counter_volume)) { + return 0; } - return $this->base_account_id; + return $this->counter_volume; } /** - * @param string $baseAccountId + * @param float $counterVolume */ - public function setBaseAccountId(string $baseAccountId) + public function setCounterVolume(float $counterVolume) { - $this->base_account_id = $baseAccountId; + $this->counter_volume = $counterVolume; } /** @@ -114,41 +112,41 @@ public function setBaseVolume(float $baseVolume) } /** - * @return string + * @return int */ - public function getCounterAccountId(): string + public function getBaseAccountId(): int { - if (!isset($this->counter_account_id)) { - return ""; + if (!isset($this->base_account_id)) { + return 0; } - return $this->counter_account_id; + return $this->base_account_id; } /** - * @param string $counterAccountId + * @param int $baseAccountId */ - public function setCounterAccountId(string $counterAccountId) + public function setBaseAccountId(int $baseAccountId) { - $this->counter_account_id = $counterAccountId; + $this->base_account_id = $baseAccountId; } /** - * @return float + * @return int */ - public function getCounterVolume(): float + public function getCounterAccountId(): int { - if (!isset($this->counter_volume)) { + if (!isset($this->counter_account_id)) { return 0; } - return $this->counter_volume; + return $this->counter_account_id; } /** - * @param float $counterVolume + * @param int $counterAccountId */ - public function setCounterVolume(float $counterVolume) + public function setCounterAccountId(int $counterAccountId) { - $this->counter_volume = $counterVolume; + $this->counter_account_id = $counterAccountId; } } diff --git a/src/Luno/Request/ReceiveLightning.php b/src/Luno/Request/ReceiveLightning.php new file mode 100644 index 0000000..5476397 --- /dev/null +++ b/src/Luno/Request/ReceiveLightning.php @@ -0,0 +1,106 @@ +currency)) { + return ""; + } + return $this->currency; + } + + /** + * @param string $currency + */ + public function setCurrency(string $currency) + { + $this->currency = $currency; + } + + /** + * @return float + */ + public function getAmount(): float + { + if (!isset($this->amount)) { + return 0; + } + return $this->amount; + } + + /** + * @param float $amount + */ + public function setAmount(float $amount) + { + $this->amount = $amount; + } + + /** + * @return int + */ + public function getExpiresAt(): int + { + if (!isset($this->expires_at)) { + return 0; + } + return $this->expires_at; + } + + /** + * @param int $expiresAt + */ + public function setExpiresAt(int $expiresAt) + { + $this->expires_at = $expiresAt; + } + + /** + * @return string + */ + public function getDescription(): string + { + if (!isset($this->description)) { + return ""; + } + return $this->description; + } + + /** + * @param string $description + */ + public function setDescription(string $description) + { + $this->description = $description; + } +} + +// vi: ft=php diff --git a/src/Luno/Request/Send.php b/src/Luno/Request/Send.php index e2cde81..78cbea1 100644 --- a/src/Luno/Request/Send.php +++ b/src/Luno/Request/Send.php @@ -4,6 +4,16 @@ class Send extends AbstractRequest { + /** + * Amount to send as a decimal string. + */ + protected $amount; + + /** + * Currency to send. + */ + protected $currency; + /** * Destination Bitcoin address or email address, or Ethereum address to send * to. @@ -17,53 +27,24 @@ class Send extends AbstractRequest */ protected $address; - /** - * Amount to send as a decimal string. - */ - protected $amount; - - /** - * Currency to send. - */ - protected $currency; - /** * Description for the transaction to record on the account statement. */ protected $description; - /** - * Optional unique ID to associate with this withdrawal. Useful to prevent - * duplicate sends in case of failure. It supports all alphanumeric - * characters, as well as "-" and "_". - */ - protected $external_id; - /** * Message to send to the recipient. This is only relevant when sending to * an email address. */ protected $message; - - /** - * @return string - */ - public function getAddress(): string - { - if (!isset($this->address)) { - return ""; - } - return $this->address; - } /** - * @param string $address + * Optional unique ID to associate with this withdrawal. Useful to prevent + * duplicate sends in case of failure. It supports all alphanumeric + * characters, as well as "-" and "_". */ - public function setAddress(string $address) - { - $this->address = $address; - } - + protected $external_id; + /** * @return float */ @@ -105,39 +86,39 @@ public function setCurrency(string $currency) /** * @return string */ - public function getDescription(): string + public function getAddress(): string { - if (!isset($this->description)) { + if (!isset($this->address)) { return ""; } - return $this->description; + return $this->address; } /** - * @param string $description + * @param string $address */ - public function setDescription(string $description) + public function setAddress(string $address) { - $this->description = $description; + $this->address = $address; } /** * @return string */ - public function getExternalId(): string + public function getDescription(): string { - if (!isset($this->external_id)) { + if (!isset($this->description)) { return ""; } - return $this->external_id; + return $this->description; } /** - * @param string $externalId + * @param string $description */ - public function setExternalId(string $externalId) + public function setDescription(string $description) { - $this->external_id = $externalId; + $this->description = $description; } /** @@ -158,6 +139,25 @@ public function setMessage(string $message) { $this->message = $message; } + + /** + * @return string + */ + public function getExternalId(): string + { + if (!isset($this->external_id)) { + return ""; + } + return $this->external_id; + } + + /** + * @param string $externalId + */ + public function setExternalId(string $externalId) + { + $this->external_id = $externalId; + } } // vi: ft=php diff --git a/src/Luno/Request/SendLightning.php b/src/Luno/Request/SendLightning.php new file mode 100644 index 0000000..977a510 --- /dev/null +++ b/src/Luno/Request/SendLightning.php @@ -0,0 +1,106 @@ +currency)) { + return ""; + } + return $this->currency; + } + + /** + * @param string $currency + */ + public function setCurrency(string $currency) + { + $this->currency = $currency; + } + + /** + * @return string + */ + public function getPaymentRequest(): string + { + if (!isset($this->payment_request)) { + return ""; + } + return $this->payment_request; + } + + /** + * @param string $paymentRequest + */ + public function setPaymentRequest(string $paymentRequest) + { + $this->payment_request = $paymentRequest; + } + + /** + * @return string + */ + public function getDescription(): string + { + if (!isset($this->description)) { + return ""; + } + return $this->description; + } + + /** + * @param string $description + */ + public function setDescription(string $description) + { + $this->description = $description; + } + + /** + * @return string + */ + public function getExternalId(): string + { + if (!isset($this->external_id)) { + return ""; + } + return $this->external_id; + } + + /** + * @param string $externalId + */ + public function setExternalId(string $externalId) + { + $this->external_id = $externalId; + } +} + +// vi: ft=php diff --git a/src/Luno/Response/CreateAccount.php b/src/Luno/Response/CreateAccount.php index 235d042..0e9f856 100644 --- a/src/Luno/Response/CreateAccount.php +++ b/src/Luno/Response/CreateAccount.php @@ -2,60 +2,16 @@ namespace Luno\Response; -use Luno\Types\AccountBalance; -use Luno\Types\AccountCapabilities; +use Luno\Types\DetailFields; class CreateAccount extends AbstractResponse { - protected $balance; - protected $capabilities; protected $currency; - protected $icon; protected $id; - protected $is_default; protected $name; protected $pending; - protected $receive_addresses; protected $transactions; - /** - * @return AccountBalance - */ - public function getBalance(): AccountBalance - { - if (!isset($this->balance)) { - return null; - } - return $this->balance; - } - - /** - * @param AccountBalance $balance - */ - public function setBalance(AccountBalance $balance) - { - $this->balance = $balance; - } - - /** - * @return AccountCapabilities - */ - public function getCapabilities(): AccountCapabilities - { - if (!isset($this->capabilities)) { - return null; - } - return $this->capabilities; - } - - /** - * @param AccountCapabilities $capabilities - */ - public function setCapabilities(AccountCapabilities $capabilities) - { - $this->capabilities = $capabilities; - } - /** * @return string */ @@ -75,25 +31,6 @@ public function setCurrency(string $currency) $this->currency = $currency; } - /** - * @return string - */ - public function getIcon(): string - { - if (!isset($this->icon)) { - return ""; - } - return $this->icon; - } - - /** - * @param string $icon - */ - public function setIcon(string $icon) - { - $this->icon = $icon; - } - /** * @return string */ @@ -113,25 +50,6 @@ public function setId(string $id) $this->id = $id; } - /** - * @return bool - */ - public function getIsDefault(): bool - { - if (!isset($this->is_default)) { - return false; - } - return $this->is_default; - } - - /** - * @param bool $isDefault - */ - public function setIsDefault(bool $isDefault) - { - $this->is_default = $isDefault; - } - /** * @return string */ @@ -170,25 +88,6 @@ public function setPending(array $pending) $this->pending = $pending; } - /** - * @return \Luno\Types\ReceiveAddress[] - */ - public function getReceiveAddresses(): array - { - if (!isset($this->receive_addresses)) { - return []; - } - return $this->receive_addresses; - } - - /** - * @param \Luno\Types\ReceiveAddress[] $receiveAddresses - */ - public function setReceiveAddresses(array $receiveAddresses) - { - $this->receive_addresses = $receiveAddresses; - } - /** * @return \Luno\Types\Transaction[] */ diff --git a/src/Luno/Response/GetLightningReceive.php b/src/Luno/Response/GetLightningReceive.php new file mode 100644 index 0000000..3f93158 --- /dev/null +++ b/src/Luno/Response/GetLightningReceive.php @@ -0,0 +1,69 @@ +payment_request)) { + return ""; + } + return $this->payment_request; + } + + /** + * @param string $paymentRequest + */ + public function setPaymentRequest(string $paymentRequest) + { + $this->payment_request = $paymentRequest; + } + + /** + * @return float + */ + public function getSettledAmount(): float + { + if (!isset($this->settled_amount)) { + return 0; + } + return $this->settled_amount; + } + + /** + * @param float $settledAmount + */ + public function setSettledAmount(float $settledAmount) + { + $this->settled_amount = $settledAmount; + } + + /** + * @return string + */ + public function getStatus(): string + { + if (!isset($this->status)) { + return ""; + } + return $this->status; + } + + /** + * @param string $status + */ + public function setStatus(string $status) + { + $this->status = $status; + } +} + +// vi: ft=php diff --git a/src/Luno/Response/GetTicker.php b/src/Luno/Response/GetTicker.php index 5bebe54..b470e75 100644 --- a/src/Luno/Response/GetTicker.php +++ b/src/Luno/Response/GetTicker.php @@ -9,6 +9,15 @@ class GetTicker extends AbstractResponse protected $last_trade; protected $pair; protected $rolling_24_hour_volume; + + /** + * ACTIVE when the market is trading normally + * + * POSTONLY when the market has been suspended and only post-only orders will be accepted + * + * DISABLED when the market is shutdown and no orders can be accepted + */ + protected $status; protected $timestamp; /** @@ -106,6 +115,25 @@ public function setRolling24HourVolume(float $rolling24HourVolume) $this->rolling_24_hour_volume = $rolling24HourVolume; } + /** + * @return string + */ + public function getStatus(): string + { + if (!isset($this->status)) { + return ""; + } + return $this->status; + } + + /** + * @param string $status + */ + public function setStatus(string $status) + { + $this->status = $status; + } + /** * @return int */ diff --git a/src/Luno/Response/ListPendingTransactions.php b/src/Luno/Response/ListPendingTransactions.php index d83e5d7..0153b3a 100644 --- a/src/Luno/Response/ListPendingTransactions.php +++ b/src/Luno/Response/ListPendingTransactions.php @@ -2,60 +2,16 @@ namespace Luno\Response; -use Luno\Types\AccountBalance; -use Luno\Types\AccountCapabilities; +use Luno\Types\DetailFields; class ListPendingTransactions extends AbstractResponse { - protected $balance; - protected $capabilities; protected $currency; - protected $icon; protected $id; - protected $is_default; protected $name; protected $pending; - protected $receive_addresses; protected $transactions; - /** - * @return AccountBalance - */ - public function getBalance(): AccountBalance - { - if (!isset($this->balance)) { - return null; - } - return $this->balance; - } - - /** - * @param AccountBalance $balance - */ - public function setBalance(AccountBalance $balance) - { - $this->balance = $balance; - } - - /** - * @return AccountCapabilities - */ - public function getCapabilities(): AccountCapabilities - { - if (!isset($this->capabilities)) { - return null; - } - return $this->capabilities; - } - - /** - * @param AccountCapabilities $capabilities - */ - public function setCapabilities(AccountCapabilities $capabilities) - { - $this->capabilities = $capabilities; - } - /** * @return string */ @@ -75,25 +31,6 @@ public function setCurrency(string $currency) $this->currency = $currency; } - /** - * @return string - */ - public function getIcon(): string - { - if (!isset($this->icon)) { - return ""; - } - return $this->icon; - } - - /** - * @param string $icon - */ - public function setIcon(string $icon) - { - $this->icon = $icon; - } - /** * @return string */ @@ -113,25 +50,6 @@ public function setId(string $id) $this->id = $id; } - /** - * @return bool - */ - public function getIsDefault(): bool - { - if (!isset($this->is_default)) { - return false; - } - return $this->is_default; - } - - /** - * @param bool $isDefault - */ - public function setIsDefault(bool $isDefault) - { - $this->is_default = $isDefault; - } - /** * @return string */ @@ -170,25 +88,6 @@ public function setPending(array $pending) $this->pending = $pending; } - /** - * @return \Luno\Types\ReceiveAddress[] - */ - public function getReceiveAddresses(): array - { - if (!isset($this->receive_addresses)) { - return []; - } - return $this->receive_addresses; - } - - /** - * @param \Luno\Types\ReceiveAddress[] $receiveAddresses - */ - public function setReceiveAddresses(array $receiveAddresses) - { - $this->receive_addresses = $receiveAddresses; - } - /** * @return \Luno\Types\Transaction[] */ diff --git a/src/Luno/Response/ListTransactions.php b/src/Luno/Response/ListTransactions.php index 582405c..69eb8b2 100644 --- a/src/Luno/Response/ListTransactions.php +++ b/src/Luno/Response/ListTransactions.php @@ -2,60 +2,16 @@ namespace Luno\Response; -use Luno\Types\AccountBalance; -use Luno\Types\AccountCapabilities; +use Luno\Types\DetailFields; class ListTransactions extends AbstractResponse { - protected $balance; - protected $capabilities; protected $currency; - protected $icon; protected $id; - protected $is_default; protected $name; protected $pending; - protected $receive_addresses; protected $transactions; - /** - * @return AccountBalance - */ - public function getBalance(): AccountBalance - { - if (!isset($this->balance)) { - return null; - } - return $this->balance; - } - - /** - * @param AccountBalance $balance - */ - public function setBalance(AccountBalance $balance) - { - $this->balance = $balance; - } - - /** - * @return AccountCapabilities - */ - public function getCapabilities(): AccountCapabilities - { - if (!isset($this->capabilities)) { - return null; - } - return $this->capabilities; - } - - /** - * @param AccountCapabilities $capabilities - */ - public function setCapabilities(AccountCapabilities $capabilities) - { - $this->capabilities = $capabilities; - } - /** * @return string */ @@ -75,25 +31,6 @@ public function setCurrency(string $currency) $this->currency = $currency; } - /** - * @return string - */ - public function getIcon(): string - { - if (!isset($this->icon)) { - return ""; - } - return $this->icon; - } - - /** - * @param string $icon - */ - public function setIcon(string $icon) - { - $this->icon = $icon; - } - /** * @return string */ @@ -113,25 +50,6 @@ public function setId(string $id) $this->id = $id; } - /** - * @return bool - */ - public function getIsDefault(): bool - { - if (!isset($this->is_default)) { - return false; - } - return $this->is_default; - } - - /** - * @param bool $isDefault - */ - public function setIsDefault(bool $isDefault) - { - $this->is_default = $isDefault; - } - /** * @return string */ @@ -170,25 +88,6 @@ public function setPending(array $pending) $this->pending = $pending; } - /** - * @return \Luno\Types\ReceiveAddress[] - */ - public function getReceiveAddresses(): array - { - if (!isset($this->receive_addresses)) { - return []; - } - return $this->receive_addresses; - } - - /** - * @param \Luno\Types\ReceiveAddress[] $receiveAddresses - */ - public function setReceiveAddresses(array $receiveAddresses) - { - $this->receive_addresses = $receiveAddresses; - } - /** * @return \Luno\Types\Transaction[] */ diff --git a/src/Luno/Response/ReceiveLightning.php b/src/Luno/Response/ReceiveLightning.php new file mode 100644 index 0000000..6f6299b --- /dev/null +++ b/src/Luno/Response/ReceiveLightning.php @@ -0,0 +1,49 @@ +invoice_id)) { + return ""; + } + return $this->invoice_id; + } + + /** + * @param string $invoiceId + */ + public function setInvoiceId(string $invoiceId) + { + $this->invoice_id = $invoiceId; + } + + /** + * @return string + */ + public function getPaymentRequest(): string + { + if (!isset($this->payment_request)) { + return ""; + } + return $this->payment_request; + } + + /** + * @param string $paymentRequest + */ + public function setPaymentRequest(string $paymentRequest) + { + $this->payment_request = $paymentRequest; + } +} + +// vi: ft=php diff --git a/src/Luno/Response/SendLightning.php b/src/Luno/Response/SendLightning.php new file mode 100644 index 0000000..db9c4d9 --- /dev/null +++ b/src/Luno/Response/SendLightning.php @@ -0,0 +1,49 @@ +status)) { + return ""; + } + return $this->status; + } + + /** + * @param string $status + */ + public function setStatus(string $status) + { + $this->status = $status; + } + + /** + * @return string + */ + public function getWithdrawalId(): string + { + if (!isset($this->withdrawal_id)) { + return ""; + } + return $this->withdrawal_id; + } + + /** + * @param string $withdrawalId + */ + public function setWithdrawalId(string $withdrawalId) + { + $this->withdrawal_id = $withdrawalId; + } +} + +// vi: ft=php diff --git a/src/Luno/Types/CryptoDetails.php b/src/Luno/Types/CryptoDetails.php new file mode 100644 index 0000000..9f2a640 --- /dev/null +++ b/src/Luno/Types/CryptoDetails.php @@ -0,0 +1,50 @@ +address)) { + return ""; + } + return $this->address; + } + + /** + * @param string $address + */ + public function setAddress(string $address) + { + $this->address = $address; + } + + /** + * @return string + */ + public function getTxid(): string + { + if (!isset($this->txid)) { + return ""; + } + return $this->txid; + } + + /** + * @param string $txid + */ + public function setTxid(string $txid) + { + $this->txid = $txid; + } + +} + +// vi: ft=php diff --git a/src/Luno/Types/DetailFields.php b/src/Luno/Types/DetailFields.php new file mode 100644 index 0000000..83afd62 --- /dev/null +++ b/src/Luno/Types/DetailFields.php @@ -0,0 +1,30 @@ +crypto_details)) { + return null; + } + return $this->crypto_details; + } + + /** + * @param CryptoDetails $cryptoDetails + */ + public function setCryptoDetails(CryptoDetails $cryptoDetails) + { + $this->crypto_details = $cryptoDetails; + } + +} + +// vi: ft=php diff --git a/src/Luno/Types/Status.php b/src/Luno/Types/Status.php new file mode 100644 index 0000000..3b2120f --- /dev/null +++ b/src/Luno/Types/Status.php @@ -0,0 +1,12 @@ +ACTIVE when the market is trading normally + * + * POSTONLY when the market has been suspended and only post-only orders will be accepted + * + * DISABLED when the market is shutdown and no orders can be accepted + */ + protected $status; protected $timestamp; /** @@ -106,6 +115,25 @@ public function setRolling24HourVolume(float $rolling24HourVolume) $this->rolling_24_hour_volume = $rolling24HourVolume; } + /** + * @return string + */ + public function getStatus(): string + { + if (!isset($this->status)) { + return ""; + } + return $this->status; + } + + /** + * @param string $status + */ + public function setStatus(string $status) + { + $this->status = $status; + } + /** * @return int */ diff --git a/src/Luno/Types/Transaction.php b/src/Luno/Types/Transaction.php index 4bd7ff8..e84379a 100644 --- a/src/Luno/Types/Transaction.php +++ b/src/Luno/Types/Transaction.php @@ -19,6 +19,7 @@ class Transaction * Human-readable description of the transaction. */ protected $description; + protected $detail_fields; /** * Human-readable label-value attributes. @@ -160,6 +161,25 @@ public function setDescription(string $description) $this->description = $description; } + /** + * @return DetailFields + */ + public function getDetailFields(): DetailFields + { + if (!isset($this->detail_fields)) { + return null; + } + return $this->detail_fields; + } + + /** + * @param DetailFields $detailFields + */ + public function setDetailFields(DetailFields $detailFields) + { + $this->detail_fields = $detailFields; + } + /** * @return array */ diff --git a/src/Luno/Types/beneficiary.php b/src/Luno/Types/beneficiary.php new file mode 100644 index 0000000..8d76e64 --- /dev/null +++ b/src/Luno/Types/beneficiary.php @@ -0,0 +1,170 @@ +bank_account_branch)) { + return ""; + } + return $this->bank_account_branch; + } + + /** + * @param string $bankAccountBranch + */ + public function setBankAccountBranch(string $bankAccountBranch) + { + $this->bank_account_branch = $bankAccountBranch; + } + + /** + * @return string + */ + public function getBankAccountNumber(): string + { + if (!isset($this->bank_account_number)) { + return ""; + } + return $this->bank_account_number; + } + + /** + * @param string $bankAccountNumber + */ + public function setBankAccountNumber(string $bankAccountNumber) + { + $this->bank_account_number = $bankAccountNumber; + } + + /** + * @return string + */ + public function getBankAccountType(): string + { + if (!isset($this->bank_account_type)) { + return ""; + } + return $this->bank_account_type; + } + + /** + * @param string $bankAccountType + */ + public function setBankAccountType(string $bankAccountType) + { + $this->bank_account_type = $bankAccountType; + } + + /** + * @return string + */ + public function getBankCountry(): string + { + if (!isset($this->bank_country)) { + return ""; + } + return $this->bank_country; + } + + /** + * @param string $bankCountry + */ + public function setBankCountry(string $bankCountry) + { + $this->bank_country = $bankCountry; + } + + /** + * @return string + */ + public function getBankName(): string + { + if (!isset($this->bank_name)) { + return ""; + } + return $this->bank_name; + } + + /** + * @param string $bankName + */ + public function setBankName(string $bankName) + { + $this->bank_name = $bankName; + } + + /** + * @return string + */ + public function getBankRecipient(): string + { + if (!isset($this->bank_recipient)) { + return ""; + } + return $this->bank_recipient; + } + + /** + * @param string $bankRecipient + */ + public function setBankRecipient(string $bankRecipient) + { + $this->bank_recipient = $bankRecipient; + } + + /** + * @return int + */ + public function getCreatedAt(): int + { + if (!isset($this->created_at)) { + return 0; + } + return $this->created_at; + } + + /** + * @param int $createdAt + */ + public function setCreatedAt(int $createdAt) + { + $this->created_at = $createdAt; + } + + /** + * @return string + */ + public function getId(): string + { + if (!isset($this->id)) { + return ""; + } + return $this->id; + } + + /** + * @param string $id + */ + public function setId(string $id) + { + $this->id = $id; + } + +} + +// vi: ft=php