IPaymentConstants::ApplicationTypeRegistration, 'is_test_mode' => true, 'test_publishable_key' => self::$test_public_key, 'test_secret_key' => self::$test_secret_key, 'is_active' => false, ]); self::$summit->addPaymentProfile($profile); self::$em->persist(self::$summit); self::$em->flush(); $summit2 = self::$summit_repository->findOneBy(['id' => self::$summit->getId()]); $this->assertTrue(!is_null($summit2)); $this->assertTrue($summit2 instanceof Summit); $profile->activate(); $profile = $summit2->getPaymentGateWayProfilePerApp(IPaymentConstants::ApplicationTypeRegistration); $this->assertTrue(!is_null($profile)); $this->assertTrue($profile instanceof StripePaymentProfile); if($profile instanceof StripePaymentProfile){ $profile->buildWebHook(); } self::$em->persist($summit2); self::$em->flush(); } /** * @throws \models\exceptions\ValidationException */ public function testAddPaymentGatewayConfig2SummitAndChangeToLive(){ // build payment profile and attach to summit $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, 'live_publishable_key' => self::$live_public_key, 'live_secret_key' => self::$live_secret_key, 'is_active' => true, ]); self::$summit->addPaymentProfile($profile); self::$em->persist(self::$summit); self::$em->flush(); $summit2 = self::$summit_repository->findOneBy(['id' => self::$summit->getId()]); $this->assertTrue(!is_null($summit2)); $this->assertTrue($summit2 instanceof Summit); $profile = $summit2->getPaymentGateWayProfilePerApp(IPaymentConstants::ApplicationTypeRegistration); $this->assertTrue(!is_null($profile)); $this->assertTrue($profile instanceof StripePaymentProfile); if($profile instanceof StripePaymentProfile){ // build hook on test $profile->setTestMode(); $profile->buildWebHook(); // build hook on live $profile->setLiveMode(); $profile->buildWebHook(); } self::$em->persist($summit2); self::$em->flush(); } }