@wix/auto_sdk_subscription_subscriptions 1.0.48 → 1.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,14 +68,17 @@ __export(index_typings_exports, {
68
68
  cancelSubscription: () => cancelSubscription2,
69
69
  countSubscriptions: () => countSubscriptions2,
70
70
  customerAllowedActions: () => customerAllowedActions2,
71
+ customerCancelPendingChange: () => customerCancelPendingChange2,
71
72
  customerCancelScheduledPause: () => customerCancelScheduledPause2,
72
73
  customerCancelScheduledSkip: () => customerCancelScheduledSkip2,
73
74
  customerCancelSubscription: () => customerCancelSubscription2,
75
+ customerChangeSubscription: () => customerChangeSubscription2,
74
76
  customerExtendSubscription: () => customerExtendSubscription2,
75
77
  customerGetSubscription: () => customerGetSubscription2,
76
78
  customerInitiatePaymentMethodSetup: () => customerInitiatePaymentMethodSetup2,
77
79
  customerListUpcomingCharges: () => customerListUpcomingCharges2,
78
80
  customerPauseSubscription: () => customerPauseSubscription2,
81
+ customerPreviewChangeSubscription: () => customerPreviewChangeSubscription2,
79
82
  customerQuerySubscriptions: () => customerQuerySubscriptions2,
80
83
  customerResumeSubscription: () => customerResumeSubscription2,
81
84
  customerSkipCycle: () => customerSkipCycle2,
@@ -1026,6 +1029,146 @@ function customerUpdateBillingDate(payload) {
1026
1029
  }
1027
1030
  return __customerUpdateBillingDate;
1028
1031
  }
1032
+ function customerChangeSubscription(payload) {
1033
+ function __customerChangeSubscription({ host }) {
1034
+ const metadata = {
1035
+ entityFqdn: "wix.billing.v1.subscription",
1036
+ method: "POST",
1037
+ methodFqn: "com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.CustomerChangeSubscription",
1038
+ packageName: PACKAGE_NAME,
1039
+ migrationOptions: {
1040
+ optInTransformResponse: true
1041
+ },
1042
+ url: resolveComWixpressBillingSubscriptionsApiV1CustomerSubscriptionsServiceUrl(
1043
+ {
1044
+ protoPath: "/v1/customer_subscriptions/{subscriptionId}/change",
1045
+ data: payload,
1046
+ host
1047
+ }
1048
+ ),
1049
+ data: payload,
1050
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
1051
+ {
1052
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
1053
+ paths: [
1054
+ { path: "subscription.createdDate" },
1055
+ { path: "subscription.updatedDate" },
1056
+ { path: "subscription.startDate" },
1057
+ { path: "subscription.endDate" },
1058
+ { path: "subscription.billingStatus.nextBillingDate" },
1059
+ { path: "subscription.billingStatus.previousBillingDate" },
1060
+ {
1061
+ path: "subscription.billingStatus.latestPaymentData.initialFailedPaymentDate"
1062
+ },
1063
+ { path: "subscription.billingStatus.freeTrialData.startDate" },
1064
+ { path: "subscription.billingStatus.freeTrialData.endDate" },
1065
+ {
1066
+ path: "subscription.billingStatus.updateBillingDateData.paidUntil"
1067
+ },
1068
+ { path: "subscription.billingStatus.gracePeriodData.startDate" },
1069
+ { path: "subscription.billingStatus.gracePeriodData.endDate" },
1070
+ { path: "subscription.pauseInfo.startDate" },
1071
+ { path: "subscription.pauseInfo.resumeDate" },
1072
+ { path: "subscription.cancellationInfo.cancellationDate" },
1073
+ {
1074
+ path: "subscription.specificDatePendingUpdateData.executionDate"
1075
+ }
1076
+ ]
1077
+ }
1078
+ ])
1079
+ };
1080
+ return metadata;
1081
+ }
1082
+ return __customerChangeSubscription;
1083
+ }
1084
+ function customerPreviewChangeSubscription(payload) {
1085
+ function __customerPreviewChangeSubscription({ host }) {
1086
+ const metadata = {
1087
+ entityFqdn: "wix.billing.v1.subscription",
1088
+ method: "POST",
1089
+ methodFqn: "com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.CustomerPreviewChangeSubscription",
1090
+ packageName: PACKAGE_NAME,
1091
+ migrationOptions: {
1092
+ optInTransformResponse: true
1093
+ },
1094
+ url: resolveComWixpressBillingSubscriptionsApiV1CustomerSubscriptionsServiceUrl(
1095
+ {
1096
+ protoPath: "/v1/customer_subscriptions/{subscriptionId}/preview_change",
1097
+ data: payload,
1098
+ host
1099
+ }
1100
+ ),
1101
+ data: payload,
1102
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
1103
+ {
1104
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
1105
+ paths: [
1106
+ { path: "preview.current.periodStart" },
1107
+ { path: "preview.current.periodEnd" },
1108
+ { path: "preview.proposed.periodStart" },
1109
+ { path: "preview.proposed.periodEnd" },
1110
+ { path: "preview.proration.newPeriodEnd" },
1111
+ { path: "preview.renewalPreview.nextRenewalDate" }
1112
+ ]
1113
+ }
1114
+ ])
1115
+ };
1116
+ return metadata;
1117
+ }
1118
+ return __customerPreviewChangeSubscription;
1119
+ }
1120
+ function customerCancelPendingChange(payload) {
1121
+ function __customerCancelPendingChange({ host }) {
1122
+ const metadata = {
1123
+ entityFqdn: "wix.billing.v1.subscription",
1124
+ method: "POST",
1125
+ methodFqn: "com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.CustomerCancelPendingChange",
1126
+ packageName: PACKAGE_NAME,
1127
+ migrationOptions: {
1128
+ optInTransformResponse: true
1129
+ },
1130
+ url: resolveComWixpressBillingSubscriptionsApiV1CustomerSubscriptionsServiceUrl(
1131
+ {
1132
+ protoPath: "/v1/customer_subscriptions/{subscriptionId}/cancel_pending_change",
1133
+ data: payload,
1134
+ host
1135
+ }
1136
+ ),
1137
+ data: payload,
1138
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
1139
+ {
1140
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
1141
+ paths: [
1142
+ { path: "subscription.createdDate" },
1143
+ { path: "subscription.updatedDate" },
1144
+ { path: "subscription.startDate" },
1145
+ { path: "subscription.endDate" },
1146
+ { path: "subscription.billingStatus.nextBillingDate" },
1147
+ { path: "subscription.billingStatus.previousBillingDate" },
1148
+ {
1149
+ path: "subscription.billingStatus.latestPaymentData.initialFailedPaymentDate"
1150
+ },
1151
+ { path: "subscription.billingStatus.freeTrialData.startDate" },
1152
+ { path: "subscription.billingStatus.freeTrialData.endDate" },
1153
+ {
1154
+ path: "subscription.billingStatus.updateBillingDateData.paidUntil"
1155
+ },
1156
+ { path: "subscription.billingStatus.gracePeriodData.startDate" },
1157
+ { path: "subscription.billingStatus.gracePeriodData.endDate" },
1158
+ { path: "subscription.pauseInfo.startDate" },
1159
+ { path: "subscription.pauseInfo.resumeDate" },
1160
+ { path: "subscription.cancellationInfo.cancellationDate" },
1161
+ {
1162
+ path: "subscription.specificDatePendingUpdateData.executionDate"
1163
+ }
1164
+ ]
1165
+ }
1166
+ ])
1167
+ };
1168
+ return metadata;
1169
+ }
1170
+ return __customerCancelPendingChange;
1171
+ }
1029
1172
  function getSubscription(payload) {
1030
1173
  function __getSubscription({ host }) {
1031
1174
  const metadata = {
@@ -3730,6 +3873,20 @@ var OrderMethod = /* @__PURE__ */ ((OrderMethod2) => {
3730
3873
  OrderMethod2["NOT_MOTO"] = "NOT_MOTO";
3731
3874
  return OrderMethod2;
3732
3875
  })(OrderMethod || {});
3876
+ var ChangeEffectiveTime = /* @__PURE__ */ ((ChangeEffectiveTime2) => {
3877
+ ChangeEffectiveTime2["UNKNOWN"] = "UNKNOWN";
3878
+ ChangeEffectiveTime2["IMMEDIATELY"] = "IMMEDIATELY";
3879
+ ChangeEffectiveTime2["AT_NEXT_RENEWAL"] = "AT_NEXT_RENEWAL";
3880
+ return ChangeEffectiveTime2;
3881
+ })(ChangeEffectiveTime || {});
3882
+ var ProrationAction = /* @__PURE__ */ ((ProrationAction2) => {
3883
+ ProrationAction2["UNKNOWN"] = "UNKNOWN";
3884
+ ProrationAction2["CHARGE"] = "CHARGE";
3885
+ ProrationAction2["REFUND"] = "REFUND";
3886
+ ProrationAction2["EXTEND_PERIOD"] = "EXTEND_PERIOD";
3887
+ ProrationAction2["NO_CHANGE"] = "NO_CHANGE";
3888
+ return ProrationAction2;
3889
+ })(ProrationAction || {});
3733
3890
  var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
3734
3891
  WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
3735
3892
  WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
@@ -3817,12 +3974,6 @@ var RefundReason = /* @__PURE__ */ ((RefundReason2) => {
3817
3974
  RefundReason2["OTHER"] = "OTHER";
3818
3975
  return RefundReason2;
3819
3976
  })(RefundReason || {});
3820
- var ChangeEffectiveTime = /* @__PURE__ */ ((ChangeEffectiveTime2) => {
3821
- ChangeEffectiveTime2["UNKNOWN"] = "UNKNOWN";
3822
- ChangeEffectiveTime2["IMMEDIATELY"] = "IMMEDIATELY";
3823
- ChangeEffectiveTime2["AT_NEXT_RENEWAL"] = "AT_NEXT_RENEWAL";
3824
- return ChangeEffectiveTime2;
3825
- })(ChangeEffectiveTime || {});
3826
3977
  var ProrationBehaviorEnumProrationBehavior = /* @__PURE__ */ ((ProrationBehaviorEnumProrationBehavior2) => {
3827
3978
  ProrationBehaviorEnumProrationBehavior2["UNKNOWN"] = "UNKNOWN";
3828
3979
  ProrationBehaviorEnumProrationBehavior2["PRORATE_AND_CHARGE"] = "PRORATE_AND_CHARGE";
@@ -3831,14 +3982,6 @@ var ProrationBehaviorEnumProrationBehavior = /* @__PURE__ */ ((ProrationBehavior
3831
3982
  ProrationBehaviorEnumProrationBehavior2["NO_PRORATION"] = "NO_PRORATION";
3832
3983
  return ProrationBehaviorEnumProrationBehavior2;
3833
3984
  })(ProrationBehaviorEnumProrationBehavior || {});
3834
- var ProrationAction = /* @__PURE__ */ ((ProrationAction2) => {
3835
- ProrationAction2["UNKNOWN"] = "UNKNOWN";
3836
- ProrationAction2["CHARGE"] = "CHARGE";
3837
- ProrationAction2["REFUND"] = "REFUND";
3838
- ProrationAction2["EXTEND_PERIOD"] = "EXTEND_PERIOD";
3839
- ProrationAction2["NO_CHANGE"] = "NO_CHANGE";
3840
- return ProrationAction2;
3841
- })(ProrationAction || {});
3842
3985
  var ChangeType = /* @__PURE__ */ ((ChangeType2) => {
3843
3986
  ChangeType2["CHANGE_TYPE_UNKNOWN"] = "CHANGE_TYPE_UNKNOWN";
3844
3987
  ChangeType2["UPGRADE"] = "UPGRADE";
@@ -4522,6 +4665,119 @@ async function customerUpdateBillingDate2(_id, billingDate, options) {
4522
4665
  throw transformedError;
4523
4666
  }
4524
4667
  }
4668
+ async function customerChangeSubscription2(subscriptionId, options) {
4669
+ const { httpClient, sideEffects } = arguments[2];
4670
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
4671
+ subscriptionId,
4672
+ itemChanges: options?.itemChanges,
4673
+ newCycle: options?.newCycle,
4674
+ effectiveTime: options?.effectiveTime
4675
+ });
4676
+ const reqOpts = customerChangeSubscription(payload);
4677
+ sideEffects?.onSiteCall?.();
4678
+ try {
4679
+ const result = await httpClient.request(reqOpts);
4680
+ sideEffects?.onSuccess?.(result);
4681
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
4682
+ (0, import_transform_paths2.transformPaths)(result.data, [
4683
+ {
4684
+ transformFn: import_address2.transformRESTAddressToSDKAddress,
4685
+ paths: [
4686
+ { path: "subscription.billingSettings.billingAddress.address" },
4687
+ { path: "subscription.shippingAddress.address" }
4688
+ ]
4689
+ }
4690
+ ])
4691
+ );
4692
+ } catch (err) {
4693
+ const transformedError = (0, import_transform_error.transformError)(
4694
+ err,
4695
+ {
4696
+ spreadPathsToArguments: {},
4697
+ explicitPathsToArguments: {
4698
+ subscriptionId: "$[0]",
4699
+ itemChanges: "$[1].itemChanges",
4700
+ newCycle: "$[1].newCycle",
4701
+ effectiveTime: "$[1].effectiveTime"
4702
+ },
4703
+ singleArgumentUnchanged: false
4704
+ },
4705
+ ["subscriptionId", "options"]
4706
+ );
4707
+ sideEffects?.onError?.(err);
4708
+ throw transformedError;
4709
+ }
4710
+ }
4711
+ async function customerPreviewChangeSubscription2(subscriptionId, options) {
4712
+ const { httpClient, sideEffects } = arguments[2];
4713
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
4714
+ subscriptionId,
4715
+ itemChanges: options?.itemChanges,
4716
+ newCycle: options?.newCycle,
4717
+ effectiveTime: options?.effectiveTime
4718
+ });
4719
+ const reqOpts = customerPreviewChangeSubscription(
4720
+ payload
4721
+ );
4722
+ sideEffects?.onSiteCall?.();
4723
+ try {
4724
+ const result = await httpClient.request(reqOpts);
4725
+ sideEffects?.onSuccess?.(result);
4726
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
4727
+ } catch (err) {
4728
+ const transformedError = (0, import_transform_error.transformError)(
4729
+ err,
4730
+ {
4731
+ spreadPathsToArguments: {},
4732
+ explicitPathsToArguments: {
4733
+ subscriptionId: "$[0]",
4734
+ itemChanges: "$[1].itemChanges",
4735
+ newCycle: "$[1].newCycle",
4736
+ effectiveTime: "$[1].effectiveTime"
4737
+ },
4738
+ singleArgumentUnchanged: false
4739
+ },
4740
+ ["subscriptionId", "options"]
4741
+ );
4742
+ sideEffects?.onError?.(err);
4743
+ throw transformedError;
4744
+ }
4745
+ }
4746
+ async function customerCancelPendingChange2(subscriptionId) {
4747
+ const { httpClient, sideEffects } = arguments[1];
4748
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
4749
+ subscriptionId
4750
+ });
4751
+ const reqOpts = customerCancelPendingChange(payload);
4752
+ sideEffects?.onSiteCall?.();
4753
+ try {
4754
+ const result = await httpClient.request(reqOpts);
4755
+ sideEffects?.onSuccess?.(result);
4756
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
4757
+ (0, import_transform_paths2.transformPaths)(result.data, [
4758
+ {
4759
+ transformFn: import_address2.transformRESTAddressToSDKAddress,
4760
+ paths: [
4761
+ { path: "subscription.billingSettings.billingAddress.address" },
4762
+ { path: "subscription.shippingAddress.address" }
4763
+ ]
4764
+ }
4765
+ ])
4766
+ );
4767
+ } catch (err) {
4768
+ const transformedError = (0, import_transform_error.transformError)(
4769
+ err,
4770
+ {
4771
+ spreadPathsToArguments: {},
4772
+ explicitPathsToArguments: { subscriptionId: "$[0]" },
4773
+ singleArgumentUnchanged: false
4774
+ },
4775
+ ["subscriptionId"]
4776
+ );
4777
+ sideEffects?.onError?.(err);
4778
+ throw transformedError;
4779
+ }
4780
+ }
4525
4781
  async function getSubscription2(_id) {
4526
4782
  const { httpClient, sideEffects } = arguments[1];
4527
4783
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ id: _id });
@@ -5573,14 +5829,17 @@ async function listSubscriptionHistory2(subscriptionId, options) {
5573
5829
  cancelSubscription,
5574
5830
  countSubscriptions,
5575
5831
  customerAllowedActions,
5832
+ customerCancelPendingChange,
5576
5833
  customerCancelScheduledPause,
5577
5834
  customerCancelScheduledSkip,
5578
5835
  customerCancelSubscription,
5836
+ customerChangeSubscription,
5579
5837
  customerExtendSubscription,
5580
5838
  customerGetSubscription,
5581
5839
  customerInitiatePaymentMethodSetup,
5582
5840
  customerListUpcomingCharges,
5583
5841
  customerPauseSubscription,
5842
+ customerPreviewChangeSubscription,
5584
5843
  customerQuerySubscriptions,
5585
5844
  customerResumeSubscription,
5586
5845
  customerSkipCycle,