From f278e21c7aa5d365a506fcbf526a7f4a69ef006b Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Tue, 19 Dec 2023 13:12:54 +0530 Subject: [PATCH] test_stripe: Add legacy remote server schedule upgrade E2E test. --- ...pgrade_legacy_plan--Customer.create.1.json | Bin 0 -> 809 bytes ...pgrade_legacy_plan--Customer.modify.1.json | Bin 0 -> 834 bytes ...rade_legacy_plan--Customer.retrieve.1.json | Bin 0 -> 1931 bytes ...rade_legacy_plan--Customer.retrieve.2.json | Bin 0 -> 1931 bytes ...rade_legacy_plan--Customer.retrieve.3.json | Bin 0 -> 1931 bytes ...rade_legacy_plan--Customer.retrieve.4.json | Bin 0 -> 1931 bytes ...rade_legacy_plan--Customer.retrieve.5.json | Bin 0 -> 1931 bytes ...rade_legacy_plan--Customer.retrieve.6.json | Bin 0 -> 1931 bytes .../upgrade_legacy_plan--Invoice.list.1.json | Bin 0 -> 83 bytes ...ade_legacy_plan--SetupIntent.create.1.json | Bin 0 -> 930 bytes ...grade_legacy_plan--SetupIntent.list.1.json | Bin 0 -> 1116 bytes ...e_legacy_plan--SetupIntent.retrieve.1.json | Bin 0 -> 930 bytes ...egacy_plan--checkout.Session.create.1.json | Bin 0 -> 2382 bytes ..._legacy_plan--checkout.Session.list.1.json | Bin 0 -> 2772 bytes corporate/tests/test_stripe.py | 100 +++++++++++++++++- 15 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.create.1.json create mode 100644 corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.modify.1.json create mode 100644 corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.1.json create mode 100644 corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.2.json create mode 100644 corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.3.json create mode 100644 corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.4.json create mode 100644 corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.5.json create mode 100644 corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.6.json create mode 100644 corporate/tests/stripe_fixtures/upgrade_legacy_plan--Invoice.list.1.json create mode 100644 corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.create.1.json create mode 100644 corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.list.1.json create mode 100644 corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.retrieve.1.json create mode 100644 corporate/tests/stripe_fixtures/upgrade_legacy_plan--checkout.Session.create.1.json create mode 100644 corporate/tests/stripe_fixtures/upgrade_legacy_plan--checkout.Session.list.1.json diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.create.1.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.create.1.json new file mode 100644 index 0000000000000000000000000000000000000000..3d6b9bc66c1463db80771fd35472d867f52ee33e GIT binary patch literal 809 zcma))$&M2-5Qgu0im1CT zUsYe#!(zD{NU4OJhgVBqt$o%^JF?^@*mT?9GJy&dzsKA8J34Ag@bdmLSwT~^MaX~n za;T~6pGzuO<9}87!djYaMlYa{Wiqjt;MqPXxNw7sT(r26!7bNP;f3DNYSf$Im|?OE zwac8v;mFvQzb9u=?tWKmV#`0Km^RrUYZf0reg5$J{kt!3-|(2@$?FfnNQjuA&D0`$ z)ZgxmQjGuJI6g2#rpSUNIH3)!y2Q(_nNg&B$0G}evJb6`xn+*gArz!*8^cyeTt zWR~TEk9~S;4va{()jdIEby8I5skOvG1tKFIkVG!6%zwb;uC6m{J+ix816I$so0qHY zW?b{1UT?9}a;q_%oAl&bgY&F|$5ezlVa{k*(2ry6BZb`$$aWPcpv?B#Q>;>$e`8_a;Whc3HL1Brw6nuI-yxk1fc2ye#qa6uo#{`~my2_mcns literal 0 HcmV?d00001 diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.modify.1.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.modify.1.json new file mode 100644 index 0000000000000000000000000000000000000000..8eb8ed7521601a338521ee71c44e55af1a18f4cf GIT binary patch literal 834 zcma))O>Yx15Qgvh715qa)s-M2oQjkjkZ2=%-~d9FW4~@({8fL1Emi+JV<(#i4yb!t z&&NA6&&<qb+S&B#BMgX*B?KB`nF!tnElb~_FfCH5TW!? zBU{wJ?u4ARyQ>_Zh#^rV!R#$l8b+SuCD+I(@JCA{GmE_Qt&3n;zu63By;^_a(Lb#2 zlfLeM;p^>9Ylo7R_ZgAujPsF=wjdFyKJyLMSdTh+Zdi=o6FXUV`a+k=a>+A)={ZtR z21|&0M3!k^J@^qMple8BT^n-zA*BMN?PCizVXRu12swd*D1-J%JBxCrpm8U#7L7M>B3&~&lM3F~Q*m6? zQ`ULtC|#Sw48frh+K~TJGzQYA->uP}{5uy-oiW))esz6w`T6UYUl-@tX0_GYmD3Wq z4^ZnhS!S!(>If-myC58&5ko`~118t-T7yv~yr}9i@?z6q%e;ZKbW}y>N+Zw)0a+QRQI+c?k89glH5e}*_2UM81hpO{HA5x4DDZGnG7%rWn{rJldm8n-` z7%1WkO{RNTKZ|`&W<}Gx6~=z)Y%ku17-BIgLJ1jx7KF{ST4X>`R*X_mm z#WxY$&eytx|S#KT)5$>rl3XfVe>ju1*DK|SuubMt$UR6H)*9+&ihvb6Dp zOLs0AfUP&HolCj)-7PYta|O6c3+^)O_QZvb+3jF`tgJ1kz&H&C$Kiw(1Rhg{=>PPM z!{7I8+YY;u=;3%Wn|?T+O{+6}tIuXIujQ-;I<>CIS8T#8tP|H;B9B1-nf&{y2qm_| zaF}P7m+aFC`n}}FNnwD%xxLG(xYXWvr`4m$l2~(CL*w&&EKymuO%U<-h#?-(KkxU; F(I4cS4vYW* literal 0 HcmV?d00001 diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.2.json new file mode 100644 index 0000000000000000000000000000000000000000..627cebb8792ecb784f7ad8a15df0a153c7b839f6 GIT binary patch literal 1931 zcmah~O-~y!5WVv&BA*Llqm(o~wGtdE6;P?#LlLqZdp0q6ZDV^wQpA7nj5oV+XlVDe zJKytW=I!&*XvBn40b*nyN47QQ9f{_`2rB_ar}e8BT^n-zA*BMN?PCizVXRu12swd*D1-J%JBxCrpm8U#7L7M>B3&~&lM3F~Q*m6? zQ`ULtC|#Sw48frh+K~TJGzQYA->uP}{5uy-oiW))esz6w`T6UYUl-@tX0_GYmD3Wq z4^ZnhS!S!(>If-myC58&5ko`~118t-T7yv~yr}9i@?z6q%e;ZKbW}y>N+Zw)0a+QRQI+c?k89glH5e}*_2UM81hpO{HA5x4DDZGnG7%rWn{rJldm8n-` z7%1WkO{RNTKZ|`&W<}Gx6~=z)Y%ku17-BIgLJ1jx7KF{ST4X>`R*X_mm z#WxY$&eytx|S#KT)5$>rl3XfVe>ju1*DK|SuubMt$UR6H)*9+&ihvb6Dp zOLs0AfUP&HolCj)-7PYta|O6c3+^)O_QZvb+3jF`tgJ1kz&H&C$Kiw(1Rhg{=>PPM z!{7I8+YY;u=;3%Wn|?T+O{+6}tIuXIujQ-;I<>CIS8T#8tP|H;B9B1-nf&{y2qm_| zaF}P7m+aFC`n}}FNnwD%xxLG(xYXWvr`4m$l2~(CL*w&&EKymuO%U<-h#?-(KkxU; F(I4cS4vYW* literal 0 HcmV?d00001 diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.3.json new file mode 100644 index 0000000000000000000000000000000000000000..627cebb8792ecb784f7ad8a15df0a153c7b839f6 GIT binary patch literal 1931 zcmah~O-~y!5WVv&BA*Llqm(o~wGtdE6;P?#LlLqZdp0q6ZDV^wQpA7nj5oV+XlVDe zJKytW=I!&*XvBn40b*nyN47QQ9f{_`2rB_ar}e8BT^n-zA*BMN?PCizVXRu12swd*D1-J%JBxCrpm8U#7L7M>B3&~&lM3F~Q*m6? zQ`ULtC|#Sw48frh+K~TJGzQYA->uP}{5uy-oiW))esz6w`T6UYUl-@tX0_GYmD3Wq z4^ZnhS!S!(>If-myC58&5ko`~118t-T7yv~yr}9i@?z6q%e;ZKbW}y>N+Zw)0a+QRQI+c?k89glH5e}*_2UM81hpO{HA5x4DDZGnG7%rWn{rJldm8n-` z7%1WkO{RNTKZ|`&W<}Gx6~=z)Y%ku17-BIgLJ1jx7KF{ST4X>`R*X_mm z#WxY$&eytx|S#KT)5$>rl3XfVe>ju1*DK|SuubMt$UR6H)*9+&ihvb6Dp zOLs0AfUP&HolCj)-7PYta|O6c3+^)O_QZvb+3jF`tgJ1kz&H&C$Kiw(1Rhg{=>PPM z!{7I8+YY;u=;3%Wn|?T+O{+6}tIuXIujQ-;I<>CIS8T#8tP|H;B9B1-nf&{y2qm_| zaF}P7m+aFC`n}}FNnwD%xxLG(xYXWvr`4m$l2~(CL*w&&EKymuO%U<-h#?-(KkxU; F(I4cS4vYW* literal 0 HcmV?d00001 diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.4.json new file mode 100644 index 0000000000000000000000000000000000000000..627cebb8792ecb784f7ad8a15df0a153c7b839f6 GIT binary patch literal 1931 zcmah~O-~y!5WVv&BA*Llqm(o~wGtdE6;P?#LlLqZdp0q6ZDV^wQpA7nj5oV+XlVDe zJKytW=I!&*XvBn40b*nyN47QQ9f{_`2rB_ar}e8BT^n-zA*BMN?PCizVXRu12swd*D1-J%JBxCrpm8U#7L7M>B3&~&lM3F~Q*m6? zQ`ULtC|#Sw48frh+K~TJGzQYA->uP}{5uy-oiW))esz6w`T6UYUl-@tX0_GYmD3Wq z4^ZnhS!S!(>If-myC58&5ko`~118t-T7yv~yr}9i@?z6q%e;ZKbW}y>N+Zw)0a+QRQI+c?k89glH5e}*_2UM81hpO{HA5x4DDZGnG7%rWn{rJldm8n-` z7%1WkO{RNTKZ|`&W<}Gx6~=z)Y%ku17-BIgLJ1jx7KF{ST4X>`R*X_mm z#WxY$&eytx|S#KT)5$>rl3XfVe>ju1*DK|SuubMt$UR6H)*9+&ihvb6Dp zOLs0AfUP&HolCj)-7PYta|O6c3+^)O_QZvb+3jF`tgJ1kz&H&C$Kiw(1Rhg{=>PPM z!{7I8+YY;u=;3%Wn|?T+O{+6}tIuXIujQ-;I<>CIS8T#8tP|H;B9B1-nf&{y2qm_| zaF}P7m+aFC`n}}FNnwD%xxLG(xYXWvr`4m$l2~(CL*w&&EKymuO%U<-h#?-(KkxU; F(I4cS4vYW* literal 0 HcmV?d00001 diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.5.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.5.json new file mode 100644 index 0000000000000000000000000000000000000000..627cebb8792ecb784f7ad8a15df0a153c7b839f6 GIT binary patch literal 1931 zcmah~O-~y!5WVv&BA*Llqm(o~wGtdE6;P?#LlLqZdp0q6ZDV^wQpA7nj5oV+XlVDe zJKytW=I!&*XvBn40b*nyN47QQ9f{_`2rB_ar}e8BT^n-zA*BMN?PCizVXRu12swd*D1-J%JBxCrpm8U#7L7M>B3&~&lM3F~Q*m6? zQ`ULtC|#Sw48frh+K~TJGzQYA->uP}{5uy-oiW))esz6w`T6UYUl-@tX0_GYmD3Wq z4^ZnhS!S!(>If-myC58&5ko`~118t-T7yv~yr}9i@?z6q%e;ZKbW}y>N+Zw)0a+QRQI+c?k89glH5e}*_2UM81hpO{HA5x4DDZGnG7%rWn{rJldm8n-` z7%1WkO{RNTKZ|`&W<}Gx6~=z)Y%ku17-BIgLJ1jx7KF{ST4X>`R*X_mm z#WxY$&eytx|S#KT)5$>rl3XfVe>ju1*DK|SuubMt$UR6H)*9+&ihvb6Dp zOLs0AfUP&HolCj)-7PYta|O6c3+^)O_QZvb+3jF`tgJ1kz&H&C$Kiw(1Rhg{=>PPM z!{7I8+YY;u=;3%Wn|?T+O{+6}tIuXIujQ-;I<>CIS8T#8tP|H;B9B1-nf&{y2qm_| zaF}P7m+aFC`n}}FNnwD%xxLG(xYXWvr`4m$l2~(CL*w&&EKymuO%U<-h#?-(KkxU; F(I4cS4vYW* literal 0 HcmV?d00001 diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.6.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Customer.retrieve.6.json new file mode 100644 index 0000000000000000000000000000000000000000..627cebb8792ecb784f7ad8a15df0a153c7b839f6 GIT binary patch literal 1931 zcmah~O-~y!5WVv&BA*Llqm(o~wGtdE6;P?#LlLqZdp0q6ZDV^wQpA7nj5oV+XlVDe zJKytW=I!&*XvBn40b*nyN47QQ9f{_`2rB_ar}e8BT^n-zA*BMN?PCizVXRu12swd*D1-J%JBxCrpm8U#7L7M>B3&~&lM3F~Q*m6? zQ`ULtC|#Sw48frh+K~TJGzQYA->uP}{5uy-oiW))esz6w`T6UYUl-@tX0_GYmD3Wq z4^ZnhS!S!(>If-myC58&5ko`~118t-T7yv~yr}9i@?z6q%e;ZKbW}y>N+Zw)0a+QRQI+c?k89glH5e}*_2UM81hpO{HA5x4DDZGnG7%rWn{rJldm8n-` z7%1WkO{RNTKZ|`&W<}Gx6~=z)Y%ku17-BIgLJ1jx7KF{ST4X>`R*X_mm z#WxY$&eytx|S#KT)5$>rl3XfVe>ju1*DK|SuubMt$UR6H)*9+&ihvb6Dp zOLs0AfUP&HolCj)-7PYta|O6c3+^)O_QZvb+3jF`tgJ1kz&H&C$Kiw(1Rhg{=>PPM z!{7I8+YY;u=;3%Wn|?T+O{+6}tIuXIujQ-;I<>CIS8T#8tP|H;B9B1-nf&{y2qm_| zaF}P7m+aFC`n}}FNnwD%xxLG(xYXWvr`4m$l2~(CL*w&&EKymuO%U<-h#?-(KkxU; F(I4cS4vYW* literal 0 HcmV?d00001 diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Invoice.list.1.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--Invoice.list.1.json new file mode 100644 index 0000000000000000000000000000000000000000..e39960ab7254f5b071e40ef45d6574c984929f3a GIT binary patch literal 83 zcmb>CQczGzNi0cJvQmhS)dBG`5{u(=^NUh}B58>^#i?My{G_bZ Zv?vE8pkHRFpP5&dpP8Imti)Bz1pvYK7f%2H literal 0 HcmV?d00001 diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.create.1.json new file mode 100644 index 0000000000000000000000000000000000000000..c00c853dd81990dc328b0fd4dd2c00122905bffe GIT binary patch literal 930 zcmaJ=O>f&U487-91U~oB6zyTV6|f5gXp=VCx?w{hFcKXrktJ6jOVS|!eUzMRc3RX2 z!=fG^A0O%cU^vX6X_VyPrP0~fp$}u4W)#xiDTo=Sab5trNGmGH* z99+qm=#X3Vl$Sa5l8vU*Z7A~M39Na|R}Lnt?Q?OnKH}J8KCPa<&A)uNKkM7U;N@&3VhE zG8-nOMILW@jmlW*bNMZ`0v8+hpmTss!aQwONA}MAxOK`2fX$V*5h^Y1~q|)J+#?7AtCzBC#P7Dz&FEwZ)8P3#>qu z%#_`n{u0F8rhcbeK8!Z_Je#ys{S?NHF6A=Vc3A|8m8$3Q8Q!G%M8ux=_BcN~UJB1<+u2`XY(}&I literal 0 HcmV?d00001 diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--SetupIntent.retrieve.1.json new file mode 100644 index 0000000000000000000000000000000000000000..c00c853dd81990dc328b0fd4dd2c00122905bffe GIT binary patch literal 930 zcmaJ=O>f&U487-91U~oB6zyTV6|f5gXp=VCx?w{hFcKXrktJ6jOVS|!eUzMRc3RX2 z!=fG^A0O%cU^vX6X_VyPrP0~fp$}u4W)#xiDTo=Sab5trNGmGH* z99+qm=#X3Vl$Sa5l8vU*Z7A~M39Na|R}Lnt?Q?OnKH}J8KCPa<&A)uNKkM7U;N@&3VhE zG8-nOMILW@jmlW*bNMZ`0v8+hpmTss!aQwONA}MAxOK`2fX$V*5h^Y1~q|)J+#?7AtCzBC#P7Dz&FEwZ)8P3#>qu z%#_`n{u0F8rhcbeK8!Z_Je#ys{S?NHF6A=Vc3A|8m8$3Q8Q!G%M8uxXxDcvD z8lsb#QHF{gN1yG9Q6Xkx#Ly)=ykR1Q0g}!Hcxdpc&|uS}RU2xOA|smKQ&=-D1eXD! zo)?4G2ulcH+u#|M3^rItkJ#~N4+X5&C%Xt~SutEyw5CgssRDn1#4B(|AX8_{zc#*#>b z-fBNfH1>-49E4|^@b^D?q||I+X>sNK%VdN?2>Ci%+rv4JqP2Fd0kEe#JW!CKCdwza zEyymRj6q~L*(eB`H((4ayFK(`;ttJ*Lwjq(1hARTMbVY<}gjH&ew@?d2~ZH1V5T*kN4e9a5i8vxLfsyQ}^_u*Jx4U zH?EIws$wx6(~GlAz+65nY{eQIPHx&stKiQN;oK|+ zNIQ=mOHcvXs5n_Okx#RVYz&9d*ds}V?%Ao0bY+K@aA~$CtvJDDvq1ln^}>$m=gQk0M2CtOy3(7W%Zt+IL6Ys+HNpKVu!`(X zOC^~tzOBTTiF7VAp;&tZaaxU49 zfhpV@;1M6+h;@om{y!+S{ousy_m@et*}9{#dTRdEN1ev#sD1mIp(ysmMwqSLv5Bta zt#BnDjODwkJVDYol=nf4iXc})wu?wEu#f1;OtYA$&Da2!;9A1x=YM};^7pL*&sLWi z(r?-z1Une1ba5!o-x}XrjqCoyJsGx!!>fLeTs7Y_F4I?cm%n~q0=@b=;OwYL!7-TkCKl)b^^s6L*CqWUoI-E~(B zIjMP1v^@>HS}*WcHUb-aFO$YX(#OFWm6ywh@zR~-v8S3=yV0Z_g}B^bXh+NIp%>8V j0B>K8&?B65+$Z{o`D+vTqt>pm&gGZx@Ig3x?|c6O0h0lq literal 0 HcmV?d00001 diff --git a/corporate/tests/stripe_fixtures/upgrade_legacy_plan--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/upgrade_legacy_plan--checkout.Session.list.1.json new file mode 100644 index 0000000000000000000000000000000000000000..8bc8cb038e615b69d5fbfb61284e38d3302aa2c0 GIT binary patch literal 2772 zcmb_eT~p#n6n*zsSlQZrTE)Ql!BknZ%GZbrBPaq>TU|}(272gpVs}SD%m2Q&1A#zb zUv_=a*tc{0-gC}9osWaVL&u|rI$sZe;`8C*NAeq2sc%3Lm_=Ms!$XNXWGuv=tGE#1 z8;MjHgf>iA=z-2{3c^?#qT`VX4HbLByJN8l13Z}#LudG6S{RlFl8yv;xad=%AuS0b z+E5dxRV*w0Oykao3&G`>P|s7KHI^&{uwBhDDj5h8D_gQNF(&$2C}pApmJEla~H49Mq-jtV(BsV~{BDK>^lAxNU!fkmVK)Oo7P-Lp(#Aa9tC{CcTdreXi4f@>@?o(?eu>XPc$ToAe`m5LAp!RBqU|$7^R7b2ZnNCp~!Z;P-?yv2ynAKd_n^O=CAiy@aUL@!AdgNucSfRKngCd zMw3wPSjH*CX@?-%0j-VkgeI%FyoF>7F{;j56v%;@M>e0ssPaf0VH$99ur6zH zG?+MAcNdO+p=l*=Pk>Fs*c@wgGdp7`%T7e+)=UVOX2;a0Q8dHpHb`jAdIa4CbC}}_0}GXR^ky$h!8*vT#DG*Inwu5*MK8K zk}fKEiMc{6Tcczrfyg)**#XU71{p%PE}I-n3Rs992Ojb9F5HGQ;ciWX<&qP(-JZqO zYVCol@TK}opEN4HlluMpy0X;Ea_P1_ZnNqQoYNF!jc~?eS5YJ@r|dO+VFVdfE&P)# z#k+Z0Jkm_@gv?ygG1@6!xBvTXy1dT|@M^WbsQQ~WScVwv9>F)6@$ae)<3e1-pRZNK^4bG_nq zM1#)cp%^LFWxp5eO?UXhzI(x-(t92@OtIPPl_+OXv)FM*wbQX*Np_Wb@w2RtJz1yy zUMIMJI(=_Vh4=6{D0gM6GdL;thk+w9m5%2d+l z&IOg%v#0*d9V~MXH7z!yK|KoaB6_0@EpNNtm=-&@`?`m31cQeALZ9*c(m?(w)k~~# z{iWG`5{vQu#DPi%7;iF-SSzbWqvGVN&RKh%;MyddIZNCNukH$S{02+d*3QA_!9PaS BL5BbU literal 0 HcmV?d00001 diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py index bd575c76f4..c2cd404dae 100644 --- a/corporate/tests/test_stripe.py +++ b/corporate/tests/test_stripe.py @@ -603,6 +603,12 @@ class StripeTestCase(ZulipTestCase): license_management="automatic", ) + remote_server_plan_start_date = kwargs.get("remote_server_plan_start_date", None) + if remote_server_plan_start_date: + params.update( + remote_server_plan_start_date=remote_server_plan_start_date, + ) + params.update(kwargs) for key in del_args: if key in params: @@ -618,7 +624,8 @@ class StripeTestCase(ZulipTestCase): return upgrade_json_response if invoice or not talk_to_stripe or is_free_trial_offer_enabled(False): - # Upgrade already happened for free trial or invoice realms. + # Upgrade already happened for free trial, invoice realms or schedule + # upgrade for legacy remote servers. return upgrade_json_response last_stripe_payment_intent = PaymentIntent.objects.last() @@ -6091,3 +6098,94 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase): # Check sponsorship approved banner. result = self.client_get(f"{billing_base_url}/sponsorship/", subdomain="selfhosting") self.assert_in_success_response(["Zulip is sponsoring a free", "Community"], result) + + @responses.activate + @mock_stripe() + def test_upgrade_legacy_plan(self, *mocks: Mock) -> None: + # Upload data + with time_machine.travel(self.now, tick=False): + self.add_mock_response() + send_server_data_to_push_bouncer(consider_usage_statistics=False) + + # Migrate server to legacy plan. + with time_machine.travel(self.now, tick=False): + start_date = timezone_now() + end_date = add_months(start_date, months=3) + self.billing_session.migrate_customer_to_legacy_plan(start_date, end_date) + + customer = self.billing_session.get_customer() + assert customer is not None + customer_plan = get_current_plan_by_customer(customer) + assert customer_plan is not None + self.assertEqual(customer_plan.tier, CustomerPlan.TIER_SELF_HOSTED_LEGACY) + self.assertEqual(customer_plan.status, CustomerPlan.ACTIVE) + + self.login("hamlet") + hamlet = self.example_user("hamlet") + billing_base_url = self.billing_session.billing_base_url + + # Login + with time_machine.travel(self.now, tick=False): + result = self.execute_remote_billing_authentication_flow( + hamlet.delivery_email, hamlet.full_name, expect_tos=True, confirm_tos=True + ) + self.assertEqual(result.status_code, 302) + self.assertEqual(result["Location"], f"{billing_base_url}/plans/") + + # Visit '/upgrade' + with time_machine.travel(self.now, tick=False): + result = self.client_get(f"{billing_base_url}/upgrade/", subdomain="selfhosting") + self.assertEqual(result.status_code, 200) + self.assert_in_success_response(["Add card", "Schedule upgrade to Zulip Business"], result) + + # Add card and schedule upgrade + with time_machine.travel(self.now, tick=False): + self.add_card_and_upgrade( + remote_server_plan_start_date="billing_cycle_end_date", talk_to_stripe=False + ) + customer_plan.refresh_from_db() + self.assertEqual(customer_plan.status, CustomerPlan.SWITCH_PLAN_TIER_AT_PLAN_END) + self.assertEqual(customer_plan.end_date, end_date) + new_customer_plan = self.billing_session.get_next_plan(customer_plan) + assert new_customer_plan is not None + self.assertEqual(new_customer_plan.tier, CustomerPlan.TIER_SELF_HOSTED_BUSINESS) + self.assertEqual(new_customer_plan.billing_cycle_anchor, end_date) + + server_user_count = UserProfile.objects.filter(is_bot=False, is_active=True).count() + + # Visit billing page + with time_machine.travel(self.now, tick=False): + response = self.client_get(f"{billing_base_url}/billing/", subdomain="selfhosting") + for substring in [ + "(legacy plan)", + f"This is a legacy plan that ends on {end_date.strftime('%B %d, %Y')}", + f"Your plan will automatically upgrade to Zulip Business on {end_date.strftime('%B %d, %Y')}", + f"Expected charge: ${80 * server_user_count:,.2f}", + "Visa ending in 4242", + "Update card", + ]: + self.assert_in_response(substring, response) + + # Login again + result = self.execute_remote_billing_authentication_flow( + hamlet.delivery_email, hamlet.full_name, expect_tos=False, confirm_tos=False + ) + self.assertEqual(result.status_code, 302) + self.assertEqual(result["Location"], f"{billing_base_url}/billing/") + + # Downgrade + with self.assertLogs("corporate.stripe", "INFO") as m: + with time_machine.travel(self.now + timedelta(days=7), tick=False): + response = self.client_billing_patch( + "/billing/plan", + {"status": CustomerPlan.ACTIVE}, + ) + self.assert_json_success(response) + self.assertEqual( + m.output[0], + f"INFO:corporate.stripe:Change plan status: Customer.id: {customer.id}, CustomerPlan.id: {new_customer_plan.id}, status: {CustomerPlan.ENDED}", + ) + self.assertEqual( + m.output[1], + f"INFO:corporate.stripe:Change plan status: Customer.id: {customer.id}, CustomerPlan.id: {customer_plan.id}, status: {CustomerPlan.ACTIVE}", + )