
Doc https://docs.google.com/document/d/1gOAceevwutF3QHYWD0_6aESQMZEiIz3YVBVXlyUuRy8 * Summit Registration External Feed https://docs.google.com/document/d/1_2QZUK--A350jxh2USKBtVtisKrrcUcVjdKnbcZ7-4M/edit# * Multi Stripe Config * Added stripe payment configuration per summit * Added webhook automatic creation * Added CRUD endpoints for payment profiles per summit GET api/v1/summits/{id}/payment-gateway-profiles filters active ['=='] application_type ['=@', '=='] scopes summits/read/all summits/payment-gateway-profiles/read POST api/v1/summits/{id}/payment-gateway-profiles payload 'active' => 'sometimes|boolean', 'application_type' => 'sometimes|string|in:Registration,BookableRooms' 'provider' => 'required|string|in:Stripe', 'test_mode_enabled' => 'required|boolean', 'live_secret_key' => 'sometimes|string', 'live_publishable_key' => 'required_with:live_secret_key|string', 'test_secret_key' => 'sometimes|string', 'test_publishable_key' => 'required_with:test_secret_key|string' scopes summits/write summits/payment-gateway-profiles/write GET api/v1/summits/{id}/payment-gateway-profiles/{payment_profile_id} scopes summits/read/all summits/payment-gateway-profiles/read PUT api/v1/summits/{id}/payment-gateway-profiles/{payment_profile_id} payload 'active' => 'sometimes|boolean', 'application_type' => 'sometimes|string|in:Registration,BookableRooms' 'provider' => 'required|string|in:Stripe', 'test_mode_enabled' => 'required|boolean', 'live_secret_key' => 'sometimes|string', 'live_publishable_key' => 'required_with:live_secret_key|string', 'test_secret_key' => 'sometimes|string', 'test_publishable_key' => 'required_with:test_secret_key|string' scopes summits/payment-gateway-profiles/write summits/write DELETE api/v1/summits/{id}/payment-gateway-profiles/{payment_profile_id} scopes summits/payment-gateway-profiles/write summits/write Stripe Webhooks default webhook (SECRET set per application under .env, should be created previously on stripe default account) POST api/public/v1/summits/all/payments/{application_name}/confirm where application_name could be Registration or BookableRooms otherwise if a stripe account is set per summit, when the profile gets activated a webhook will be automatically be created using following url POST api/public/v1/summits/{id}/payments/{application_name}/confirm * Email API Integration * moved all blade templates to mail api ( DB Seeding) * defined email events flows per summmit * created endpoint to set up templates per email events on each flow PUT /api/v1/summits/{id}/email-flows-events/{event_id} payload email_template_identifier: string * added endpoint to get all email events per summit GET /api/v1/summits/{id}/email-flows-events * added endpoint to get email event per summit/id GET /api/v1/summits/{id}/email-flows-events/{event_id} Summit Documents endpoints add summit document POST /api/v1/summits/{id}/summit-documents payload file (mandatory|file stream) label ( mandatory|string) name ( mandatory|string) description (optional|string) get all summit documents GET /api/v1/summits/{id}/summit-documents get by id GET /api/v1/summits/{id}/summit-documents/{document_id} update PUT GET /api/v1/summits/{id}/summit-documents/{document_id} file (optional|file stream) label (optional|string) name (optional|string) description (optional|string) delete DELETE GET /api/v1/summits/{id}/summit-documents/{document_id} add event type to doc PUT /api/v1/summits/{id}/summit-documents/{document_id}/event-types/{event_type_id} delete event type from doc DELETE /api/v1/summits/{id}/summit-documents/{document_id}/event-types/{event_type_id} add document to event type PUT /api/v1/summits/{id}/event-types/{event_type_id}/summit-documents/{document_id} delete document from event type DELETE /api/v1/summits/{id}/event-types/{event_type_id}/summit-documents/{document_id} Updated Summit events to support streaming url, meeting_url and etherpad link * Summit Registration - Invite only Summit Administrator Permission Groups GET /api/v1/summit-administrator-groups filter * title * member_first_name * member_last_name * member_full_name * member_email * summit_id * member_id ordering id title scopes %s/summit-administrator-groups/read /api/v1/summit-administrator-groups/{group_id} scopes %s/summit-administrator-groups/read POST /api/v1/summit-administrator-groups title summits members scopes %s/summit-administrator-groups/write PUT /api/v1/summit-administrator-groups/{group_id} title summits members scopes %s/summit-administrator-groups/write DELETE /api/v1/summit-administrator-groups/{group_id} scopes %s/summit-administrator-groups/write PUT /api/v1/summit-administrator-groups/{group_id}/members/{member_id} DELETE /api/v1/summit-administrator-groups/{group_id}/members/{member_id} PUT /api/v1/summit-administrator-groups/{group_id}/summits/{summit_id} DELETE /api/v1/summit-administrator-groups/{group_id}/summits/{summit_id} Room Metrics PUT /api/v1/summits/{id}/members/{member_id}/schedule/{event_id}/enter Scopes %s/me/summits/events/enter PUT /api/v1/summits/{id}/members/{member_id}/schedule/{event_id}/leave %s/me/summits/events/leave update summit_event serializer new fields total_attendance_count current_attendance_count attendance current_attendance Added new Speakers Endpoints GET /api/v1/summits/{id}/speakers/on-schedule retrieves all speakers on summit schedule filters 'first_name' => ['=@', '=='], 'last_name' => ['=@', '=='], 'email' => ['=@', '=='], 'id' => ['=='], 'full_name' => ['=@', '=='], 'start_date' => ['>', '<', '<=', '>=', '=='], 'end_date' => ['>', '<', '<=', '>=', '=='], Summit Events Image POST /api/v1/summits/{id}/events/{event_id}/image DELETE /api/v1/summits/{id}/events/{event_id}/image Speakers Image Big Pic POST /api/v1/speakers/{speaker_id}/big-photo DELETE /api/v1/speakers/{speaker_id}/big-photo CFP - multiple summits Presentation Materials - Media Uploads New Endpoints GET api/v1/summit-media-file-types filter 'name' => ['=@', '=='] order id, name POST api/v1/summit-media-file-types payload 'name' => 'required|string|max:255', 'description' => 'sometimes|string|max:255', 'allowed_extensions' => 'required|string_array', GET api/v1/summit-media-file-types/{id} PUT api/v1/summit-media-file-types/{id} payload 'name' => 'sometimes|string|max:255', 'description' => 'sometimes|string|max:255', 'allowed_extensions' => 'required|string_array', DELETE api/v1/summit-media-file-types/{id} GET api/v1/summits/{id}/media-upload-types POST payload 'name' => 'required|string|max:255', 'description' => 'sometimes|string|max:255', 'is_mandatory' => 'required|boolean', 'max_size' => 'required|int|megabyte_aligned', 'private_storage_type' => 'required|string|in:None,DropBox,Swift,Local', 'public_storage_type' => 'required|string|in:None,DropBox,Swift,Local' 'type_id' => 'required|int', 'presentation_types' => 'sometimes|int_array', GET api/v1/summits/{id}/media-upload-types/{media_upload_type_id} PUT api/v1/summits/{id}/media-upload-types/{media_upload_type_id} payload 'name' => 'sometimes|string|max:255', 'description' => 'sometimes|string|max:255', 'is_mandatory' => 'sometimes|boolean', 'max_size' => 'sometimes|int|megabyte_aligned', 'private_storage_type' => 'sometimes|string|in:None,DropBox,Swift,Local', 'public_storage_type' => 'sometimes|string|in:None,DropBox,Swift,Local' 'type_id' => 'sometimes|int', 'presentation_types' => 'sometimes|int_array', DELETE api/v1/summits/{id}/media-upload-types/{media_upload_type_id} PUT api/v1/summits/{id}/media-upload-types/{media_upload_type_id}/presentation-types/{event_type_id} DELETE api/v1/summits/{id}/media-upload-types/{media_upload_type_id}/presentation-types/{event_type_id} GET api/v1/summits/{id}/presentations/{presentation_id}/media-uploads POST api/v1/summits/{id}/presentations/{presentation_id}/media-uploads payload multiform file media_upload_type_id GET api/v1/summits/{id}/presentations/{presentation_id}/media-uploads/{media_upload_id} PUT api/v1/summits/{id}/presentations/{presentation_id}/media-uploads/{media_upload_id} payload multiform file DELETE api/v1/summits/{id}/presentations/{presentation_id}/media-uploads/{media_upload_id} POST /api/v1/summits/{id}/media-upload-types/all/clone/{to_summit_id} Summit Invitation Only endpoints V2 CRUD invitations Change-Id: Ia23c247a59c3810f2a738265efdd890fe6f59dfb Signed-off-by: smarcet <smarcet@gmail.com>
899 lines
24 KiB
PHP
899 lines
24 KiB
PHP
<?php
|
|
/**
|
|
* Copyright 2019 OpenStack Foundation
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
**/
|
|
use models\summit\PaymentGatewayProfileFactory;
|
|
use models\summit\IPaymentConstants;
|
|
use App\Models\Foundation\Summit\Factories\SummitTicketTypeFactory;
|
|
use App\Models\Foundation\Summit\Factories\SummitBadgeTypeFactory;
|
|
/**
|
|
* Class OAuth2SummitOrdersApiTest
|
|
*/
|
|
final class OAuth2SummitOrdersApiTest extends ProtectedApiTest
|
|
{
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected static $test_secret_key;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected static $test_public_key;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected static $live_secret_key;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
protected static $live_public_key;
|
|
|
|
/**
|
|
* @var \models\summit\SummitTicketType
|
|
*/
|
|
protected static $ticketType;
|
|
|
|
/**
|
|
* @var \models\summit\PaymentGatewayProfile|null
|
|
*/
|
|
protected static $profile;
|
|
|
|
use InsertSummitTestData;
|
|
|
|
/**
|
|
* This method is called before the first test of this test class is run.
|
|
*/
|
|
public static function setUpBeforeClass()/* The :void return type declaration that should be here would cause a BC issue */
|
|
{
|
|
}
|
|
|
|
/**
|
|
* This method is called after the last test of this test class is run.
|
|
*/
|
|
public static function tearDownAfterClass()/* The :void return type declaration that should be here would cause a BC issue */
|
|
{
|
|
}
|
|
|
|
|
|
protected function setUp()
|
|
{
|
|
parent::setUp();
|
|
self::$test_secret_key = env('TEST_STRIPE_SECRET_KEY');
|
|
self::$test_public_key = env('TEST_STRIPE_PUBLISHABLE_KEY');
|
|
self::$live_secret_key = env('LIVE_STRIPE_SECRET_KEY');
|
|
self::$live_public_key = env('LIVE_STRIPE_PUBLISHABLE_KEY');
|
|
|
|
self::insertTestData();
|
|
// build payment profile and attach to summit
|
|
self::$profile = PaymentGatewayProfileFactory::build(IPaymentConstants::ProviderStripe, [
|
|
'application_type' => IPaymentConstants::ApplicationTypeRegistration,
|
|
'is_test_mode' => true,
|
|
'test_publishable_key' => self::$test_public_key,
|
|
'test_secret_key' => self::$test_secret_key,
|
|
'is_active' => false,
|
|
]);
|
|
|
|
// build default badge type
|
|
|
|
$defaultBadge = SummitBadgeTypeFactory::build([
|
|
'name' => 'DEFAULT',
|
|
'is_default' => true,
|
|
]);
|
|
|
|
// build ticket type
|
|
|
|
self::$ticketType = SummitTicketTypeFactory::build(self::$summit, [
|
|
'name' => 'TICKET_1',
|
|
'cost' => 100,
|
|
'quantity_2_sell' => 1000,
|
|
]);
|
|
|
|
self::$summit->addPaymentProfile(self::$profile);
|
|
self::$summit->addBadgeType($defaultBadge);
|
|
self::$summit->addTicketType(self::$ticketType);
|
|
|
|
self::$em->persist(self::$summit);
|
|
self::$em->flush();
|
|
}
|
|
|
|
protected function tearDown()
|
|
{
|
|
//self::clearTestData();
|
|
parent::tearDown();
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function testGetAllMyOrders(){
|
|
$params = [
|
|
|
|
'page' => 1,
|
|
'per_page' => 10,
|
|
'order' => '+number',
|
|
'expand' => 'tickets,tickets.owner,tickets.badge'
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"GET",
|
|
"OAuth2SummitOrdersApiController@getAllMyOrders",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
$my_orders = json_decode($content);
|
|
$this->assertTrue(!is_null($my_orders));
|
|
return $my_orders;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function testGetAllMyTickets(){
|
|
$params = [
|
|
|
|
'page' => 1,
|
|
'per_page' => 10,
|
|
'order' => '+number',
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"GET",
|
|
"OAuth2SummitTicketApiController@getAllMyTickets",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
$my_orders = json_decode($content);
|
|
$this->assertTrue(!is_null($my_orders));
|
|
return $my_orders;
|
|
}
|
|
|
|
public function testRefundOrderWithEmptyPayload($summit_id = 27, $order_id = 5){
|
|
$params = [
|
|
'id' => $summit_id,
|
|
'order_id' => $order_id
|
|
];
|
|
|
|
$data = [];
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"DELETE",
|
|
"OAuth2SummitOrdersApiController@refundOrder",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers,
|
|
json_encode($data)
|
|
);
|
|
|
|
$this->assertResponseStatus(412);
|
|
|
|
}
|
|
|
|
public function testRefundTicketWithEmptyPayload($summit_id = 27, $ticket_id = 5){
|
|
$params = [
|
|
'id' => $summit_id,
|
|
'ticket_id' => $ticket_id
|
|
];
|
|
|
|
$data = [];
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"DELETE",
|
|
"OAuth2SummitTicketApiController@refundTicket",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers,
|
|
json_encode($data)
|
|
);
|
|
|
|
$this->assertResponseStatus(412);
|
|
|
|
}
|
|
|
|
public function testRefundOrderWithoutPayload($summit_id = 27, $order_id = 5){
|
|
$params = [
|
|
'id' => $summit_id,
|
|
'order_id' => $order_id
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"DELETE",
|
|
"OAuth2SummitOrdersApiController@refundOrder",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers
|
|
//json_encode($data)
|
|
);
|
|
|
|
$this->assertResponseStatus(412);
|
|
|
|
}
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function testUpdateMyOrder(){
|
|
|
|
$params = [
|
|
'order_id' => 7
|
|
];
|
|
|
|
$data = [
|
|
'owner_company' => 'OpenStack',
|
|
'billing_address_1' => 'Siempre Viva Av.',
|
|
'extra_questions' => [
|
|
['question_id' => 1, 'answer' => 'test'],
|
|
]
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"PUT",
|
|
"OAuth2SummitOrdersApiController@updateMyOrder",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers,
|
|
json_encode($data)
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(201);
|
|
$order = json_decode($content);
|
|
$this->assertTrue(!is_null($order));
|
|
return $order;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function testUpdateOrder($summit_id = 27, $order_id =7){
|
|
|
|
$params = [
|
|
'id' => $summit_id,
|
|
'order_id' => $order_id
|
|
];
|
|
|
|
$data = [
|
|
'owner_first_name' => 'Sebastian',
|
|
'owner_last_name' => 'Sebastian',
|
|
'owner_email' => 'smarcet@gmail.com',
|
|
'owner_company' => 'OpenStack',
|
|
'billing_address_1' => 'Siempre Viva Av.',
|
|
'extra_questions' => [
|
|
['question_id' => 3, 'answer' => '1'],
|
|
['question_id' => 4, 'answer' => ''],
|
|
['question_id' => 5, 'answer' => ''],
|
|
]
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"PUT",
|
|
"OAuth2SummitOrdersApiController@update",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers,
|
|
json_encode($data)
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(201);
|
|
$order = json_decode($content);
|
|
$this->assertTrue(!is_null($order));
|
|
return $order;
|
|
}
|
|
|
|
public function testReserveWithoutActivePaymentProfile(){
|
|
|
|
self::$profile->disable();
|
|
self::$em->persist(self::$profile);
|
|
self::$em->flush();
|
|
|
|
$params = [
|
|
'id' => self::$summit->getId(),
|
|
];
|
|
|
|
$data = [
|
|
"owner_email" => "smarcet@gmail.com",
|
|
"owner_first_name" => "Sebastian",
|
|
"owner_last_name" => "Marcet",
|
|
"owner_company"=>"Pumant",
|
|
"tickets" => [
|
|
["type_id" => self::$ticketType->getId()],
|
|
["type_id" => self::$ticketType->getId()],
|
|
["type_id" => self::$ticketType->getId()],
|
|
]
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"POST",
|
|
"OAuth2SummitOrdersApiController@reserve",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers,
|
|
json_encode($data)
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
//$this->assertResponseStatus(412);
|
|
$this->assertResponseStatus(201);
|
|
$order = json_decode($content);
|
|
$this->assertTrue(!is_null($order));
|
|
return $order;
|
|
}
|
|
|
|
public function testReserveWithActivePaymentProfile(){
|
|
|
|
self::$profile->activate();
|
|
self::$em->persist(self::$profile);
|
|
self::$em->flush();
|
|
|
|
$params = [
|
|
'id' => self::$summit->getId(),
|
|
];
|
|
|
|
$data = [
|
|
"owner_email" => "smarcet@gmail.com",
|
|
"owner_first_name" => "Sebastian",
|
|
"owner_last_name" => "Marcet",
|
|
"owner_company"=>"Pumant",
|
|
"tickets" => [
|
|
["type_id" => self::$ticketType->getId()],
|
|
["type_id" => self::$ticketType->getId()],
|
|
["type_id" => self::$ticketType->getId()],
|
|
]
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"POST",
|
|
"OAuth2SummitOrdersApiController@reserve",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers,
|
|
json_encode($data)
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(201);
|
|
$order = json_decode($content);
|
|
$this->assertTrue(!is_null($order));
|
|
return $order;
|
|
}
|
|
|
|
public function testReserveFailingPromoCode(){
|
|
$params = [
|
|
'id' => self::$summit->getId(),
|
|
];
|
|
|
|
$data = [
|
|
"owner_email" => "smarcet@gmail.com",
|
|
"owner_first_name" => "Sebastian",
|
|
"owner_last_name" => "Marcet",
|
|
"owner_company"=>"Pumant",
|
|
"tickets" => [
|
|
["type_id" => self::$ticketType->getId(), "promo_code"=>"test100"],
|
|
["type_id" => self::$ticketType->getId(), "promo_code"=>"Test100"],
|
|
["type_id" => self::$ticketType->getId(), "promo_code"=>"TesT100"],
|
|
]
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"POST",
|
|
"OAuth2SummitOrdersApiController@reserve",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers,
|
|
json_encode($data)
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(412);
|
|
}
|
|
|
|
public function testTicketAssignmentWithoutExtraQuestions(){
|
|
$params = [
|
|
'order_id' => 23,
|
|
'ticket_id' => 21,
|
|
];
|
|
|
|
$data = [
|
|
"attendee_email" => "sebastian.jose@gmail.com",
|
|
"attendee_first_name" => "sebastian",
|
|
"attendee_last_name" => 'marcet',
|
|
"attendee_company" => "pumant",
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"PUT",
|
|
"OAuth2SummitOrdersApiController@assignAttendee",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers,
|
|
json_encode($data)
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(412);
|
|
}
|
|
|
|
/**
|
|
* @param int $summit_id
|
|
* @param string $hash
|
|
*/
|
|
public function testCheckoutFailedCountryValidation($summit_id= 27, $hash = 'ab45277bd50ba2d3284e56f06f2710049e5950927ec304fb7f8ea36e43cea931'){
|
|
|
|
$params = [
|
|
'id' => $summit_id,
|
|
'hash' => $hash
|
|
];
|
|
|
|
$data = [
|
|
'billing_address_1' => 'test',
|
|
'billing_address_2' => 'test',
|
|
'billing_address_zip_code' => 'test',
|
|
'billing_address_city' => 'test',
|
|
'billing_address_state' => 'test',
|
|
'billing_address_country' => 'test',
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"PUT",
|
|
"OAuth2SummitOrdersApiController@checkout",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers,
|
|
json_encode($data)
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(412);
|
|
$this->assertTrue(str_contains($content, "billing_address_country"));
|
|
}
|
|
|
|
/**
|
|
* @param int $summit_id
|
|
* @param string $hash
|
|
*/
|
|
public function testGetTicketForEditionByOrderHash($summit_id = 1, $hash = 'eb758846226109a736c512a6e0d682bdc6a3af67a0ad316315158f49c5f8f7e9'){
|
|
|
|
$params = [
|
|
'id' => $summit_id,
|
|
'hash' => $hash
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
];
|
|
|
|
$response = $this->action(
|
|
"GET",
|
|
"OAuth2SummitOrdersApiController@getMyTicketByOrderHash",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers,
|
|
[]
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
$ticket = json_decode($content);
|
|
$this->assertTrue(!is_null($ticket));
|
|
return $ticket;
|
|
}
|
|
|
|
/**
|
|
* @param int $summit_id
|
|
* @param int $order_id
|
|
* @param int $ticket_id
|
|
* @return mixed
|
|
*/
|
|
public function testUpdateTicket($summit_id = 1, $order_id = 23 , $ticket_id = 21){
|
|
|
|
$params = [
|
|
'id' => $summit_id,
|
|
'order_id' => $order_id,
|
|
'ticket_id' => $ticket_id,
|
|
];
|
|
|
|
$data = [
|
|
'attendee_first_name' => 'Jose Arturo',
|
|
'attendee_last_name' => 'Campanella',
|
|
'attendee_email' => 'jcampanella@gmail.com',
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"PUT",
|
|
"OAuth2SummitOrdersApiController@updateTicket",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers,
|
|
json_encode($data)
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(201);
|
|
$ticket = json_decode($content);
|
|
$this->assertTrue(!is_null($ticket));
|
|
return $ticket;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function testRevokeAttendee(){
|
|
|
|
$params = [
|
|
'order_id' => 6,
|
|
'ticket_id' => 18925,
|
|
];
|
|
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"DELETE",
|
|
"OAuth2SummitOrdersApiController@removeAttendee",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers
|
|
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(201);
|
|
$ticket = json_decode($content);
|
|
$this->assertTrue(!is_null($ticket));
|
|
return $ticket;
|
|
}
|
|
|
|
public function testRegenerateTicketHash(){
|
|
|
|
$params = [
|
|
'hash' => '25f6d007523cc64b52fc513c49176119ef431f955eb8ace8cd3cdc959ab77893',
|
|
];
|
|
|
|
$response = $this->action(
|
|
"PUT",
|
|
"OAuth2SummitOrdersApiController@regenerateTicketHash",
|
|
$params,
|
|
[],
|
|
[],
|
|
[]
|
|
);
|
|
|
|
$this->assertResponseStatus(200);
|
|
}
|
|
|
|
public function testGetTicketByHash(){
|
|
|
|
$params = [
|
|
'hash' => '87fb1166e8c41cfb4457dc1f5d11413549aeca833691bbbd6563f6335a948562',
|
|
'expand' => 'owner,order,applied_taxes, applied_taxes.tax'
|
|
];
|
|
|
|
$response = $this->action(
|
|
"GET",
|
|
"OAuth2SummitOrdersApiController@getTicketByHash",
|
|
$params,
|
|
[],
|
|
[],
|
|
[]
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
$ticket = json_decode($content);
|
|
$this->assertTrue(!is_null($ticket));
|
|
return $ticket;
|
|
}
|
|
|
|
public function testCreateSingleTicketOrder(){
|
|
|
|
$params = [
|
|
'summit_id' => self::$summit->getId()
|
|
];
|
|
|
|
$data = [
|
|
'owner_first_name' => 'Sebastian',
|
|
'owner_last_name' => 'Marcet',
|
|
'owner_email' => 'smarcet@gmail.com',
|
|
'ticket_type_id' => self::$ticketType->getId(),
|
|
"owner_company" => "Pumant",
|
|
//'promo_code' => 'STAFF'
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"POST",
|
|
"OAuth2SummitOrdersApiController@add",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers,
|
|
json_encode($data)
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(201);
|
|
$order = json_decode($content);
|
|
$this->assertTrue(!is_null($order));
|
|
return $order;
|
|
}
|
|
|
|
public function testCreateSingleTicketOrderNotComplete(){
|
|
|
|
$params = [
|
|
'summit_id' => self::$summit->getId()
|
|
];
|
|
|
|
$data = [
|
|
'owner_first_name' => 'Sebastian',
|
|
'owner_last_name' => 'Marcet',
|
|
'owner_email' => 'smarcet@gmail.com',
|
|
'ticket_type_id' => self::$ticketType->getId(),
|
|
"owner_company" => "Pumant",
|
|
//'promo_code' => 'STAFF'
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"POST",
|
|
"OAuth2SummitOrdersApiController@add",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers,
|
|
json_encode($data)
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(201);
|
|
$order = json_decode($content);
|
|
$this->assertTrue(!is_null($order));
|
|
return $order;
|
|
}
|
|
|
|
/**
|
|
* @param int $summit_id
|
|
* @param int $order_id
|
|
*/
|
|
public function testDeleteOrder($summit_id=27, $order_id = 6){
|
|
$params = [
|
|
'summit_id' => $summit_id,
|
|
'order_id' => $order_id
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"DELETE",
|
|
"OAuth2SummitOrdersApiController@delete",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(204);
|
|
}
|
|
|
|
public function testGetAllOrders($summit_id=3){
|
|
$params = [
|
|
'summit_id' => $summit_id,
|
|
'page' => 1,
|
|
'per_page' => 10,
|
|
'order' => '+id',
|
|
'expand' => 'tickets,tickets.owner',
|
|
//'filter' => 'status<>Cancelled,status<>Reserved',
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"GET",
|
|
"OAuth2SummitOrdersApiController@getAllBySummit",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
$orders = json_decode($content);
|
|
$this->assertTrue(!is_null($orders));
|
|
return $orders;
|
|
}
|
|
|
|
public function testGetTicketPdfByID($ticket_id=21){
|
|
$params = [
|
|
'ticket_id' => $ticket_id,
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"GET",
|
|
"OAuth2SummitOrdersApiController@getTicketPDFById",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers
|
|
);
|
|
|
|
$pdf_content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
$this->assertTrue(!is_null($pdf_content));
|
|
return $pdf_content;
|
|
}
|
|
|
|
public function testUpdateTicketById($ticket_id = 28){
|
|
$params = [
|
|
'$ticket_id' => $ticket_id
|
|
];
|
|
|
|
$data = [
|
|
'owner_first_name' => 'Sebastian',
|
|
'owner_last_name' => 'Marcet',
|
|
'owner_email' => 'sebastian@marcet.com.ar',
|
|
'disclaimer_accepted' => true,
|
|
];
|
|
|
|
$headers = [
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action(
|
|
"PUT",
|
|
"OAuth2SummitOrdersApiController@updateTicketById",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers,
|
|
json_encode($data)
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(201);
|
|
$order = json_decode($content);
|
|
$this->assertTrue(!is_null($order));
|
|
return $order;
|
|
}
|
|
} |