File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ const email = process.argv[2];
1111const newPlan = process . argv [ 3 ]
1212const price = + process . argv [ 4 ] ;
1313const currency = process . argv [ 5 ] ;
14+ const quantity = process . argv [ 6 ] ? + process . argv [ 6 ] : undefined ;
1415
1516( async ( ) => {
1617 if ( isNaN ( price ) ) {
@@ -40,16 +41,18 @@ const currency = process.argv[5];
4041 const subscriptionId = user . app_metadata . subscription_id ;
4142 const existingQuantity = user . app_metadata . subscription_quantity ;
4243
44+ const newQuantity = quantity ?? existingQuantity ?? 1 ;
45+
4346 const { result } = await prompts ( {
4447 name : 'result' ,
4548 type : 'confirm' ,
4649 message : `Update subscription https://vendors.paddle.com/subscriptions/customers/manage/${ subscriptionId } to ${
4750 newPlan
48- } at ${
51+ } (x ${ newQuantity } ) at ${
4952 price
5053 } ${
5154 currency
52- } ?`
55+ } each ?`
5356 } ) ;
5457
5558 if ( ! result ) {
@@ -66,7 +69,7 @@ const currency = process.argv[5];
6669 vendor_id : PADDLE_ID ! ,
6770 vendor_auth_code : PADDLE_KEY ! ,
6871 subscription_id : subscriptionId ,
69- quantity : existingQuantity ?? 1 ,
72+ quantity : newQuantity ,
7073 plan_id : newPlan ,
7174 currency : currency ,
7275 recurring_price : price . toString ( ) ,
You can’t perform that action at this time.
0 commit comments