Ejemplo n.º 1
0
 function test_KycDocuments_GetAll_SortByCreationDate()
 {
     $this->getJohnsKycDocument();
     $pagination = new \MangoPay\Pagination(1, 20);
     $sorting = new \MangoPay\Sorting();
     $sorting->AddField("CreationDate", \MangoPay\SortDirection::DESC);
     $list = $this->_api->KycDocuments->GetAll($pagination, $sorting);
     $this->assertTrue($list[0]->Id > $list[1]->Id);
 }
Ejemplo n.º 2
0
$subEntityId = (int) @$_POST['IdSubEntity'];
if (isset($_POST['_postback']) && $_POST['_postback'] == '1') {
    try {
        $api = new \MangoPay\MangoPayApi();
        $api->Config->ClientId = MangoPayDemo_ClientId;
        $api->Config->ClientPassword = MangoPayDemo_ClientPassword;
        $api->Config->TemporaryFolder = MangoPayDemo_TemporaryFolder;
        $module = @$_GET['module'];
        if (isset($module) && strpos($module, '$Sort') !== false) {
            if (isset($_POST["_sort_"]) && !empty($_POST["_sort_"])) {
                $sortFieldName = $_POST["_sort_"];
                $sortDirection = $_POST["_sort_direction_"];
                if (!isset($sortDirection)) {
                    $sortDirection = \MangoPay\SortDirection::ASC;
                }
                $sorting = new \MangoPay\Sorting();
                $sorting->AddField($sortFieldName, $sortDirection);
            }
        }
        // normal cases
        switch ($operation) {
            case 'Create':
                $entity = HtmlHelper::getEntity($entityName);
                $apiResult = $api->{$subApiName}->Create($entity);
                break;
            case 'Get':
                $apiResult = $api->{$subApiName}->Get($entityId);
                break;
            case 'Save':
                $entity = HtmlHelper::getEntity($entityName, $entityId);
                $apiResult = $api->{$subApiName}->Update($entity);
Ejemplo n.º 3
-1
 function test_Events_GetAll_SortByCreationDate()
 {
     self::$JohnsPayInCardWeb = null;
     $payIn1 = $this->getJohnsPayInCardWeb();
     self::$JohnsPayInCardWeb = null;
     $payIn2 = $this->getJohnsPayInCardWeb();
     $filter = new \MangoPay\FilterEvents();
     $filter->BeforeDate = $payIn2->CreationDate + 10;
     $filter->AfterDate = $payIn1->CreationDate - 10;
     $filter->EventType = \MangoPay\EventType::PayinNormalCreated;
     $sorting = new \MangoPay\Sorting();
     $sorting->AddField("Date", \MangoPay\SortDirection::DESC);
     $pagination = new \MangoPay\Pagination();
     $result = $this->_api->Events->GetAll($pagination, $filter, $sorting);
     $this->assertTrue($result[0]->Date > $result[1]->Date);
 }
Ejemplo n.º 4
-1
 function test_Wallets_Transactions_SortByCreationDate()
 {
     $wallet = $this->getJohnsWallet();
     // create 2 pay-in objects
     self::$JohnsPayInCardWeb = null;
     $this->getJohnsPayInCardWeb();
     self::$JohnsPayInCardWeb = null;
     $this->getJohnsPayInCardWeb();
     $sorting = new \MangoPay\Sorting();
     $sorting->AddField("CreationDate", \MangoPay\SortDirection::DESC);
     $pagination = new \MangoPay\Pagination(1, 20);
     $filter = new \MangoPay\FilterTransactions();
     $filter->Type = 'PAYIN';
     $transactions = $this->_api->Wallets->GetTransactions($wallet->Id, $pagination, $filter, $sorting);
     $this->assertTrue($transactions[0]->CreationDate > $transactions[1]->CreationDate);
 }
Ejemplo n.º 5
-1
 function test_Users_AllWallets_SortByCreationDate()
 {
     $john = $this->getJohn();
     $this->getJohnsWallet();
     self::$JohnsWallet = null;
     $this->getJohnsWallet();
     $pagination = new \MangoPay\Pagination(1, 20);
     $sorting = new \MangoPay\Sorting();
     $sorting->AddField("CreationDate", \MangoPay\SortDirection::DESC);
     $wallets = $this->_api->Users->GetWallets($john->Id, $pagination, $sorting);
     $this->assertTrue($wallets[0]->CreationDate > $wallets[1]->CreationDate);
 }