From 381acd603ee3821fe169fe32c2c12bfe95ec402d Mon Sep 17 00:00:00 2001 From: Serreau Jovann Date: Wed, 1 Apr 2026 14:07:49 +0200 Subject: [PATCH] Split Stripe webhooks into 2 endpoints: insta (payments) and leger (Connect) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - /stripe/webhook → /webhooks/stripe/insta (paiements, payouts, disputes, subscriptions) - /stripe/webhook/connect → /webhooks/stripe/leger (gestion comptes Connect) - Rename env vars: STRIPE_WEBHOOK_SECRET → STRIPE_WEBHOOK_SECRET_INSTA, STRIPE_WEBHOOK_SECRET_CONNECT → STRIPE_WEBHOOK_SECRET_LEGER - Update StripeService, CsrfProtectionSubscriber, vault, env files and all tests Co-Authored-By: Claude Opus 4.6 (1M context) --- .env | 4 +- .env.test | 4 +- ansible/env.local.j2 | 4 +- ansible/vault.yml | 322 +++++++++--------- src/Controller/StripeWebhookController.php | 12 +- .../CsrfProtectionSubscriber.php | 4 +- src/Service/StripeService.php | 12 +- .../StripeWebhookControllerTest.php | 96 +++--- .../CsrfProtectionSubscriberTest.php | 4 +- tests/Service/StripeServiceTest.php | 10 +- 10 files changed, 236 insertions(+), 236 deletions(-) diff --git a/.env b/.env index 76cd61d..0b3ed69 100644 --- a/.env +++ b/.env @@ -51,8 +51,8 @@ REAL_MAIL=0 ###< vite ### STRIPE_PK= STRIPE_SK= -STRIPE_WEBHOOK_SECRET= -STRIPE_WEBHOOK_SECRET_CONNECT= +STRIPE_WEBHOOK_SECRET_INSTA= +STRIPE_WEBHOOK_SECRET_LEGER= STRIPE_MODE=test STRIPE_FEE_RATE=0.015 STRIPE_FEE_FIXED=25 diff --git a/.env.test b/.env.test index 3a9ed9b..d3e9782 100644 --- a/.env.test +++ b/.env.test @@ -8,8 +8,8 @@ SONARQUBE_URL=https://sn.esy-web.dev SONARQUBE_BADGE_TOKEN=test SONARQUBE_PROJECT_KEY=e-ticket STRIPE_SK=sk_test_fake -STRIPE_WEBHOOK_SECRET=whsec_test -STRIPE_WEBHOOK_SECRET_CONNECT=whsec_test_connect +STRIPE_WEBHOOK_SECRET_INSTA=whsec_test_insta +STRIPE_WEBHOOK_SECRET_LEGER=whsec_test_leger OUTSIDE_URL=https://test.example.com MESSENGER_TRANSPORT_DSN=redis://:e_ticket@redis:6379/messages SESSION_HANDLER_DSN=redis://:e_ticket@redis:6379/1 diff --git a/ansible/env.local.j2 b/ansible/env.local.j2 index 80992ae..56dec82 100644 --- a/ansible/env.local.j2 +++ b/ansible/env.local.j2 @@ -11,8 +11,8 @@ REAL_MAIL=1 OUTSIDE_URL=https://ticket.e-cosplay.fr STRIPE_PK={{ stripe_pk }} STRIPE_SK={{ stripe_sk }} -STRIPE_WEBHOOK_SECRET={{ stripe_webhook_secret }} -STRIPE_WEBHOOK_SECRET_CONNECT={{ stripe_webhook_secret_connect }} +STRIPE_WEBHOOK_SECRET_INSTA={{ stripe_webhook_secret_insta }} +STRIPE_WEBHOOK_SECRET_LEGER={{ stripe_webhook_secret_leger }} STRIPE_MODE=live SMIME_PASSPHRASE='{{ smime_passphrase }}' MEILISEARCH_URL=http://meilisearch:7700 diff --git a/ansible/vault.yml b/ansible/vault.yml index d21cf90..14e5992 100644 --- a/ansible/vault.yml +++ b/ansible/vault.yml @@ -1,162 +1,162 @@ $ANSIBLE_VAULT;1.1;AES256 -30343663663664303863646134666663353137353264613866643332623833373838363761313731 -3037346233343833643639333934656338346435383830620a326335616664373362323234663332 -66663439666636383839383966326339323434386538303834363932376264383362303163623335 -3430313962626532630a623834376638396161313036653630363265613533303037316432373039 -35393038336262616435346532316639306430643435343038313237656162636234663064653730 -64646366613531396232636534333032396163326237373439383835346364343766373265663565 -30336564366130333730623536383338336161343439326631366362386235666530623738376538 -35636666376361306631346366393738326135373630323162386538396263356165633266396166 -32373166366534303432356666393134393230376265663530356233623535393461616264636265 -36626534343637616234643561393764373962386136633834636633623766356163626463316338 -37326566323431376431313763613637613833633533633735303966633534636235326330356236 -66633539646337366562303639356130666263336137363438326635366664313266663338333530 -38663137643237313164393837336238306664373830616338373165653664396562646562393531 -64353735656233353635343530353432656139343539653663343734653863333162633536366464 -39646435376164633032323434326262303939366532633432313134393861663433306239303964 -64333538363331366234376539363537653330363133396437323934646437353330656233323332 -34366233323033393865353137333461383737303661336165623135396261623466636537326630 -61653262346562643731343838653866333233376464386531333064666233316439646336313536 -39333537313663306133396638613539326162356164333661396236343032613231653065356232 -35636162353639323166666666356438363733313134323833616637366632336334373133653166 -35313263363261356437353237386362656338363439323538646638336165656534323462356466 -35313838613464613834613366323637303165653033303364356333336239663535313831343862 -61313465313962623930376331646631376632366136333561336162386636643461646137353065 -30383337653830333036363863326238666665326539333264623065373135336165613330643033 -32306263373461646664373833343235633564326632643937623738303739313566393531363136 -30353532363733663330646463623863336230303162306266333766616630316134326363306138 -35623966346562333538623138623266313535623137623166386164303730636337623332393966 -37643435623966646334363932383831633432303763623966646566363861313932646637646462 -66646566616532663439393336396238386164356532326532373965303763333036343430336236 -65313938393061346430356366646535366539343939306531323930646163633033663264353231 -31383366633734646630376163616564393061323164373236626565323465653364363433316535 -30303536663264656636303930646134613131313137313531313764306537663434653366646462 -61663232613038343935313361663564353666363733333030613366323937343864383439363264 -38326531386336343233346231366231633732623033393637656238313864313833393736356234 -62633564626164376563333561386139306462626261396263656366326564316364613538313961 -31366562393934613136346336313761656261313530646664626162623937353339636366363063 -34336634663666663765333539653830613764323166623935376432646431323931643338383163 -35633065616335316361316532353832313762663730633630373430313366356132643530643636 -34323532363863633330356231383630656363626165343038323331653431393934363436333435 -37386534653639316332653335333437633130333165366632363931323330633533343763633436 -65373633353036616130303662346434316136396633393831323736386132376566326665363964 -66356665343833616539303762643961343832643831653736303365316662313762326464356164 -62303839393733353865356437313463313037666663636435366566613462353732633962383164 -33323237653063303563616534346261663838326661326262383333613833323130326263393866 -66353263346130663336386139386665393530633137356636363532396264343362323163363435 -32386132613539383637336563613639643430663133633638373435626162313635636435613262 -64363639323530666431383133383564383163646465346266633765613037303838333361646566 -35333930383965613365303837623133653037346663626133363937363030643963376535313733 -38343630613363626563353633356133373735336633663963633633653432393232383136616639 -31366230616136376639646530316164363063626136626233383333393238353234356337613138 -38313135633237346638306132313337323536366333306430383263636435363661326364633963 -66343837353661323534383439303439306433666664373434336562656462313539333731626265 -61646138306437613164643337376435633337396433396334313734363733343932313232393634 -36363335613934626534663736666137633432376230656438376637306636336366316332613963 -33636566326539616266303137343465323538313932613437363961643763386161636136653336 -61376436353066633265353237633030633363343534653761656339333737333637383734613331 -34393931613539393462376334396431316132393165346230323966386533643662653732663734 -35613336376339636261336536616561303831636337616263613336373561353532656432633765 -30386463613666656634633939343134356437303939313462663831363236313339336531653264 -63393965343266343739353039303634303135633930656438333332643538323662623865396632 -64623635323130366362613039343236666432386531323463643465306232363961353864653837 -35633765636363663338656630666238326164343263313763383862363734346230346633626163 -32386563616433356535663231623164663761383834373562323931646233626366643538336138 -61343932386463353937626336396531356662363433353832333430393434363239653634366665 -64323262383061656430366362343738376364393738616232356663623536383862663162396166 -66366434636536356335346265303466373961613438653936346431316332333863373932373536 -35353533653234643732653366656364333361333963633063326638306636393331643536653934 -64383331366531666634663963636564363236323364353038326634303633336564333839613138 -65656437353563396132643739633563636361393431336362666638663832326137386330666165 -34376666383965363732366632373530313764633034663935613736306462666638373332353338 -64386463646261336637393864653965663039343266626134303039343536363562333235353566 -38313062663766666661653931393363633634316534326634336462663239653339306634376435 -62633563376661323937383930393032383066336165663462393138393262663939323834626634 -66363266373333613532656534353134323065343334323439353262346635346234643936383133 -36623264393638323934363034643461343639313438373265646335393733373663313665313833 -61376362666532643733353763666236366331663636393463326438376332376465643566393062 -64313434343438636536653339323461353765376139313436633062363838313931653330383065 -61303865643634653138633439343166376339636431333834646432613137636661363265333661 -61663063653364333537626164633337666533646563663636633064363237393334623665303962 -33613366313164306436643234383337303332363661393662666262356338393133313338313134 -35396632363737623864663738386661396533633461393939396665363839316239363933613261 -38656630663736663061636536623030636334633937663531353963306330353830346462623333 -35313362343762316361653139633336653862623431663232396235366431633536643533643030 -30383234623435326233656263646630643334396538396265383938393630353331363164393965 -63653431346235303135653531613837383834396162373264653533626661386534646565316630 -61306438313434646536613833613337663466376630363436396434613232373265336139653563 -66343062356165303130366238663065653433653039333236303666663665356133626434393134 -33626232626561656266613336383635363561656137336633396139643838326632363765633266 -64393363663031633863363932396663336330313333633566323434353962356363386635643535 -63663466653965323339376230663865316337313636316134313062643762373361643466396532 -38353537303335656139306561666436323536623665353733653365623564333937396565336136 -31373963616334383965313563313636393634326434623466623030306666623364356665333166 -34346431333933373330393138636161663965323530336461373034396632656363626166346234 -64383236303432306132393732383334343664376331623661363736623265313839313730353339 -33636164396164313639306461613839653436306661656637656363343030396164663832333464 -33663363343237643431353833326561353036383233323736356433326639356531306432363033 -32366562386561393134363765346132656262646438343532346433343733333339333233306638 -64383830363339653636323030356365356463653261626334636233643934336434613430656461 -38336639323533643737663430303831363631393738333462303733373531656536346336306134 -38356264326630666566333133333538383635336632653930643432636266613433333036663062 -33623935356264636434636438333066306439333537316139323035353937626461336433383161 -31333230613338386430336463303037363663666236303336393034636234343236653936626561 -35656438633030653432373734353532643264323566343064393262323736373263303033343734 -37656466363133383061666236633838613762306666656538616636353763383639376437323161 -30396338336464353761363933373836366531393834393339643365383537623636613734666133 -32613764333535613936393032366661313763336233373737356435663230366663333131393662 -35646338383230306536623139376431393535333239643030646336643538393264396432666231 -36666330356363353933303262356365353965356634643338343866386435376638353536656365 -66373437386365353263323261633337623066656664613438336363333837623433636564646666 -30346561323462313039653632623765656632343037306233356663336639353636383563626363 -36653032636461656336616263663939373165613337333739663631646436663161383462393233 -37323339393136646333376563313634616134663066653634636234616133393138303266353363 -62653431636332633739663466303730316535626130396364313130663235353366333534373730 -33383064356336323166623964333936396131636235303834363535336265643462383064656130 -38613966353939376337343832366537333163663930323765376135613637333437373637643836 -32353238653763303834653463653663646139623964653262613864316264653834333330373434 -31333239633565363864316332643838353061396538313832636639366666393362666431393934 -61363434353539633332383961336630616233653430666532336562306165646334353735313237 -30356336343633363161336334316330326665653536333431353765346534613634383639633739 -64646531643530396139376166303965343861396133313563303939383935393833666361666362 -30313562386239363737663462353765366639316632656164326662386131333839346163326364 -61303963336162653231326430653330633561386632396238316336393462336232643633313039 -62633035666430393162316166663066396539343663633538366230373966336366306536306634 -35313039393531383537383133303463393266333661323466383936313536373064663633663835 -37373866616166613664313436646535353333623662613930303033613563313730393564353663 -31633337633935633035373334373038326433343562633664383966643766623538656331363130 -38393632356534356236636135306133373764343861326232353438343561373632613532613136 -31326438363333313832396364613261336232313562306465376464626534336366396361626162 -62333932646230376531313133396633643734343431613539626265356535663065303561393361 -36653162323562383266303765353762306331356333346165306566336361326538373732623461 -64393532306461313766383431333139313634343131313830316336336465616135376435353261 -38646332623766616333393631366436666662316264656235386130383563316264643231396539 -34316439306365303261393838393564383863353238316164316438366135383632363133663932 -63656530316263353061393834366562303936613862643231343832636434626465623862633761 -64353663346531333831343930663964316463616133316536626230656234373931353537306335 -39613630613531316230663233646362616433363561646231376664343966386234303361316166 -37386133313435326266643230616164393730323334313136326165336562306561393265353463 -65653162336466643838303137646338646362333736333366396631656232366166653063333430 -65393631643763316635636236373431363764383639353233643632316165303936326437353635 -38353731333164303939383332336434306363323762326633303432326364303038303139353039 -34663639343438333530656237393537316335376462653036643262323730333137666433623534 -61303961323165313436656339383437326666626632363364393766313939356561333337396362 -61333833346238656664663239613061613162366562316666386539336538316266363465363166 -62646666363462613465633961303066616534613863356366613465393332323834386431613835 -66373661643434353466646531323030316235393733633035363866363232323564373431343666 -38636264346439623632356438636232616663333132643162353165366437663838626132626338 -64393739396433336536383231336465656430646430326166393864633632633330366466383632 -39363037323831383230356134353865313566316162303930303263366435353238303562663162 -32643639373130373437336532336238333135333836376264373538386562656534613337383264 -31646233303939656433383633356262633866383134323464373866616532366232316664353134 -38653864633038636461613236343731653535633938326163633466656435373765313338626663 -38663365316565386136366232366434323831623264666133313934343835326439383834633366 -34656432343039653030356463633130656639633832333736366264356232306436363839633162 -31616264323131313165353663323562626630366138333564343064313339353261383565666265 -62663939393037306437653737363533396237346534353138396537323266643061363637353031 -38306331663639643131376166353335613233666663313137333230643430376161323561343961 -36383462613939363463396439316335333763306363626263343061393463363631633533366563 -64316461396365663561366239313564626235613731316436666630356563653531643461313962 -63323534366364316164313331346439313838646264613234323764383561353237376363643432 -32653764313962666531336262643139353334626434386662383939366662396532363237326431 -6631 +36656162363566643931323630643533623133653261396132303936353762623038646335343834 +3362613463376536633164356262333335653966386435320a323738666438613937663739346534 +65666633633839643830666366623630636463666538313535666130623264393464393736323730 +3035623566333436370a613535373861366334343238356236633634326330653530383762316237 +37316439313262323437633937356133653333366334333533343837323865326666306461643231 +32656134613965326433663338356230366338653232343636333261366136623332353536326261 +37386138393039616333313539366538333962656161353031303432663638306334393332623063 +37653937643961333666653738613731383230623530663134396236353435313566353135376566 +65373830613433633563636334376135376530316261633930313466666461323837373031613735 +35386263383766666664366536393537303935373236666661656566346563633763393763383663 +37343030376666346365363039666234346537626134323232636364373763623332656435343533 +32346436393666383431613839373238623135336635613062373663623264366530666662353831 +36656536363832663661396331376264376235616231313937393039303634383361313038366361 +31653635666537326234323264313239616662636639656564343830303964626464616430303535 +39633864356165653735623537323438373739306566646165383436313739326662653361313038 +65383038393730313235636166363832303537353037613831653335373166663236346439313139 +32393537356630666538373237666533376661636638663433653038396331373532636364326333 +35336530346538636330646462303266656234306461613430623638623865313463376530646162 +37396436386665336266306132386164393730623836636436663831343662373732653962393936 +30303664373431643630383131393431643134383166613831363564343066653862316262316464 +39623432303565393565613034383562306434306334323433303535623666323030363265646634 +33363737353531653864356439646364313432373130363237323363663061636536363262323938 +64366530663466636239666336323963326336616233333539333534356631396466366462333130 +30616135363434386637643138323834386331653166623762356561653237613334333132303739 +61393732323735623163316134306138323936373132303934303530313431333532356634633530 +35343138376563323039343030613337396165633664353331663564636264376665616166323831 +30326566353438363438363962346332643736636163306161313239333561613831303438663332 +61346535353630643664626331303530353732393962333265333763386139623931356433373236 +39313130353538316232366533343166616332626563626462343730643934636531343364366131 +66633265663537613532383333343163313232326332333831633563616338353663623133666464 +33643837386637333335633065633865313366363236643337643034306539306661333733623231 +39366638386366313333393431636265633563653238346638333536643835383335363166633662 +34323534326533316238356439666330653532363663303464353965616262356333316466383262 +30613163323436343130366230336231613366366533343662313962306466353039666665656362 +39666164313835313266373966353037623064383863623831373739303431653330353164646534 +32326435343831636631663634396531383237313663313737343238353733333962626631313262 +62323165653133383238333162643539646237303466666533393037643262656161363338633665 +38323239346662373566336139636164333434316362386365363539383563613861666337653532 +36346332303530323365363965656263313333613530613637373761643434643336303534393633 +35353738303766646165663239303030373966343066626233383234313535626366636563326239 +33656433353032613036653732656535613837343130653939623461306261316263666466356665 +39666162623030666637666236653939383836316633323532616563656461653438623064633139 +30656635383862666361336361343238656130313263646662666534353737643964663136623133 +39616638613037313936636235346438643533646437633263616238373637356631633534656662 +39366632653430393037643437373232306631326234646463303432616337643833373330656661 +31363334653665303431663366626265623337333631396463353636313637663665346565353239 +63663334396531663931633738343733373061633335343932356665396331316564373365363437 +39373762653462326433303534323732656133353139303536623761623834333532303630326131 +34383465633239326333373562626539386262363836656237373136653566323631333334323139 +33336239306263636232343939653764373037346566333635396234393438616637633533343066 +61383961363536326337333161376331373838393331333237383261343534336562646234643662 +32633338386336643130366532303638383338343766333831643336373663383762356236616535 +35666134653531666161383537663331316633613335386134356362363336666530666534383638 +63386437303030316135306365613038316465663137346531343735613637363535653166303562 +37353265303561363866353537353062653363383066313065356639366562386461383931666638 +38646335343037663939323965303562643662313837356536326439346466333432636662333233 +62393763373736313832383534653435333861663738633931356236616434373335636233386431 +30633834626665396465383337333061306561663230653933363766623566646462623835383539 +64646564313463313430356161343431633566656233623036383337623363363230383835363639 +37363039346366623865616565373963363261643566323436323361306230363438626430333763 +66656531343431323865303036333538303230326632316662633232316164313137373039613639 +66326462333237303466303133316330636431376466623937626631393933343439633266353566 +65393163383861623566373063643330356336373863616234666364323963373662316138326439 +35363430346331383631633734653664323863636564323037333265623738383866643431353634 +64636533383933666461336462663939653032306631333636323538613139373462373837646165 +35653239323234383132623531633736333139366365323233623036393935623635373239626463 +64373162373166353666613533646665353036666639353730303037333934313135343964613933 +62323433313237356262366230633830616630393133366465326133333339393061323961623031 +30303739383235316365636134343165323632393730653437353564366631636663623837663966 +39376366303630656339386333323863356365323965656539336530643361663363303366643230 +32333638653665373363653235623264393766616636336534363935353238366431623761666361 +38303364363436326665643930393734616638393836623135316239396364396266613432353863 +33643135313931636463306265343830343536376430666437363466613431326235613832613837 +33396265616562386534393338373862353237323964353137643334386431663537653039643462 +30366432373632366135646438313632303838623939336539333639363530346536386436633362 +62383339363163613066663131326566633464646136616533383633313261383339333965313338 +66316236343231306431653237646263306539353962373762393739663364626438646439326534 +61383135356635633661653561313564303433393438616136353637656666373431343537656139 +35383433386438396237356332373937643064383938306631623735636330313335656562306466 +62633961656631353463633062313031356566373336396130316330353634336661613433613462 +61653261383732353565613033353466616264653835396363303539313066333839323930633631 +36613035363434646131653730323965333634396437353862656162356266326165393036323736 +35386338326538343162396662383932386436613234393366623035633638346430393639336133 +33376138386564363361353233323764353362313931396538633539656464623439613464386436 +32383334613635636131363966393536343738396332653961373362626134333366353939663366 +62613039366161633539393961313364396264363532653139306631376439663335393635623135 +38303737336631636661366236636464383363663261363164616538383162353962323132366433 +61653937343438363466363134343238306330313036336635626464383634646638616233393361 +32623232646365363661363839633137356633666339376437346532393330626362373765393265 +35643931383266326464306439353034323334393261373537393765333935356663616361353466 +39643037363435646663336262303739623438343062633465653835333161316439383732666265 +33376133363238663134393334326333643337383033333538326139373530353637616334633162 +34323933393764343930356332666534626133363562653636396662383663666130613639333338 +34666362656165623435653836316662323538636334323231663061336237323737653163323134 +33383462306262366163326639303564653139396232373563623332633834346537653362633430 +63663938323735653034363862663465373232376437346637646539303266353034396331306538 +66393332336431383866646535306162313531373761396562356564333033376635303165363038 +66383735386432616632366163623365623265366130306562386338623165613863663038613664 +33646165633861323964376232326134323833373066663934633565663034333335616437303164 +61323935666231623638623139626662396437303534356438633438313461613566643736323032 +34326233643637613238613433393832373938643036326565633935363661396333613038356364 +33316639303238616662313932386135633233623839376437613238346530663061613738306532 +37613565626362326435646232303830613438393436613836366139356431343761333331623936 +61333965336230386638656462636130393364393432663464383039373631303537346662383035 +30343737336235316561663763653333373161393633383734376231633537373335623833386334 +33383464346335383539343630343965366436326261366530313231633132626137363332656233 +33356637653132383463613733366465303338336633663865623762343462616561623039386166 +31663463303439316161376164663561353263356339623931356263336132313765646466353166 +39363530323236623364396539383836336138653863353631393933306339303563656638373766 +61343565656232386534646530633265396465636362393434393761363536333237366566653332 +32613730623165646333356362653036316363656661306330356162336264356563343766373263 +36393131356335306463623262366133613166346234633661376234336239353963343666313166 +34613163643963303763616533333461323833336532373538356536366634613436393231303630 +31373966386563343939656566376435356630333833643563323162633236353932306636386633 +35636532323264626461346139306636373361356639373739363934323838623933653438363839 +32636331633236383536656631346437316263656662623864663733366563323234636364656461 +61626534323934353931313630363266306131613239656462393331323930656239646464666137 +65363261376133643331666530323437653166633461373162363439316630346531616534316434 +35393162646332323531653830623632393534643132323730396637633630346461343665393565 +37623165393235346532626634363531653561666634356534306637666231613337373665393838 +63326133613531666661663636326135356439306532663138336438633938636534613035343865 +34656536366261306430656432373566396363353735366432333430396431366131663037653331 +32396532613664353436333735636431326134396335633832356334323634366532663032383038 +61306636646261353763393732366161323230326233336535613162666331386631663938633032 +34393031633063353533333663313030383964353861316162343830316233376435386331633336 +33613739333231323563666632393831653236313065373266303937393032393931333861326335 +37343235303065333435633530336231666239636364323737383739323535333939343161666431 +37323462623133343162376664636338646439386431356662383831366664623864363730303262 +38663461376662373462643331376464646533633535643230316236383965383966393131643436 +36656631373630373861623162383666303538623932303963363766343433313735616261306161 +30353934373763376536396536373663616466643863316132343731353063643439623038633935 +30363961343863663333353562366630303034386161363731663666633030643132313639316463 +31363061383535313938656534396433396466623237323962346366353033383231313832643531 +64633861623831336362343931616265633338623036383332666237653461346330393633666131 +66386636326536623362656135623037333166633230383163386234393064613165666536626131 +62623835383236363438653631326336623735326539383538393038333536343961646436653865 +34616538383763306239366237396138366163656135346438313839396232386237653734393537 +35386664333330646133343866356234643037356564356364666364306466343639316335633939 +38623834353936633133326633636464343038323539306631343863353065616338333438633135 +32343734383063363565396136666139333834366539386165373465326531323137636263303762 +31623438326464333534383761616637613636373036343038326437313131633634333136643439 +65393564383736363431373538663039633933646432356166313038383663653065343736336163 +62363738626433333033646263623661616136396566653536313832653431653663616262383464 +37636538326231376366343165346533636263363962356162656635616435313236326661346234 +65393838383431353663303961633634336334656137643230326331316132356365313730346436 +39356438656534366566313733653632623466333931343434373130343261653962346132656364 +39326637653334343763346538393836343439653738383161373566626530656430623465363034 +37636431323335376163663966323836313734643337396464623630653266656133653239383531 +66626533663130316131616162666361393839316639346564636166383736633639316539383861 +65666533353166333764666266613338346335313232323137363464383363343836356165333734 +37363037383466373264326561303161323735613131323534333464393936383663326539376634 +30393335663865623135656130373161373338666431346539303033313565333534343761633336 +36383665306534633930386331376664353561336266303330383464363130353539326534306661 +39613434663131383062616632383138643066303063323739346630343038623764643262326638 +36613733356537333664363732653534663833646363646661346566323461323239333636666564 +38323030363139663031633230303062653739386163333638363433663461653161353065323439 +38316361346232623134326162343262393231333562616437323737353230633734356634306132 +37316461303037363430366638366330633662643663336637343536393137383837656633313131 +62393161613261623961663039353934663161373262396234653865643766626432376536373831 +39346564323263393633326663353731633738363033646539346438663661353666383834313434 +3663 diff --git a/src/Controller/StripeWebhookController.php b/src/Controller/StripeWebhookController.php index 19ade5a..1f0fdae 100644 --- a/src/Controller/StripeWebhookController.php +++ b/src/Controller/StripeWebhookController.php @@ -21,13 +21,13 @@ use Symfony\Component\Routing\Attribute\Route; class StripeWebhookController extends AbstractController { - #[Route('/stripe/webhook', name: 'app_stripe_webhook', methods: ['POST'])] - public function webhook(Request $request, StripeService $stripeService, EntityManagerInterface $em, MailerService $mailerService, PayoutPdfService $pdfService, BilletOrderService $billetOrderService, AuditService $audit, CacheItemPoolInterface $cache): Response + #[Route('/webhooks/stripe/insta', name: 'app_stripe_webhook_insta', methods: ['POST'])] + public function webhookInsta(Request $request, StripeService $stripeService, EntityManagerInterface $em, MailerService $mailerService, PayoutPdfService $pdfService, BilletOrderService $billetOrderService, AuditService $audit, CacheItemPoolInterface $cache): Response { $payload = $request->getContent(); $signature = $request->headers->get('Stripe-Signature', ''); - $event = $stripeService->verifyWebhookSignature($payload, $signature); + $event = $stripeService->verifyWebhookSignatureInsta($payload, $signature); if (!$event) { return new Response('Invalid signature', 400); @@ -62,13 +62,13 @@ class StripeWebhookController extends AbstractController return new Response('OK', 200); } - #[Route('/stripe/webhook/connect', name: 'app_stripe_webhook_connect', methods: ['POST'])] - public function webhookConnect(Request $request, StripeService $stripeService, EntityManagerInterface $em): Response + #[Route('/webhooks/stripe/leger', name: 'app_stripe_webhook_leger', methods: ['POST'])] + public function webhookLeger(Request $request, StripeService $stripeService, EntityManagerInterface $em): Response { $payload = $request->getContent(); $signature = $request->headers->get('Stripe-Signature', ''); - $event = $stripeService->verifyConnectWebhookSignature($payload, $signature); + $event = $stripeService->verifyWebhookSignatureLeger($payload, $signature); if (!$event) { return new Response('Invalid signature', 400); diff --git a/src/EventSubscriber/CsrfProtectionSubscriber.php b/src/EventSubscriber/CsrfProtectionSubscriber.php index 1f09dc3..7d5b6cd 100644 --- a/src/EventSubscriber/CsrfProtectionSubscriber.php +++ b/src/EventSubscriber/CsrfProtectionSubscriber.php @@ -15,8 +15,8 @@ class CsrfProtectionSubscriber implements EventSubscriberInterface private const EXCLUDED_ROUTES = [ 'app_login', 'app_logout', - 'app_stripe_webhook', - 'app_stripe_webhook_connect', + 'app_stripe_webhook_insta', + 'app_stripe_webhook_leger', 'app_order_create', 'app_order_create_intent', 'app_account_event_reorder_categories', diff --git a/src/Service/StripeService.php b/src/Service/StripeService.php index 3a1985e..f00fa1a 100644 --- a/src/Service/StripeService.php +++ b/src/Service/StripeService.php @@ -16,26 +16,26 @@ class StripeService public function __construct( #[Autowire(env: 'STRIPE_SK')] private string $stripeSecret, - #[Autowire(env: 'STRIPE_WEBHOOK_SECRET')] private string $webhookSecret, - #[Autowire(env: 'STRIPE_WEBHOOK_SECRET_CONNECT')] private string $webhookSecretConnect, + #[Autowire(env: 'STRIPE_WEBHOOK_SECRET_INSTA')] private string $webhookSecretInsta, + #[Autowire(env: 'STRIPE_WEBHOOK_SECRET_LEGER')] private string $webhookSecretLeger, #[Autowire(env: 'OUTSIDE_URL')] private string $outsideUrl, ) { $this->stripe = new StripeClient($this->stripeSecret); } - public function verifyWebhookSignature(string $payload, string $signature): ?Event + public function verifyWebhookSignatureInsta(string $payload, string $signature): ?Event { try { - return Webhook::constructEvent($payload, $signature, $this->webhookSecret); + return Webhook::constructEvent($payload, $signature, $this->webhookSecretInsta); } catch (SignatureVerificationException) { return null; } } - public function verifyConnectWebhookSignature(string $payload, string $signature): ?Event + public function verifyWebhookSignatureLeger(string $payload, string $signature): ?Event { try { - return Webhook::constructEvent($payload, $signature, $this->webhookSecretConnect); + return Webhook::constructEvent($payload, $signature, $this->webhookSecretLeger); } catch (SignatureVerificationException) { return null; } diff --git a/tests/Controller/StripeWebhookControllerTest.php b/tests/Controller/StripeWebhookControllerTest.php index 68928a2..d90d7d9 100644 --- a/tests/Controller/StripeWebhookControllerTest.php +++ b/tests/Controller/StripeWebhookControllerTest.php @@ -25,10 +25,10 @@ class StripeWebhookControllerTest extends WebTestCase $client = static::createClient(); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn(new Event()); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn(new Event()); static::getContainer()->set(StripeService::class, $stripeService); - $client->request('POST', '/stripe/webhook', [], [], [ + $client->request('POST', '/webhooks/stripe/insta', [], [], [ 'HTTP_STRIPE_SIGNATURE' => 'valid', ], '{}'); @@ -41,10 +41,10 @@ class StripeWebhookControllerTest extends WebTestCase $client = static::createClient(); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn(null); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn(null); static::getContainer()->set(StripeService::class, $stripeService); - $client->request('POST', '/stripe/webhook', [], [], [ + $client->request('POST', '/webhooks/stripe/insta', [], [], [ 'HTTP_STRIPE_SIGNATURE' => 'invalid', ], '{}'); @@ -64,7 +64,7 @@ class StripeWebhookControllerTest extends WebTestCase $this->mockStripe($client, $event); $payload = json_encode(['related_object' => ['id' => 'acct_created']]); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); self::assertResponseIsSuccessful(); @@ -89,7 +89,7 @@ class StripeWebhookControllerTest extends WebTestCase $this->mockStripe($client, $event); $payload = json_encode(['related_object' => ['id' => 'acct_closed']]); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); self::assertResponseIsSuccessful(); @@ -113,7 +113,7 @@ class StripeWebhookControllerTest extends WebTestCase $this->mockStripe($client, $event); $payload = json_encode(['related_object' => ['id' => 'acct_upd']]); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); self::assertResponseIsSuccessful(); @@ -132,7 +132,7 @@ class StripeWebhookControllerTest extends WebTestCase $this->mockStripe($client, $event); $payload = json_encode(['related_object' => ['id' => 'acct_nonexistent']]); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); self::assertResponseIsSuccessful(); } @@ -146,7 +146,7 @@ class StripeWebhookControllerTest extends WebTestCase $this->mockStripe($client, $event); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); } @@ -171,7 +171,7 @@ class StripeWebhookControllerTest extends WebTestCase ]], ]]], ]); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); self::assertResponseIsSuccessful(); @@ -200,7 +200,7 @@ class StripeWebhookControllerTest extends WebTestCase ]], ]]], ]); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); self::assertResponseIsSuccessful(); @@ -231,7 +231,7 @@ class StripeWebhookControllerTest extends WebTestCase ]], ]]], ]); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); self::assertResponseIsSuccessful(); @@ -253,7 +253,7 @@ class StripeWebhookControllerTest extends WebTestCase 'related_object' => ['id' => 'acct_ghost'], 'changes' => ['after' => ['configuration' => []]], ]); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], $payload); self::assertResponseIsSuccessful(); } @@ -278,14 +278,14 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); $mailer = $this->createMock(MailerService::class); $mailer->expects(self::once())->method('sendEmail'); static::getContainer()->set(MailerService::class, $mailer); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); } @@ -312,7 +312,7 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); $mailer = $this->createMock(MailerService::class); @@ -323,7 +323,7 @@ class StripeWebhookControllerTest extends WebTestCase $pdfService->expects(self::once())->method('generateToFile')->willReturn('/tmp/fake.pdf'); static::getContainer()->set(PayoutPdfService::class, $pdfService); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); @@ -364,14 +364,14 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); $mailer = $this->createMock(MailerService::class); $mailer->expects(self::once())->method('sendEmail'); static::getContainer()->set(MailerService::class, $mailer); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); @@ -390,10 +390,10 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); } @@ -414,10 +414,10 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); } @@ -441,7 +441,7 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); $mailer = $this->createMock(MailerService::class); @@ -452,7 +452,7 @@ class StripeWebhookControllerTest extends WebTestCase $audit->expects(self::once())->method('log')->with('payment_failed', 'BilletBuyer', $order->getId(), $this->anything()); static::getContainer()->set(AuditService::class, $audit); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); $freshEm = static::getContainer()->get(EntityManagerInterface::class); @@ -470,10 +470,10 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); } @@ -489,10 +489,10 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); } @@ -514,10 +514,10 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); $freshEm = static::getContainer()->get(EntityManagerInterface::class); @@ -541,7 +541,7 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); $mailer = $this->createMock(MailerService::class); @@ -557,7 +557,7 @@ class StripeWebhookControllerTest extends WebTestCase ); static::getContainer()->set(AuditService::class, $audit); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); } @@ -579,7 +579,7 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); $mailer = $this->createMock(MailerService::class); @@ -589,7 +589,7 @@ class StripeWebhookControllerTest extends WebTestCase $audit = $this->createMock(AuditService::class); static::getContainer()->set(AuditService::class, $audit); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); } @@ -614,7 +614,7 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); $mailer = $this->createMock(MailerService::class); @@ -629,7 +629,7 @@ class StripeWebhookControllerTest extends WebTestCase $billetOrderService->expects(self::once())->method('notifyOrganizerCancelled')->with($this->anything(), 'remboursee'); static::getContainer()->set(BilletOrderService::class, $billetOrderService); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); $freshEm = static::getContainer()->get(EntityManagerInterface::class); @@ -662,7 +662,7 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); $mailer = $this->createMock(MailerService::class); @@ -674,7 +674,7 @@ class StripeWebhookControllerTest extends WebTestCase $billetOrderService = $this->createMock(BilletOrderService::class); static::getContainer()->set(BilletOrderService::class, $billetOrderService); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); $freshEm = static::getContainer()->get(EntityManagerInterface::class); @@ -692,10 +692,10 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); } @@ -709,10 +709,10 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); } @@ -734,10 +734,10 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); $freshEm = static::getContainer()->get(EntityManagerInterface::class); @@ -764,7 +764,7 @@ class StripeWebhookControllerTest extends WebTestCase ]); $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); $mailer = $this->createMock(MailerService::class); @@ -777,7 +777,7 @@ class StripeWebhookControllerTest extends WebTestCase $billetOrderService = $this->createMock(BilletOrderService::class); static::getContainer()->set(BilletOrderService::class, $billetOrderService); - $client->request('POST', '/stripe/webhook', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); + $client->request('POST', '/webhooks/stripe/insta', [], [], ['HTTP_STRIPE_SIGNATURE' => 'v'], '{}'); self::assertResponseIsSuccessful(); } @@ -845,7 +845,7 @@ class StripeWebhookControllerTest extends WebTestCase private function mockStripe(\Symfony\Bundle\FrameworkBundle\KernelBrowser $client, Event $event): void { $stripeService = $this->createMock(StripeService::class); - $stripeService->method('verifyWebhookSignature')->willReturn($event); + $stripeService->method('verifyWebhookSignatureInsta')->willReturn($event); static::getContainer()->set(StripeService::class, $stripeService); } } diff --git a/tests/EventSubscriber/CsrfProtectionSubscriberTest.php b/tests/EventSubscriber/CsrfProtectionSubscriberTest.php index 7494da7..95b07c9 100644 --- a/tests/EventSubscriber/CsrfProtectionSubscriberTest.php +++ b/tests/EventSubscriber/CsrfProtectionSubscriberTest.php @@ -48,8 +48,8 @@ class CsrfProtectionSubscriberTest extends TestCase { $subscriber = $this->createSubscriber(); - $request = Request::create('/stripe/webhook', 'POST'); - $request->attributes->set('_route', 'app_stripe_webhook'); + $request = Request::create('/webhooks/stripe/insta', 'POST'); + $request->attributes->set('_route', 'app_stripe_webhook_insta'); $kernel = $this->createMock(HttpKernelInterface::class); $event = new RequestEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST); diff --git a/tests/Service/StripeServiceTest.php b/tests/Service/StripeServiceTest.php index c734afb..575a620 100644 --- a/tests/Service/StripeServiceTest.php +++ b/tests/Service/StripeServiceTest.php @@ -9,16 +9,16 @@ class StripeServiceTest extends TestCase { private function createService(): StripeService { - return new StripeService('sk_test', 'whsec_test', 'whsec_connect_test', 'https://example.com'); + return new StripeService('sk_test', 'whsec_test_insta', 'whsec_test_leger', 'https://example.com'); } - public function testVerifyWebhookSignatureReturnsNullOnInvalid(): void + public function testVerifyWebhookSignatureInstaReturnsNullOnInvalid(): void { - self::assertNull($this->createService()->verifyWebhookSignature('{}', 'invalid')); + self::assertNull($this->createService()->verifyWebhookSignatureInsta('{}', 'invalid')); } - public function testVerifyConnectWebhookSignatureReturnsNullOnInvalid(): void + public function testVerifyWebhookSignatureLegerReturnsNullOnInvalid(): void { - self::assertNull($this->createService()->verifyConnectWebhookSignature('{}', 'invalid')); + self::assertNull($this->createService()->verifyWebhookSignatureLeger('{}', 'invalid')); } }