-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #635 from Mangopay/feature/conversions
Conversions
- Loading branch information
Showing
11 changed files
with
425 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
namespace MangoPay; | ||
|
||
/** | ||
* Class to management MangoPay API for instant conversions | ||
*/ | ||
class ApiConversions extends Libraries\ApiBase | ||
{ | ||
/** | ||
* This endpoint allows the platform to get a real | ||
* time indicative market rate of a specific currency pair. | ||
* The rate returned is given in real time. | ||
* @param string $debitedCurrency The sell currency – the currency of the wallet to be debited | ||
* @param string $creditedCurrency The buy currency – the currency of the wallet to be credited. | ||
* @return \MangoPay\ConversionRate object returned from API | ||
*/ | ||
public function GetConversionRate($debitedCurrency, $creditedCurrency) | ||
{ | ||
return $this->GetObject('get_conversion_rate', '\MangoPay\ConversionRate', $debitedCurrency, $creditedCurrency); | ||
} | ||
|
||
/** | ||
* This endpoint allows the platform to move funds between two | ||
* wallets of different currencies instantaneously. | ||
* @param CreateInstantConversion $instantConversion | ||
* @return \MangoPay\Conversion object returned from API | ||
*/ | ||
public function CreateInstantConversion($instantConversion) | ||
{ | ||
return $this->CreateObject('create_instant_conversion', $instantConversion, '\MangoPay\Conversion'); | ||
} | ||
|
||
/** | ||
* This call triggers a conversion, at the rate guaranteed by its quote, of the debited funds to the credited wallet. | ||
* | ||
* @param CreateQuotedConversion $quotedConversion | ||
* @return Conversion | ||
*/ | ||
public function CreateQuotedConversion($quotedConversion) | ||
{ | ||
return $this->CreateObject('create_quoted_conversion', $quotedConversion, '\MangoPay\Conversion'); | ||
} | ||
|
||
/** | ||
* This endpoint allows the platform to get | ||
* the details of a conversion which has been carried out. | ||
* @param string $id The unique identifier of the conversion. | ||
* @return \MangoPay\Conversion object returned from API | ||
*/ | ||
public function GetConversion($id) | ||
{ | ||
return $this->GetObject('get_conversion', '\MangoPay\Conversion', $id); | ||
} | ||
|
||
/** | ||
* This call guarantees a conversion rate to let you Create a Quoted Conversion. | ||
* @param ConversionQuote $quote | ||
* @return ConversionQuote | ||
*/ | ||
public function CreateConversionQuote($quote) | ||
{ | ||
return $this->CreateObject('create_conversion_quote', $quote, '\MangoPay\ConversionQuote'); | ||
} | ||
|
||
/** | ||
* This endpoint allows the platform to get the details of a quote | ||
* @param string $quoteId | ||
* @return ConversionQuote | ||
*/ | ||
public function GetConversionQuote($quoteId) | ||
{ | ||
return $this->GetObject('get_conversion_quote', '\MangoPay\ConversionQuote', $quoteId); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace MangoPay; | ||
|
||
use MangoPay\Libraries\EntityBase; | ||
|
||
class ConversionQuote extends EntityBase | ||
{ | ||
/** | ||
* Expiration date | ||
* @var int | ||
*/ | ||
public $ExpirationDate; | ||
|
||
/** | ||
* @var string | ||
* @see \MangoPay\TransactionStatus | ||
*/ | ||
public $Status; | ||
|
||
/** | ||
* The time in seconds during which the quote is active and can be used for conversions. | ||
* @var int | ||
*/ | ||
public $Duration; | ||
|
||
/** | ||
* Debited funds | ||
* @var \MangoPay\Money | ||
*/ | ||
public $DebitedFunds; | ||
|
||
/** | ||
* Credited funds | ||
* @var \MangoPay\Money | ||
*/ | ||
public $CreditedFunds; | ||
|
||
/** | ||
* @var ConversionRate | ||
*/ | ||
var $ConversionRateResponse; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace MangoPay; | ||
|
||
use MangoPay\Libraries\Dto; | ||
|
||
class CreateInstantConversion extends Dto | ||
{ | ||
|
||
/** | ||
* The unique identifier of the user at the source of the transaction. | ||
* @var string | ||
*/ | ||
var $AuthorId; | ||
|
||
/** | ||
* The unique identifier of the debited wallet | ||
* | ||
* @var string | ||
*/ | ||
var $DebitedWalletId; | ||
|
||
/** | ||
* The unique identifier of the credited wallet | ||
* @var string | ||
*/ | ||
var $CreditedWalletId; | ||
|
||
/** | ||
* The sell funds | ||
* @var Money | ||
*/ | ||
var $DebitedFunds; | ||
|
||
/** | ||
* The buy funds | ||
* @var Money | ||
*/ | ||
var $CreditedFunds; | ||
|
||
/** | ||
* Information about the fees taken by the platform for this transaction (and hence transferred to the Fees Wallet). | ||
* @var Money | ||
*/ | ||
var $Fees; | ||
|
||
/** | ||
* Custom data. | ||
* @var string | ||
*/ | ||
var $Tag; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace MangoPay; | ||
|
||
use MangoPay\Libraries\Dto; | ||
|
||
/** | ||
* A conversion, at the rate guaranteed by its quote, of the debited funds to the credited wallet. | ||
*/ | ||
class CreateQuotedConversion extends Dto | ||
{ | ||
|
||
/** | ||
* The unique identifier of the active quote which guaranteed the rate for the conversion. | ||
* @var string | ||
*/ | ||
var $QuoteId; | ||
|
||
/** | ||
* The unique identifier of the user at the source of the transaction. | ||
* @var string | ||
*/ | ||
var $AuthorId; | ||
|
||
/** | ||
* The unique identifier of the debited wallet. | ||
* @var string | ||
*/ | ||
var $DebitedWalletId; | ||
|
||
/** | ||
* The unique identifier of the credited wallet | ||
* @var string | ||
*/ | ||
var $CreditedWalletId; | ||
|
||
/** | ||
* Custom data. | ||
* @var string | ||
*/ | ||
var $Tag; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.