'use strict';
import { getSubscriptionFromTransactionId, storePaymentData } from '../../payments/payments/payments.js';
import { getActiveSubscriptionByWorkspaceId, changeSubscriptionStatus } from '../../payments/subscriptions/subscriptions.js';
import { getCurrentWorkspaceId } from '../../../meta/server/providers/current-workspace-id-provider.js';
import { apiCreatedResponse } from '../../../meta/server/web/responses.js';
import { subscriptionStatuses } from '../../../meta/core/resources/enums/payment-enums.js';
import { parseJsonBodyFromRequest } from '../../../../fd-toolbox/lib/utils.js';

var __defProp=Object['defineProperty'],__name=(_0x59d2d9,_0x129b9b)=>__defProp(_0x59d2d9,'name',{'value':_0x129b9b,'configurable':!![]});async function paymentVerifySuccessPostRoute(_0x30ba93){const {paymentIntentId:_0x230d07,pricingId:_0x352555}=await parseJsonBodyFromRequest(_0x30ba93),_0x3ecc6=await getCurrentWorkspaceId(),_0x211019=await getSubscriptionFromTransactionId(_0x230d07),_0x1c78b5=await getActiveSubscriptionByWorkspaceId(_0x3ecc6);return _0x1c78b5&&await changeSubscriptionStatus(_0x1c78b5['id'],subscriptionStatuses['paused']),await storePaymentData(_0x230d07,_0x211019,_0x352555),apiCreatedResponse({'isPaymentCompleted':!![]});}__name(paymentVerifySuccessPostRoute,'paymentVerifySuccessPostRoute');

export { paymentVerifySuccessPostRoute };
