Skip to content

Commit c43f685

Browse files
authored
Add new address validate api using updated sdkgen (#34)
1 parent b536edb commit c43f685

17 files changed

+782
-50
lines changed

src/Luno/Client.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ public function GetFeeInfo(Request\GetFeeInfo $req): Response\GetFeeInfo
110110
*
111111
* Returns the default receive address associated with your account and the
112112
* amount received via the address. Users can specify an optional address parameter to return information for a non-default receive address.
113-
*
114113
* In the response, <code>total_received</code> is the total confirmed amount received excluding unconfirmed transactions.
115114
* <code>total_unconfirmed</code> is the total sum of unconfirmed receive transactions.
116115
*
@@ -461,7 +460,7 @@ public function Markets(Request\Markets $req): Response\Markets
461460
/**
462461
* Move makes a call to POST /api/exchange/1/move.
463462
*
464-
* Move funds between two of your accounts with the same currency
463+
* Move funds between two of your transactional accounts with the same currency
465464
* The funds may not be moved by the time the request returns. The GET method
466465
* can be used to poll for the move's status.
467466
*
@@ -523,7 +522,7 @@ public function PostMarketOrder(Request\PostMarketOrder $req): Response\PostMark
523522
*
524523
* Send assets from an Account. Please note that the asset type sent must match the receive address of the same cryptocurrency of the same type - Bitcoin to Bitcoin, Ethereum to Ethereum, etc.
525524
*
526-
* Sends can be to a cryptocurrency receive address, or the email address of another Luno platform user.
525+
* Sends can be made to cryptocurrency receive addresses.
527526
*
528527
* <b>Note:</b> This is currently unavailable to users who are verified in countries with money travel rules.
529528
*
@@ -582,6 +581,21 @@ public function UpdateAccountName(Request\UpdateAccountName $req): Response\Upda
582581
$mapper = new \JsonMapper();
583582
return $mapper->map($res, new Response\UpdateAccountName);
584583
}
584+
585+
/**
586+
* Validate makes a call to POST /api/1/address/validate.
587+
*
588+
* Validate receive addresses, to which a customer wishes to make cryptocurrency sends, are verified under covering
589+
* regulatory requirements for the customer such as travel rules.
590+
*
591+
* Permissions required: <code>Perm_W_Send</code>
592+
*/
593+
public function Validate(Request\Validate $req): Response\Validate
594+
{
595+
$res = $this->do("POST", "/api/1/address/validate", $req, true);
596+
$mapper = new \JsonMapper();
597+
return $mapper->map($res, new Response\Validate);
598+
}
585599
}
586600

587601
// vi: ft=php

src/Luno/Request/CreateWithdrawal.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class CreateWithdrawal extends AbstractRequest
3838

3939
/**
4040
* For internal use.
41+
* Deprecated: We don't allow custom references and will remove this soon.
4142
*/
4243
protected $reference;
4344

src/Luno/Request/Markets.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@
44

55
class Markets extends AbstractRequest
66
{
7+
/**
8+
* List of market pairs to return. Requesting only the required pairs will improve response times.
9+
*/
10+
protected $pair;
11+
12+
/**
13+
* @return \Luno\Types\string[]
14+
*/
15+
public function getPair(): array
16+
{
17+
if (!isset($this->pair)) {
18+
return [];
19+
}
20+
return $this->pair;
721
}
822

23+
/**
24+
* @param \Luno\Types\string[] $pair
25+
*/
26+
public function setPair(array $pair)
27+
{
28+
$this->pair = $pair;
29+
}
30+
}
31+
932
// vi: ft=php

src/Luno/Request/PostLimitOrder.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ class PostLimitOrder extends AbstractRequest
7171
*/
7272
protected $stop_price;
7373

74+
/**
75+
* <code>GTC</code> Good 'Til Cancelled. The order remains open until it is filled or cancelled by the user.</br>
76+
* <code>IOC</code> Immediate Or Cancel. The part of the order that cannot be filled immediately will be cancelled. Cannot be post-only.</br>
77+
* <code>FOK</code> Fill Or Kill. If the order cannot be filled immediately and completely it will be cancelled before any trade. Cannot be post-only.
78+
*/
79+
protected $time_in_force;
80+
7481
/**
7582
* Unix timestamp in milliseconds of when the request was created and sent.
7683
*/
@@ -272,6 +279,25 @@ public function setStopPrice(float $stopPrice)
272279
$this->stop_price = $stopPrice;
273280
}
274281

282+
/**
283+
* @return string
284+
*/
285+
public function getTimeInForce(): string
286+
{
287+
if (!isset($this->time_in_force)) {
288+
return "";
289+
}
290+
return $this->time_in_force;
291+
}
292+
293+
/**
294+
* @param string $timeInForce
295+
*/
296+
public function setTimeInForce(string $timeInForce)
297+
{
298+
$this->time_in_force = $timeInForce;
299+
}
300+
275301
/**
276302
* @return int
277303
*/

src/Luno/Request/Send.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,26 @@ class Send extends AbstractRequest
4343
*/
4444
protected $external_id;
4545

46+
/**
47+
* Only required for Foreign Exchange Notification under the Malaysia FEN rules. ForexNoticeSelfDeclaration must be true if the user has exceeded his/her annual investment limit in foreign currency assets.
48+
*/
49+
protected $forex_notice_self_declaration;
50+
4651
/**
4752
* Optional boolean flag indicating that a XRP destination tag is provided (even if zero).
4853
*/
4954
protected $has_destination_tag;
5055

56+
/**
57+
* Only required for Foreign Exchange Notification under the Malaysia FEN rules. IsDRB must be true if the user has Domestic Ringgit Borrowing (DRB).
58+
*/
59+
protected $is_drb;
60+
61+
/**
62+
* Only required for Foreign Exchange Notification under the Malaysia FEN rules. IsForexSend must be true if sending to an address hosted outside of Malaysia.
63+
*/
64+
protected $is_forex_send;
65+
5166
/**
5267
* Message to send to the recipient.
5368
* This is only relevant when sending to an email address.
@@ -168,6 +183,25 @@ public function setExternalId(string $externalId)
168183
$this->external_id = $externalId;
169184
}
170185

186+
/**
187+
* @return bool
188+
*/
189+
public function getForexNoticeSelfDeclaration(): bool
190+
{
191+
if (!isset($this->forex_notice_self_declaration)) {
192+
return false;
193+
}
194+
return $this->forex_notice_self_declaration;
195+
}
196+
197+
/**
198+
* @param bool $forexNoticeSelfDeclaration
199+
*/
200+
public function setForexNoticeSelfDeclaration(bool $forexNoticeSelfDeclaration)
201+
{
202+
$this->forex_notice_self_declaration = $forexNoticeSelfDeclaration;
203+
}
204+
171205
/**
172206
* @return bool
173207
*/
@@ -187,6 +221,44 @@ public function setHasDestinationTag(bool $hasDestinationTag)
187221
$this->has_destination_tag = $hasDestinationTag;
188222
}
189223

224+
/**
225+
* @return bool
226+
*/
227+
public function getIsDrb(): bool
228+
{
229+
if (!isset($this->is_drb)) {
230+
return false;
231+
}
232+
return $this->is_drb;
233+
}
234+
235+
/**
236+
* @param bool $isDrb
237+
*/
238+
public function setIsDrb(bool $isDrb)
239+
{
240+
$this->is_drb = $isDrb;
241+
}
242+
243+
/**
244+
* @return bool
245+
*/
246+
public function getIsForexSend(): bool
247+
{
248+
if (!isset($this->is_forex_send)) {
249+
return false;
250+
}
251+
return $this->is_forex_send;
252+
}
253+
254+
/**
255+
* @param bool $isForexSend
256+
*/
257+
public function setIsForexSend(bool $isForexSend)
258+
{
259+
$this->is_forex_send = $isForexSend;
260+
}
261+
190262
/**
191263
* @return string
192264
*/

0 commit comments

Comments
 (0)