예제 #1
0
 function Retrieve_WhenSuppliedWithValidCharityId_RetrievesCharity($client)
 {
     echo "<hr />";
     echo "<b>Retrieve_WhenSuppliedWithValidCharityId_RetrievesCharity</b><br/><br/>";
     $response = $client->Charity->Retrieve(2050);
     WriteLine("Charity Name: " . $response->name);
 }
 function RetrieveEvent_IssuedWithKnownId_ReturnsEvent($client)
 {
     echo "<hr />";
     echo "<b>RetrieveEvent_IssuedWithKnownId_ReturnsEvent</b><br/><br/>";
     $response = $client->Event->Retrieve(479546);
     WriteLine("Event name: " . $response->name);
     WriteLine("Event description: " . $response->description);
     WriteLine("Event startDate: " . $response->startDate);
 }
 function GetValidCurrencies_ReturnCurrencies($client)
 {
     echo "<hr />";
     echo "<b>GetValidCurrencies_ReturnCurrencies</b><br/><br/>";
     $response = $client->Currency->ValidCurrencies();
     if ($response) {
         WriteLine("TEST PASSED");
     } else {
         WriteLine("TEST FAILED");
     }
 }
예제 #4
0
 function IsEmailRegistered_WhenSuppliedKnownEmail_ReturnsTrue($client, $knownEmail)
 {
     echo "<hr />";
     echo "<b>IsEmailRegistered_WhenSuppliedKnownEmail_ReturnsTrue</b><br/><br/>";
     $booleanResponse = $client->Account->IsEmailRegistered($knownEmail);
     if ($booleanResponse) {
         WriteLine("Email address listed as registered - TEST PASSED");
     } else {
         WriteLine("Email address listed as available - TEST FAILED");
     }
 }
 function RetrieveStatus_WhenSuppliedWithKnownExistingDonationId_ReturnsDonationStatus($client)
 {
     echo "<hr />";
     echo "<b>RetrieveStatus_WhenSuppliedWithKnownExistingDonationId_ReturnsDonationStatus</b><br/><br/>";
     $response = $client->Donation->RetrieveStatus(21303723);
     WriteLine("Donation ref: " . $response->ref);
     WriteLine("Donation donationId: " . $response->donationId);
     WriteLine("Donation donationRef: " . $response->donationRef);
     WriteLine("Donation status: " . $response->status);
     WriteLine("Donation amount: " . $response->amount);
 }
 function GetCountries_ReturnCountries($client)
 {
     echo "<hr />";
     echo "<b>GetCountries_ReturnCountries</b><br/><br/>";
     $response = $client->Countries->Countries();
     if ($response) {
         WriteLine("TEST PASSED");
     } else {
         WriteLine("TEST FAILED");
     }
 }
 function GetCategories_ReturnCategories($client)
 {
     echo "<hr />";
     echo "<b>GetCategories_ReturnCategories</b><br/>";
     $response = $client->Charity->Categories();
     if ($response != null) {
         WriteLine("TEST PASSED");
     } else {
         WriteLine("TEST FAILED");
     }
 }
예제 #8
0
 function IsAccountValid_WhenSuppliedKnownEmailAndPassword_ReturnsInValid($client, $knownEmail, $knownPassword)
 {
     echo "<hr />";
     echo "<b>IsAccountValid_WhenSuppliedKnownEmailAndPassword_ReturnsInValid</b><br /><br />";
     $request = new ValidateAccountRequest();
     $request->email = $knownEmail;
     $request->password = $knownPassword;
     $response = $client->Account->IsValid($request);
     if ($response->customerId == 0 && $response->IsValid == 0) {
         WriteLine("Account credentials are incorrect or accound doesn't exist - TEST PASSED");
     } else {
         WriteLine("Account credentials are correct - TEST FAILED");
     }
 }
예제 #9
0
 function UploadImage_ForKnownPageWithValidCredentials_UploadsImageWithExpectedCaption($client)
 {
     echo "<hr />";
     echo "<b>UpdatePageStory_ForKnownPageWithValidCredentials_UpdatesStory</b><br/><br/>";
     $dto = new RegisterPageRequest();
     $dto->reference = "12345";
     $dto->pageShortName = "api-test-" . uniqid();
     $dto->activityType = "OtherCelebration";
     $dto->pageTitle = "api test";
     $dto->eventName = "The Other Occasion of ApTest and APITest";
     $dto->charityId = 2050;
     $dto->targetAmount = 20;
     $dto->eventDate = "/Date(1235764800000)/";
     $dto->justGivingOptIn = true;
     $dto->charityOptIn = true;
     $dto->charityFunded = false;
     $page = $client->Page->Create($dto);
     // Act
     $caption = "PHP Image Caption - " . uniqid();
     $filename = "jpg.jpg";
     $imageContentType = "image/jpeg";
     $booleanResponse = $client->Page->UploadImage($dto->pageShortName, $caption, $filename, $imageContentType);
     if ($booleanResponse) {
         WriteLine("Image updated for " . $dto->pageShortName);
     } else {
         WriteLine("Image update failed for " . $dto->pageShortName);
     }
 }
예제 #10
0
 function AddPostToPageUpdate_WhenSuppliedValidRequest_ReturnResponse($client)
 {
     echo "<hr />";
     echo "<b>AddPostToPageUpdate_WhenSuppliedValidRequest_ReturnResponse</b><br/>";
     $request = new AddPostToPageUpdateRequest();
     $request->Message = "update story";
     $response = $client->Page->AddPostToPageUpdate("api-test-54787f3435f75", $request);
     if ($response->Created != null) {
         WriteLine("TEST PASSED");
     } else {
         WriteLine("TEST FAILED");
     }
 }
 function ReplaceInterest_WhenSuppliedAuthenticationAndCorrectListOfInterest_Return_True($client)
 {
     echo "<hr />";
     echo "<b>ReplaceInterest_WhenSuppliedAuthenticationAndCorrectListOfInterest_Return_True</b><br/>";
     $request = array("Swimming", "Cricket");
     $response = $client->Account->ReplaceInterest($request);
     if ($response == 1) {
         WriteLine("Interests has been replaced - TEST PASSED");
     } else {
         if ($response == 0) {
             WriteLine("Unable to replace interests, please check authentication - TEST FAILED");
         }
     }
 }