@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.
@@ -922,6 +922,146 @@ function customerUpdateBillingDate(payload) {
922
922
  }
923
923
  return __customerUpdateBillingDate;
924
924
  }
925
+ function customerChangeSubscription(payload) {
926
+ function __customerChangeSubscription({ host }) {
927
+ const metadata = {
928
+ entityFqdn: "wix.billing.v1.subscription",
929
+ method: "POST",
930
+ methodFqn: "com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.CustomerChangeSubscription",
931
+ packageName: PACKAGE_NAME,
932
+ migrationOptions: {
933
+ optInTransformResponse: true
934
+ },
935
+ url: resolveComWixpressBillingSubscriptionsApiV1CustomerSubscriptionsServiceUrl(
936
+ {
937
+ protoPath: "/v1/customer_subscriptions/{subscriptionId}/change",
938
+ data: payload,
939
+ host
940
+ }
941
+ ),
942
+ data: payload,
943
+ transformResponse: (payload2) => transformPaths(payload2, [
944
+ {
945
+ transformFn: transformRESTTimestampToSDKTimestamp,
946
+ paths: [
947
+ { path: "subscription.createdDate" },
948
+ { path: "subscription.updatedDate" },
949
+ { path: "subscription.startDate" },
950
+ { path: "subscription.endDate" },
951
+ { path: "subscription.billingStatus.nextBillingDate" },
952
+ { path: "subscription.billingStatus.previousBillingDate" },
953
+ {
954
+ path: "subscription.billingStatus.latestPaymentData.initialFailedPaymentDate"
955
+ },
956
+ { path: "subscription.billingStatus.freeTrialData.startDate" },
957
+ { path: "subscription.billingStatus.freeTrialData.endDate" },
958
+ {
959
+ path: "subscription.billingStatus.updateBillingDateData.paidUntil"
960
+ },
961
+ { path: "subscription.billingStatus.gracePeriodData.startDate" },
962
+ { path: "subscription.billingStatus.gracePeriodData.endDate" },
963
+ { path: "subscription.pauseInfo.startDate" },
964
+ { path: "subscription.pauseInfo.resumeDate" },
965
+ { path: "subscription.cancellationInfo.cancellationDate" },
966
+ {
967
+ path: "subscription.specificDatePendingUpdateData.executionDate"
968
+ }
969
+ ]
970
+ }
971
+ ])
972
+ };
973
+ return metadata;
974
+ }
975
+ return __customerChangeSubscription;
976
+ }
977
+ function customerPreviewChangeSubscription(payload) {
978
+ function __customerPreviewChangeSubscription({ host }) {
979
+ const metadata = {
980
+ entityFqdn: "wix.billing.v1.subscription",
981
+ method: "POST",
982
+ methodFqn: "com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.CustomerPreviewChangeSubscription",
983
+ packageName: PACKAGE_NAME,
984
+ migrationOptions: {
985
+ optInTransformResponse: true
986
+ },
987
+ url: resolveComWixpressBillingSubscriptionsApiV1CustomerSubscriptionsServiceUrl(
988
+ {
989
+ protoPath: "/v1/customer_subscriptions/{subscriptionId}/preview_change",
990
+ data: payload,
991
+ host
992
+ }
993
+ ),
994
+ data: payload,
995
+ transformResponse: (payload2) => transformPaths(payload2, [
996
+ {
997
+ transformFn: transformRESTTimestampToSDKTimestamp,
998
+ paths: [
999
+ { path: "preview.current.periodStart" },
1000
+ { path: "preview.current.periodEnd" },
1001
+ { path: "preview.proposed.periodStart" },
1002
+ { path: "preview.proposed.periodEnd" },
1003
+ { path: "preview.proration.newPeriodEnd" },
1004
+ { path: "preview.renewalPreview.nextRenewalDate" }
1005
+ ]
1006
+ }
1007
+ ])
1008
+ };
1009
+ return metadata;
1010
+ }
1011
+ return __customerPreviewChangeSubscription;
1012
+ }
1013
+ function customerCancelPendingChange(payload) {
1014
+ function __customerCancelPendingChange({ host }) {
1015
+ const metadata = {
1016
+ entityFqdn: "wix.billing.v1.subscription",
1017
+ method: "POST",
1018
+ methodFqn: "com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.CustomerCancelPendingChange",
1019
+ packageName: PACKAGE_NAME,
1020
+ migrationOptions: {
1021
+ optInTransformResponse: true
1022
+ },
1023
+ url: resolveComWixpressBillingSubscriptionsApiV1CustomerSubscriptionsServiceUrl(
1024
+ {
1025
+ protoPath: "/v1/customer_subscriptions/{subscriptionId}/cancel_pending_change",
1026
+ data: payload,
1027
+ host
1028
+ }
1029
+ ),
1030
+ data: payload,
1031
+ transformResponse: (payload2) => transformPaths(payload2, [
1032
+ {
1033
+ transformFn: transformRESTTimestampToSDKTimestamp,
1034
+ paths: [
1035
+ { path: "subscription.createdDate" },
1036
+ { path: "subscription.updatedDate" },
1037
+ { path: "subscription.startDate" },
1038
+ { path: "subscription.endDate" },
1039
+ { path: "subscription.billingStatus.nextBillingDate" },
1040
+ { path: "subscription.billingStatus.previousBillingDate" },
1041
+ {
1042
+ path: "subscription.billingStatus.latestPaymentData.initialFailedPaymentDate"
1043
+ },
1044
+ { path: "subscription.billingStatus.freeTrialData.startDate" },
1045
+ { path: "subscription.billingStatus.freeTrialData.endDate" },
1046
+ {
1047
+ path: "subscription.billingStatus.updateBillingDateData.paidUntil"
1048
+ },
1049
+ { path: "subscription.billingStatus.gracePeriodData.startDate" },
1050
+ { path: "subscription.billingStatus.gracePeriodData.endDate" },
1051
+ { path: "subscription.pauseInfo.startDate" },
1052
+ { path: "subscription.pauseInfo.resumeDate" },
1053
+ { path: "subscription.cancellationInfo.cancellationDate" },
1054
+ {
1055
+ path: "subscription.specificDatePendingUpdateData.executionDate"
1056
+ }
1057
+ ]
1058
+ }
1059
+ ])
1060
+ };
1061
+ return metadata;
1062
+ }
1063
+ return __customerCancelPendingChange;
1064
+ }
925
1065
  function getSubscription(payload) {
926
1066
  function __getSubscription({ host }) {
927
1067
  const metadata = {
@@ -3626,6 +3766,20 @@ var OrderMethod = /* @__PURE__ */ ((OrderMethod2) => {
3626
3766
  OrderMethod2["NOT_MOTO"] = "NOT_MOTO";
3627
3767
  return OrderMethod2;
3628
3768
  })(OrderMethod || {});
3769
+ var ChangeEffectiveTime = /* @__PURE__ */ ((ChangeEffectiveTime2) => {
3770
+ ChangeEffectiveTime2["UNKNOWN"] = "UNKNOWN";
3771
+ ChangeEffectiveTime2["IMMEDIATELY"] = "IMMEDIATELY";
3772
+ ChangeEffectiveTime2["AT_NEXT_RENEWAL"] = "AT_NEXT_RENEWAL";
3773
+ return ChangeEffectiveTime2;
3774
+ })(ChangeEffectiveTime || {});
3775
+ var ProrationAction = /* @__PURE__ */ ((ProrationAction2) => {
3776
+ ProrationAction2["UNKNOWN"] = "UNKNOWN";
3777
+ ProrationAction2["CHARGE"] = "CHARGE";
3778
+ ProrationAction2["REFUND"] = "REFUND";
3779
+ ProrationAction2["EXTEND_PERIOD"] = "EXTEND_PERIOD";
3780
+ ProrationAction2["NO_CHANGE"] = "NO_CHANGE";
3781
+ return ProrationAction2;
3782
+ })(ProrationAction || {});
3629
3783
  var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
3630
3784
  WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
3631
3785
  WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
@@ -3713,12 +3867,6 @@ var RefundReason = /* @__PURE__ */ ((RefundReason2) => {
3713
3867
  RefundReason2["OTHER"] = "OTHER";
3714
3868
  return RefundReason2;
3715
3869
  })(RefundReason || {});
3716
- var ChangeEffectiveTime = /* @__PURE__ */ ((ChangeEffectiveTime2) => {
3717
- ChangeEffectiveTime2["UNKNOWN"] = "UNKNOWN";
3718
- ChangeEffectiveTime2["IMMEDIATELY"] = "IMMEDIATELY";
3719
- ChangeEffectiveTime2["AT_NEXT_RENEWAL"] = "AT_NEXT_RENEWAL";
3720
- return ChangeEffectiveTime2;
3721
- })(ChangeEffectiveTime || {});
3722
3870
  var ProrationBehaviorEnumProrationBehavior = /* @__PURE__ */ ((ProrationBehaviorEnumProrationBehavior2) => {
3723
3871
  ProrationBehaviorEnumProrationBehavior2["UNKNOWN"] = "UNKNOWN";
3724
3872
  ProrationBehaviorEnumProrationBehavior2["PRORATE_AND_CHARGE"] = "PRORATE_AND_CHARGE";
@@ -3727,14 +3875,6 @@ var ProrationBehaviorEnumProrationBehavior = /* @__PURE__ */ ((ProrationBehavior
3727
3875
  ProrationBehaviorEnumProrationBehavior2["NO_PRORATION"] = "NO_PRORATION";
3728
3876
  return ProrationBehaviorEnumProrationBehavior2;
3729
3877
  })(ProrationBehaviorEnumProrationBehavior || {});
3730
- var ProrationAction = /* @__PURE__ */ ((ProrationAction2) => {
3731
- ProrationAction2["UNKNOWN"] = "UNKNOWN";
3732
- ProrationAction2["CHARGE"] = "CHARGE";
3733
- ProrationAction2["REFUND"] = "REFUND";
3734
- ProrationAction2["EXTEND_PERIOD"] = "EXTEND_PERIOD";
3735
- ProrationAction2["NO_CHANGE"] = "NO_CHANGE";
3736
- return ProrationAction2;
3737
- })(ProrationAction || {});
3738
3878
  var ChangeType = /* @__PURE__ */ ((ChangeType2) => {
3739
3879
  ChangeType2["CHANGE_TYPE_UNKNOWN"] = "CHANGE_TYPE_UNKNOWN";
3740
3880
  ChangeType2["UPGRADE"] = "UPGRADE";
@@ -4418,6 +4558,119 @@ async function customerUpdateBillingDate2(_id, billingDate, options) {
4418
4558
  throw transformedError;
4419
4559
  }
4420
4560
  }
4561
+ async function customerChangeSubscription2(subscriptionId, options) {
4562
+ const { httpClient, sideEffects } = arguments[2];
4563
+ const payload = renameKeysFromSDKRequestToRESTRequest({
4564
+ subscriptionId,
4565
+ itemChanges: options?.itemChanges,
4566
+ newCycle: options?.newCycle,
4567
+ effectiveTime: options?.effectiveTime
4568
+ });
4569
+ const reqOpts = customerChangeSubscription(payload);
4570
+ sideEffects?.onSiteCall?.();
4571
+ try {
4572
+ const result = await httpClient.request(reqOpts);
4573
+ sideEffects?.onSuccess?.(result);
4574
+ return renameKeysFromRESTResponseToSDKResponse(
4575
+ transformPaths2(result.data, [
4576
+ {
4577
+ transformFn: transformRESTAddressToSDKAddress,
4578
+ paths: [
4579
+ { path: "subscription.billingSettings.billingAddress.address" },
4580
+ { path: "subscription.shippingAddress.address" }
4581
+ ]
4582
+ }
4583
+ ])
4584
+ );
4585
+ } catch (err) {
4586
+ const transformedError = sdkTransformError(
4587
+ err,
4588
+ {
4589
+ spreadPathsToArguments: {},
4590
+ explicitPathsToArguments: {
4591
+ subscriptionId: "$[0]",
4592
+ itemChanges: "$[1].itemChanges",
4593
+ newCycle: "$[1].newCycle",
4594
+ effectiveTime: "$[1].effectiveTime"
4595
+ },
4596
+ singleArgumentUnchanged: false
4597
+ },
4598
+ ["subscriptionId", "options"]
4599
+ );
4600
+ sideEffects?.onError?.(err);
4601
+ throw transformedError;
4602
+ }
4603
+ }
4604
+ async function customerPreviewChangeSubscription2(subscriptionId, options) {
4605
+ const { httpClient, sideEffects } = arguments[2];
4606
+ const payload = renameKeysFromSDKRequestToRESTRequest({
4607
+ subscriptionId,
4608
+ itemChanges: options?.itemChanges,
4609
+ newCycle: options?.newCycle,
4610
+ effectiveTime: options?.effectiveTime
4611
+ });
4612
+ const reqOpts = customerPreviewChangeSubscription(
4613
+ payload
4614
+ );
4615
+ sideEffects?.onSiteCall?.();
4616
+ try {
4617
+ const result = await httpClient.request(reqOpts);
4618
+ sideEffects?.onSuccess?.(result);
4619
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
4620
+ } catch (err) {
4621
+ const transformedError = sdkTransformError(
4622
+ err,
4623
+ {
4624
+ spreadPathsToArguments: {},
4625
+ explicitPathsToArguments: {
4626
+ subscriptionId: "$[0]",
4627
+ itemChanges: "$[1].itemChanges",
4628
+ newCycle: "$[1].newCycle",
4629
+ effectiveTime: "$[1].effectiveTime"
4630
+ },
4631
+ singleArgumentUnchanged: false
4632
+ },
4633
+ ["subscriptionId", "options"]
4634
+ );
4635
+ sideEffects?.onError?.(err);
4636
+ throw transformedError;
4637
+ }
4638
+ }
4639
+ async function customerCancelPendingChange2(subscriptionId) {
4640
+ const { httpClient, sideEffects } = arguments[1];
4641
+ const payload = renameKeysFromSDKRequestToRESTRequest({
4642
+ subscriptionId
4643
+ });
4644
+ const reqOpts = customerCancelPendingChange(payload);
4645
+ sideEffects?.onSiteCall?.();
4646
+ try {
4647
+ const result = await httpClient.request(reqOpts);
4648
+ sideEffects?.onSuccess?.(result);
4649
+ return renameKeysFromRESTResponseToSDKResponse(
4650
+ transformPaths2(result.data, [
4651
+ {
4652
+ transformFn: transformRESTAddressToSDKAddress,
4653
+ paths: [
4654
+ { path: "subscription.billingSettings.billingAddress.address" },
4655
+ { path: "subscription.shippingAddress.address" }
4656
+ ]
4657
+ }
4658
+ ])
4659
+ );
4660
+ } catch (err) {
4661
+ const transformedError = sdkTransformError(
4662
+ err,
4663
+ {
4664
+ spreadPathsToArguments: {},
4665
+ explicitPathsToArguments: { subscriptionId: "$[0]" },
4666
+ singleArgumentUnchanged: false
4667
+ },
4668
+ ["subscriptionId"]
4669
+ );
4670
+ sideEffects?.onError?.(err);
4671
+ throw transformedError;
4672
+ }
4673
+ }
4421
4674
  async function getSubscription2(_id) {
4422
4675
  const { httpClient, sideEffects } = arguments[1];
4423
4676
  const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
@@ -5468,14 +5721,17 @@ export {
5468
5721
  cancelSubscription2 as cancelSubscription,
5469
5722
  countSubscriptions2 as countSubscriptions,
5470
5723
  customerAllowedActions2 as customerAllowedActions,
5724
+ customerCancelPendingChange2 as customerCancelPendingChange,
5471
5725
  customerCancelScheduledPause2 as customerCancelScheduledPause,
5472
5726
  customerCancelScheduledSkip2 as customerCancelScheduledSkip,
5473
5727
  customerCancelSubscription2 as customerCancelSubscription,
5728
+ customerChangeSubscription2 as customerChangeSubscription,
5474
5729
  customerExtendSubscription2 as customerExtendSubscription,
5475
5730
  customerGetSubscription2 as customerGetSubscription,
5476
5731
  customerInitiatePaymentMethodSetup2 as customerInitiatePaymentMethodSetup,
5477
5732
  customerListUpcomingCharges2 as customerListUpcomingCharges,
5478
5733
  customerPauseSubscription2 as customerPauseSubscription,
5734
+ customerPreviewChangeSubscription2 as customerPreviewChangeSubscription,
5479
5735
  customerQuerySubscriptions2 as customerQuerySubscriptions,
5480
5736
  customerResumeSubscription2 as customerResumeSubscription,
5481
5737
  customerSkipCycle2 as customerSkipCycle,