/**
  * @test
  */
 public function canFindWithSomeValues()
 {
     $data = '{"payments":[{"id":"543477161-91de-012f-e284-1e0030c7f3123","short_reference":"140416-GGJBNQ001","beneficiary_id":"543477161-91de-012f-e284-1e0030c7f352","conversion_id":"049bab6d-fe2a-42e1-be0f-531c59f838ea","amount":"1250000.00","currency":"GBP","status":"ready_to_send","payment_type":"regular","reference":"INVOICE 9876","reason":"Salary for March","payment_date":"2014-01-12T00:00:00+00:00","payer_details_source":"","transferred_at":"2014-01-12T13:00:00+00:00","authorisation_steps_required":"0","creator_contact_id":"ab3477161-91de-012f-e284-1e0030c7f35c","last_updater_contact_id":"ab3477161-91de-012f-e284-1e0030c7f35c","failure_reason":"","payer_id":"","created_at":"2014-01-12T12:24:19+00:00","updated_at":"2014-01-12T12:24:19+00:00"}],"pagination":{"total_entries":1,"total_pages":1,"current_page":1,"previous_page":-1,"next_page":-1,"per_page":25,"order":"created_at","order_asc_desc":"asc"}}';
     $payment = new Payment();
     $payment->setCurrency('A')->setAmount('B')->setReason('C')->setBeneficiaryId('D')->setConversionId('E')->setShortReference('F')->setStatus('G');
     /* @var DateTime[] $dateTime */
     $dateTime = [new DateTime(), (new DateTime())->modify('-1 hour'), (new DateTime())->modify('-2 hour'), (new DateTime())->modify('-3 hour'), (new DateTime())->modify('-4 hour'), (new DateTime())->modify('-5 hour'), (new DateTime())->modify('-6 hour'), (new DateTime())->modify('-7 hour')];
     $criteria = new FindPaymentsCriteria();
     $criteria->setCreatedAtFrom($dateTime[0])->setCreatedAtTo($dateTime[1])->setUpdatedAtFrom($dateTime[2])->setUpdatedAtTo($dateTime[3])->setPaymentDateFrom($dateTime[4])->setPaymentDateTo($dateTime[5])->setTransferredAtFrom($dateTime[6])->setTransferredAtTo($dateTime[7])->setAmountFrom('H')->setAmountTo('I');
     $entryPoint = new PaymentsEntryPoint(new SimpleEntityManager(), $this->getMockedClient(json_decode($data), 'GET', 'payments/find', ['currency' => 'A', 'amount' => 'B', 'reason' => 'C', 'beneficiary_id' => 'D', 'conversion_id' => 'E', 'short_reference' => 'F', 'status' => 'G', 'created_at_from' => $dateTime[0]->format(DateTime::RFC3339), 'created_at_to' => $dateTime[1]->format(DateTime::RFC3339), 'updated_at_from' => $dateTime[2]->format(DateTime::RFC3339), 'updated_at_to' => $dateTime[3]->format(DateTime::RFC3339), 'payment_date_from' => $dateTime[4]->format(DateTime::RFC3339), 'payment_date_to' => $dateTime[5]->format(DateTime::RFC3339), 'transferred_at_from' => $dateTime[6]->format(DateTime::RFC3339), 'transferred_at_to' => $dateTime[7]->format(DateTime::RFC3339), 'amount_from' => 'H', 'amount_to' => 'I', 'on_behalf_of' => 'J', 'page' => null, 'per_page' => null, 'order' => null, 'order_asc_desc' => null]));
     $payments = $entryPoint->find($payment, $criteria, null, 'J');
     $this->assertInstanceOf(Payments::class, $payments);
     $list = $payments->getPayments();
     $this->assertArrayHasKey(0, $list);
     $this->assertCount(1, $list);
     $this->validateObjectStrictName($list[0], json_decode($data, true)['payments'][0]);
 }
 /**
  * @param FindPaymentsCriteria $criteria
  *
  * @return array
  */
 private function convertFindPaymentsCriteriaToRequest(FindPaymentsCriteria $criteria = null)
 {
     $createdAtFrom = $criteria->getCreatedAtFrom();
     $createdAtTo = $criteria->getCreatedAtTo();
     $updatedAtFrom = $criteria->getUpdatedAtFrom();
     $updatedAtTo = $criteria->getUpdatedAtTo();
     $paymentDateFrom = $criteria->getPaymentDateFrom();
     $paymentDateTo = $criteria->getPaymentDateTo();
     $transferredAtFrom = $criteria->getTransferredAtFrom();
     $transferredAtTo = $criteria->getTransferredAtTo();
     return ['created_at_from' => null === $createdAtFrom ? null : $createdAtFrom->format(DateTime::RFC3339), 'created_at_to' => null === $createdAtTo ? null : $createdAtTo->format(DateTime::RFC3339), 'updated_at_from' => null === $updatedAtFrom ? null : $updatedAtFrom->format(DateTime::RFC3339), 'updated_at_to' => null === $updatedAtTo ? null : $updatedAtTo->format(DateTime::RFC3339), 'payment_date_from' => null === $paymentDateFrom ? null : $paymentDateFrom->format(DateTime::RFC3339), 'payment_date_to' => null === $paymentDateTo ? null : $paymentDateTo->format(DateTime::RFC3339), 'transferred_at_from' => null === $transferredAtFrom ? null : $transferredAtFrom->format(DateTime::RFC3339), 'transferred_at_to' => null === $transferredAtTo ? null : $transferredAtTo->format(DateTime::RFC3339), 'amount_from' => $criteria->getAmountFrom(), 'amount_to' => $criteria->getAmountTo()];
 }