@sellout/models 0.0.59 → 0.0.60
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.
- package/.dist/enums/TierStatusEnum.d.ts +5 -0
- package/.dist/enums/TierStatusEnum.js +10 -0
- package/.dist/enums/TierStatusEnum.js.map +1 -0
- package/.dist/graphql/mutations/applyPlatformFeesToAllOrganizations.mutation.d.ts +2 -0
- package/.dist/graphql/mutations/applyPlatformFeesToAllOrganizations.mutation.js +13 -0
- package/.dist/graphql/mutations/applyPlatformFeesToAllOrganizations.mutation.js.map +1 -0
- package/.dist/graphql/mutations/sendUserEmailVerification.d.ts +2 -0
- package/.dist/graphql/mutations/sendUserEmailVerification.js +15 -0
- package/.dist/graphql/mutations/sendUserEmailVerification.js.map +1 -0
- package/.dist/interfaces/ICreateOrderParams.d.ts +31 -0
- package/.dist/interfaces/ICreateOrderParams.js +3 -0
- package/.dist/interfaces/ICreateOrderParams.js.map +1 -0
- package/.dist/interfaces/IFee.d.ts +2 -2
- package/.dist/interfaces/IFee.js +7 -7
- package/.dist/interfaces/IFee.js.map +1 -1
- package/.dist/sellout-proto.js +517 -0
- package/.dist/utils/PaymentUtil.d.ts +13 -0
- package/.dist/utils/PaymentUtil.js +95 -0
- package/.dist/utils/PaymentUtil.js.map +1 -0
- package/.dist/utils/TierUtil.d.ts +11 -0
- package/.dist/utils/TierUtil.js +88 -0
- package/.dist/utils/TierUtil.js.map +1 -0
- package/package.json +4 -4
- package/src/enums/TierStatusEnum.ts +5 -0
- package/src/graphql/mutations/applyPlatformFeesToAllOrganizations.mutation.ts +9 -0
- package/src/graphql/mutations/sendUserEmailVerification.ts +12 -0
- package/src/interfaces/ICreateOrderParams.ts +34 -0
- package/src/interfaces/IFee.ts +2 -2
- package/src/proto/fee.proto +16 -0
- package/src/utils/PaymentUtil.ts +122 -0
- package/src/utils/TierUtil.ts +77 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TierStatusEnum = void 0;
|
|
4
|
+
var TierStatusEnum;
|
|
5
|
+
(function (TierStatusEnum) {
|
|
6
|
+
TierStatusEnum["InProgress"] = "In Progress";
|
|
7
|
+
TierStatusEnum["Past"] = "Past";
|
|
8
|
+
TierStatusEnum["NotStarted"] = "Not Started";
|
|
9
|
+
})(TierStatusEnum = exports.TierStatusEnum || (exports.TierStatusEnum = {}));
|
|
10
|
+
//# sourceMappingURL=TierStatusEnum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TierStatusEnum.js","sourceRoot":"","sources":["../../src/enums/TierStatusEnum.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,4CAA0B,CAAA;IAC1B,+BAAa,CAAA;IACb,4CAA0B,CAAA;AAC5B,CAAC,EAJW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAIzB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
7
|
+
const mutation = graphql_tag_1.default `
|
|
8
|
+
mutation applyPlatformFeesToAllOrganizations {
|
|
9
|
+
applyPlatformFeesToAllOrganizations
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
exports.default = mutation;
|
|
13
|
+
//# sourceMappingURL=applyPlatformFeesToAllOrganizations.mutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyPlatformFeesToAllOrganizations.mutation.js","sourceRoot":"","sources":["../../../src/graphql/mutations/applyPlatformFeesToAllOrganizations.mutation.ts"],"names":[],"mappings":";;;;;AAAA,8DAA8B;AAE9B,MAAM,QAAQ,GAAG,qBAAG,CAAA;;;;CAInB,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
7
|
+
const query = graphql_tag_1.default `
|
|
8
|
+
mutation sendUserEmailVerification {
|
|
9
|
+
sendUserEmailVerification {
|
|
10
|
+
sent
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
exports.default = query;
|
|
15
|
+
//# sourceMappingURL=sendUserEmailVerification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendUserEmailVerification.js","sourceRoot":"","sources":["../../../src/graphql/mutations/sendUserEmailVerification.ts"],"names":[],"mappings":";;;;;AACA,8DAA8B;AAE9B,MAAM,KAAK,GAAG,qBAAG,CAAA;;;;;;CAMhB,CAAC;AAEF,kBAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import IOrderCustomField from "../interfaces/IOrderCustomField";
|
|
2
|
+
import { OrderTypeEnum } from "../interfaces/IOrderType";
|
|
3
|
+
import { OrderDeliveryMethodEnum } from "../enums/OrderDeliveryMethodEnum";
|
|
4
|
+
import { PaymentMethodTypeEnum } from '../enums/PaymentMethodTypeEnum';
|
|
5
|
+
export default interface ICreateOrderParams {
|
|
6
|
+
userId: string;
|
|
7
|
+
orgId: string;
|
|
8
|
+
eventId: string;
|
|
9
|
+
tickets: ICreateOrderTicketParams[];
|
|
10
|
+
upgrades: ICreateOrderUpgradeParams[];
|
|
11
|
+
type: OrderTypeEnum;
|
|
12
|
+
promotionCode: string;
|
|
13
|
+
customFields: IOrderCustomField[];
|
|
14
|
+
deliveryMethod: OrderDeliveryMethodEnum;
|
|
15
|
+
paymentMethodType: PaymentMethodTypeEnum;
|
|
16
|
+
holdToken?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ICreateOrderTicketParams {
|
|
19
|
+
name: string;
|
|
20
|
+
ticketTypeId: string;
|
|
21
|
+
ticketTierId: string;
|
|
22
|
+
price: number;
|
|
23
|
+
rollFees: boolean;
|
|
24
|
+
seat?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ICreateOrderUpgradeParams {
|
|
27
|
+
name: string;
|
|
28
|
+
upgradeId: string;
|
|
29
|
+
price: number;
|
|
30
|
+
rollFees: boolean;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICreateOrderParams.js","sourceRoot":"","sources":["../../src/interfaces/ICreateOrderParams.ts"],"names":[],"mappings":""}
|
|
@@ -12,7 +12,7 @@ export declare enum FeeAppliedByEnum {
|
|
|
12
12
|
Stripe = "Stripe",
|
|
13
13
|
Organization = "Organization"
|
|
14
14
|
}
|
|
15
|
-
export declare enum
|
|
15
|
+
export declare enum FeeFiltersEnum {
|
|
16
16
|
Seated = "Seated",
|
|
17
17
|
CardEntry = "Card Entry",
|
|
18
18
|
CardReader = "Card Reader"
|
|
@@ -28,7 +28,7 @@ export default interface IFee {
|
|
|
28
28
|
appliedBy: FeeAppliedByEnum;
|
|
29
29
|
minAppliedToPrice?: number;
|
|
30
30
|
maxAppliedToPrice?: number;
|
|
31
|
-
filters?:
|
|
31
|
+
filters?: FeeFiltersEnum[];
|
|
32
32
|
createdBy?: string;
|
|
33
33
|
createdAt?: number;
|
|
34
34
|
updatedBy?: string;
|
package/.dist/interfaces/IFee.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FeeFiltersEnum = exports.FeeAppliedByEnum = exports.FeeAppliedToEnum = exports.FeeTypeEnum = void 0;
|
|
4
4
|
var FeeTypeEnum;
|
|
5
5
|
(function (FeeTypeEnum) {
|
|
6
6
|
FeeTypeEnum["Flat"] = "Flat";
|
|
@@ -18,10 +18,10 @@ var FeeAppliedByEnum;
|
|
|
18
18
|
FeeAppliedByEnum["Stripe"] = "Stripe";
|
|
19
19
|
FeeAppliedByEnum["Organization"] = "Organization";
|
|
20
20
|
})(FeeAppliedByEnum = exports.FeeAppliedByEnum || (exports.FeeAppliedByEnum = {}));
|
|
21
|
-
var
|
|
22
|
-
(function (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})(
|
|
21
|
+
var FeeFiltersEnum;
|
|
22
|
+
(function (FeeFiltersEnum) {
|
|
23
|
+
FeeFiltersEnum["Seated"] = "Seated";
|
|
24
|
+
FeeFiltersEnum["CardEntry"] = "Card Entry";
|
|
25
|
+
FeeFiltersEnum["CardReader"] = "Card Reader";
|
|
26
|
+
})(FeeFiltersEnum = exports.FeeFiltersEnum || (exports.FeeFiltersEnum = {}));
|
|
27
27
|
//# sourceMappingURL=IFee.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IFee.js","sourceRoot":"","sources":["../../src/interfaces/IFee.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,kCAAmB,CAAA;AACrB,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB;AAED,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;AACrB,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B;AAED,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,qCAAiB,CAAA;IACjB,iDAA6B,CAAA;AAC/B,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B;AAED,IAAY,
|
|
1
|
+
{"version":3,"file":"IFee.js","sourceRoot":"","sources":["../../src/interfaces/IFee.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,kCAAmB,CAAA;AACrB,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB;AAED,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;AACrB,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B;AAED,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,qCAAiB,CAAA;IACjB,iDAA6B,CAAA;AAC/B,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B;AAED,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,0CAAwB,CAAA;IACxB,4CAA0B,CAAA;AAC5B,CAAC,EAJW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAIzB"}
|
package/.dist/sellout-proto.js
CHANGED
|
@@ -44889,6 +44889,490 @@ $root.DeletePlatformFeeResponse = (function() {
|
|
|
44889
44889
|
return DeletePlatformFeeResponse;
|
|
44890
44890
|
})();
|
|
44891
44891
|
|
|
44892
|
+
$root.ApplyPlatformFeesToAllOrganizationsRequest = (function() {
|
|
44893
|
+
|
|
44894
|
+
/**
|
|
44895
|
+
* Properties of an ApplyPlatformFeesToAllOrganizationsRequest.
|
|
44896
|
+
* @exports IApplyPlatformFeesToAllOrganizationsRequest
|
|
44897
|
+
* @interface IApplyPlatformFeesToAllOrganizationsRequest
|
|
44898
|
+
* @property {string|null} [spanContext] ApplyPlatformFeesToAllOrganizationsRequest spanContext
|
|
44899
|
+
*/
|
|
44900
|
+
|
|
44901
|
+
/**
|
|
44902
|
+
* Constructs a new ApplyPlatformFeesToAllOrganizationsRequest.
|
|
44903
|
+
* @exports ApplyPlatformFeesToAllOrganizationsRequest
|
|
44904
|
+
* @classdesc Apply Platform Fees
|
|
44905
|
+
* @implements IApplyPlatformFeesToAllOrganizationsRequest
|
|
44906
|
+
* @constructor
|
|
44907
|
+
* @param {IApplyPlatformFeesToAllOrganizationsRequest=} [properties] Properties to set
|
|
44908
|
+
*/
|
|
44909
|
+
function ApplyPlatformFeesToAllOrganizationsRequest(properties) {
|
|
44910
|
+
if (properties)
|
|
44911
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
44912
|
+
if (properties[keys[i]] != null)
|
|
44913
|
+
this[keys[i]] = properties[keys[i]];
|
|
44914
|
+
}
|
|
44915
|
+
|
|
44916
|
+
/**
|
|
44917
|
+
* ApplyPlatformFeesToAllOrganizationsRequest spanContext.
|
|
44918
|
+
* @member {string} spanContext
|
|
44919
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsRequest
|
|
44920
|
+
* @instance
|
|
44921
|
+
*/
|
|
44922
|
+
ApplyPlatformFeesToAllOrganizationsRequest.prototype.spanContext = "";
|
|
44923
|
+
|
|
44924
|
+
/**
|
|
44925
|
+
* Creates a new ApplyPlatformFeesToAllOrganizationsRequest instance using the specified properties.
|
|
44926
|
+
* @function create
|
|
44927
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsRequest
|
|
44928
|
+
* @static
|
|
44929
|
+
* @param {IApplyPlatformFeesToAllOrganizationsRequest=} [properties] Properties to set
|
|
44930
|
+
* @returns {ApplyPlatformFeesToAllOrganizationsRequest} ApplyPlatformFeesToAllOrganizationsRequest instance
|
|
44931
|
+
*/
|
|
44932
|
+
ApplyPlatformFeesToAllOrganizationsRequest.create = function create(properties) {
|
|
44933
|
+
return new ApplyPlatformFeesToAllOrganizationsRequest(properties);
|
|
44934
|
+
};
|
|
44935
|
+
|
|
44936
|
+
/**
|
|
44937
|
+
* Encodes the specified ApplyPlatformFeesToAllOrganizationsRequest message. Does not implicitly {@link ApplyPlatformFeesToAllOrganizationsRequest.verify|verify} messages.
|
|
44938
|
+
* @function encode
|
|
44939
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsRequest
|
|
44940
|
+
* @static
|
|
44941
|
+
* @param {IApplyPlatformFeesToAllOrganizationsRequest} message ApplyPlatformFeesToAllOrganizationsRequest message or plain object to encode
|
|
44942
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
44943
|
+
* @returns {$protobuf.Writer} Writer
|
|
44944
|
+
*/
|
|
44945
|
+
ApplyPlatformFeesToAllOrganizationsRequest.encode = function encode(message, writer) {
|
|
44946
|
+
if (!writer)
|
|
44947
|
+
writer = $Writer.create();
|
|
44948
|
+
if (message.spanContext != null && Object.hasOwnProperty.call(message, "spanContext"))
|
|
44949
|
+
writer.uint32(/* id 0, wireType 2 =*/2).string(message.spanContext);
|
|
44950
|
+
return writer;
|
|
44951
|
+
};
|
|
44952
|
+
|
|
44953
|
+
/**
|
|
44954
|
+
* Encodes the specified ApplyPlatformFeesToAllOrganizationsRequest message, length delimited. Does not implicitly {@link ApplyPlatformFeesToAllOrganizationsRequest.verify|verify} messages.
|
|
44955
|
+
* @function encodeDelimited
|
|
44956
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsRequest
|
|
44957
|
+
* @static
|
|
44958
|
+
* @param {IApplyPlatformFeesToAllOrganizationsRequest} message ApplyPlatformFeesToAllOrganizationsRequest message or plain object to encode
|
|
44959
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
44960
|
+
* @returns {$protobuf.Writer} Writer
|
|
44961
|
+
*/
|
|
44962
|
+
ApplyPlatformFeesToAllOrganizationsRequest.encodeDelimited = function encodeDelimited(message, writer) {
|
|
44963
|
+
return this.encode(message, writer).ldelim();
|
|
44964
|
+
};
|
|
44965
|
+
|
|
44966
|
+
/**
|
|
44967
|
+
* Decodes an ApplyPlatformFeesToAllOrganizationsRequest message from the specified reader or buffer.
|
|
44968
|
+
* @function decode
|
|
44969
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsRequest
|
|
44970
|
+
* @static
|
|
44971
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
44972
|
+
* @param {number} [length] Message length if known beforehand
|
|
44973
|
+
* @returns {ApplyPlatformFeesToAllOrganizationsRequest} ApplyPlatformFeesToAllOrganizationsRequest
|
|
44974
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
44975
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
44976
|
+
*/
|
|
44977
|
+
ApplyPlatformFeesToAllOrganizationsRequest.decode = function decode(reader, length) {
|
|
44978
|
+
if (!(reader instanceof $Reader))
|
|
44979
|
+
reader = $Reader.create(reader);
|
|
44980
|
+
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ApplyPlatformFeesToAllOrganizationsRequest();
|
|
44981
|
+
while (reader.pos < end) {
|
|
44982
|
+
var tag = reader.uint32();
|
|
44983
|
+
switch (tag >>> 3) {
|
|
44984
|
+
case 0:
|
|
44985
|
+
message.spanContext = reader.string();
|
|
44986
|
+
break;
|
|
44987
|
+
default:
|
|
44988
|
+
reader.skipType(tag & 7);
|
|
44989
|
+
break;
|
|
44990
|
+
}
|
|
44991
|
+
}
|
|
44992
|
+
return message;
|
|
44993
|
+
};
|
|
44994
|
+
|
|
44995
|
+
/**
|
|
44996
|
+
* Decodes an ApplyPlatformFeesToAllOrganizationsRequest message from the specified reader or buffer, length delimited.
|
|
44997
|
+
* @function decodeDelimited
|
|
44998
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsRequest
|
|
44999
|
+
* @static
|
|
45000
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
45001
|
+
* @returns {ApplyPlatformFeesToAllOrganizationsRequest} ApplyPlatformFeesToAllOrganizationsRequest
|
|
45002
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
45003
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
45004
|
+
*/
|
|
45005
|
+
ApplyPlatformFeesToAllOrganizationsRequest.decodeDelimited = function decodeDelimited(reader) {
|
|
45006
|
+
if (!(reader instanceof $Reader))
|
|
45007
|
+
reader = new $Reader(reader);
|
|
45008
|
+
return this.decode(reader, reader.uint32());
|
|
45009
|
+
};
|
|
45010
|
+
|
|
45011
|
+
/**
|
|
45012
|
+
* Verifies an ApplyPlatformFeesToAllOrganizationsRequest message.
|
|
45013
|
+
* @function verify
|
|
45014
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsRequest
|
|
45015
|
+
* @static
|
|
45016
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
45017
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
45018
|
+
*/
|
|
45019
|
+
ApplyPlatformFeesToAllOrganizationsRequest.verify = function verify(message) {
|
|
45020
|
+
if (typeof message !== "object" || message === null)
|
|
45021
|
+
return "object expected";
|
|
45022
|
+
if (message.spanContext != null && message.hasOwnProperty("spanContext"))
|
|
45023
|
+
if (!$util.isString(message.spanContext))
|
|
45024
|
+
return "spanContext: string expected";
|
|
45025
|
+
return null;
|
|
45026
|
+
};
|
|
45027
|
+
|
|
45028
|
+
/**
|
|
45029
|
+
* Creates an ApplyPlatformFeesToAllOrganizationsRequest message from a plain object. Also converts values to their respective internal types.
|
|
45030
|
+
* @function fromObject
|
|
45031
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsRequest
|
|
45032
|
+
* @static
|
|
45033
|
+
* @param {Object.<string,*>} object Plain object
|
|
45034
|
+
* @returns {ApplyPlatformFeesToAllOrganizationsRequest} ApplyPlatformFeesToAllOrganizationsRequest
|
|
45035
|
+
*/
|
|
45036
|
+
ApplyPlatformFeesToAllOrganizationsRequest.fromObject = function fromObject(object) {
|
|
45037
|
+
if (object instanceof $root.ApplyPlatformFeesToAllOrganizationsRequest)
|
|
45038
|
+
return object;
|
|
45039
|
+
var message = new $root.ApplyPlatformFeesToAllOrganizationsRequest();
|
|
45040
|
+
if (object.spanContext != null)
|
|
45041
|
+
message.spanContext = String(object.spanContext);
|
|
45042
|
+
return message;
|
|
45043
|
+
};
|
|
45044
|
+
|
|
45045
|
+
/**
|
|
45046
|
+
* Creates a plain object from an ApplyPlatformFeesToAllOrganizationsRequest message. Also converts values to other types if specified.
|
|
45047
|
+
* @function toObject
|
|
45048
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsRequest
|
|
45049
|
+
* @static
|
|
45050
|
+
* @param {ApplyPlatformFeesToAllOrganizationsRequest} message ApplyPlatformFeesToAllOrganizationsRequest
|
|
45051
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
45052
|
+
* @returns {Object.<string,*>} Plain object
|
|
45053
|
+
*/
|
|
45054
|
+
ApplyPlatformFeesToAllOrganizationsRequest.toObject = function toObject(message, options) {
|
|
45055
|
+
if (!options)
|
|
45056
|
+
options = {};
|
|
45057
|
+
var object = {};
|
|
45058
|
+
if (options.defaults)
|
|
45059
|
+
object.spanContext = "";
|
|
45060
|
+
if (message.spanContext != null && message.hasOwnProperty("spanContext"))
|
|
45061
|
+
object.spanContext = message.spanContext;
|
|
45062
|
+
return object;
|
|
45063
|
+
};
|
|
45064
|
+
|
|
45065
|
+
/**
|
|
45066
|
+
* Converts this ApplyPlatformFeesToAllOrganizationsRequest to JSON.
|
|
45067
|
+
* @function toJSON
|
|
45068
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsRequest
|
|
45069
|
+
* @instance
|
|
45070
|
+
* @returns {Object.<string,*>} JSON object
|
|
45071
|
+
*/
|
|
45072
|
+
ApplyPlatformFeesToAllOrganizationsRequest.prototype.toJSON = function toJSON() {
|
|
45073
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
45074
|
+
};
|
|
45075
|
+
|
|
45076
|
+
return ApplyPlatformFeesToAllOrganizationsRequest;
|
|
45077
|
+
})();
|
|
45078
|
+
|
|
45079
|
+
$root.ApplyPlatformFeesToAllOrganizationsResponse = (function() {
|
|
45080
|
+
|
|
45081
|
+
/**
|
|
45082
|
+
* Properties of an ApplyPlatformFeesToAllOrganizationsResponse.
|
|
45083
|
+
* @exports IApplyPlatformFeesToAllOrganizationsResponse
|
|
45084
|
+
* @interface IApplyPlatformFeesToAllOrganizationsResponse
|
|
45085
|
+
* @property {StatusCode|null} [status] ApplyPlatformFeesToAllOrganizationsResponse status
|
|
45086
|
+
* @property {Array.<IError>|null} [errors] ApplyPlatformFeesToAllOrganizationsResponse errors
|
|
45087
|
+
* @property {boolean|null} [success] ApplyPlatformFeesToAllOrganizationsResponse success
|
|
45088
|
+
*/
|
|
45089
|
+
|
|
45090
|
+
/**
|
|
45091
|
+
* Constructs a new ApplyPlatformFeesToAllOrganizationsResponse.
|
|
45092
|
+
* @exports ApplyPlatformFeesToAllOrganizationsResponse
|
|
45093
|
+
* @classdesc Represents an ApplyPlatformFeesToAllOrganizationsResponse.
|
|
45094
|
+
* @implements IApplyPlatformFeesToAllOrganizationsResponse
|
|
45095
|
+
* @constructor
|
|
45096
|
+
* @param {IApplyPlatformFeesToAllOrganizationsResponse=} [properties] Properties to set
|
|
45097
|
+
*/
|
|
45098
|
+
function ApplyPlatformFeesToAllOrganizationsResponse(properties) {
|
|
45099
|
+
this.errors = [];
|
|
45100
|
+
if (properties)
|
|
45101
|
+
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
45102
|
+
if (properties[keys[i]] != null)
|
|
45103
|
+
this[keys[i]] = properties[keys[i]];
|
|
45104
|
+
}
|
|
45105
|
+
|
|
45106
|
+
/**
|
|
45107
|
+
* ApplyPlatformFeesToAllOrganizationsResponse status.
|
|
45108
|
+
* @member {StatusCode} status
|
|
45109
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsResponse
|
|
45110
|
+
* @instance
|
|
45111
|
+
*/
|
|
45112
|
+
ApplyPlatformFeesToAllOrganizationsResponse.prototype.status = 0;
|
|
45113
|
+
|
|
45114
|
+
/**
|
|
45115
|
+
* ApplyPlatformFeesToAllOrganizationsResponse errors.
|
|
45116
|
+
* @member {Array.<IError>} errors
|
|
45117
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsResponse
|
|
45118
|
+
* @instance
|
|
45119
|
+
*/
|
|
45120
|
+
ApplyPlatformFeesToAllOrganizationsResponse.prototype.errors = $util.emptyArray;
|
|
45121
|
+
|
|
45122
|
+
/**
|
|
45123
|
+
* ApplyPlatformFeesToAllOrganizationsResponse success.
|
|
45124
|
+
* @member {boolean} success
|
|
45125
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsResponse
|
|
45126
|
+
* @instance
|
|
45127
|
+
*/
|
|
45128
|
+
ApplyPlatformFeesToAllOrganizationsResponse.prototype.success = false;
|
|
45129
|
+
|
|
45130
|
+
/**
|
|
45131
|
+
* Creates a new ApplyPlatformFeesToAllOrganizationsResponse instance using the specified properties.
|
|
45132
|
+
* @function create
|
|
45133
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsResponse
|
|
45134
|
+
* @static
|
|
45135
|
+
* @param {IApplyPlatformFeesToAllOrganizationsResponse=} [properties] Properties to set
|
|
45136
|
+
* @returns {ApplyPlatformFeesToAllOrganizationsResponse} ApplyPlatformFeesToAllOrganizationsResponse instance
|
|
45137
|
+
*/
|
|
45138
|
+
ApplyPlatformFeesToAllOrganizationsResponse.create = function create(properties) {
|
|
45139
|
+
return new ApplyPlatformFeesToAllOrganizationsResponse(properties);
|
|
45140
|
+
};
|
|
45141
|
+
|
|
45142
|
+
/**
|
|
45143
|
+
* Encodes the specified ApplyPlatformFeesToAllOrganizationsResponse message. Does not implicitly {@link ApplyPlatformFeesToAllOrganizationsResponse.verify|verify} messages.
|
|
45144
|
+
* @function encode
|
|
45145
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsResponse
|
|
45146
|
+
* @static
|
|
45147
|
+
* @param {IApplyPlatformFeesToAllOrganizationsResponse} message ApplyPlatformFeesToAllOrganizationsResponse message or plain object to encode
|
|
45148
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
45149
|
+
* @returns {$protobuf.Writer} Writer
|
|
45150
|
+
*/
|
|
45151
|
+
ApplyPlatformFeesToAllOrganizationsResponse.encode = function encode(message, writer) {
|
|
45152
|
+
if (!writer)
|
|
45153
|
+
writer = $Writer.create();
|
|
45154
|
+
if (message.status != null && Object.hasOwnProperty.call(message, "status"))
|
|
45155
|
+
writer.uint32(/* id 0, wireType 0 =*/0).int32(message.status);
|
|
45156
|
+
if (message.errors != null && message.errors.length)
|
|
45157
|
+
for (var i = 0; i < message.errors.length; ++i)
|
|
45158
|
+
$root.Error.encode(message.errors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
|
|
45159
|
+
if (message.success != null && Object.hasOwnProperty.call(message, "success"))
|
|
45160
|
+
writer.uint32(/* id 2, wireType 0 =*/16).bool(message.success);
|
|
45161
|
+
return writer;
|
|
45162
|
+
};
|
|
45163
|
+
|
|
45164
|
+
/**
|
|
45165
|
+
* Encodes the specified ApplyPlatformFeesToAllOrganizationsResponse message, length delimited. Does not implicitly {@link ApplyPlatformFeesToAllOrganizationsResponse.verify|verify} messages.
|
|
45166
|
+
* @function encodeDelimited
|
|
45167
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsResponse
|
|
45168
|
+
* @static
|
|
45169
|
+
* @param {IApplyPlatformFeesToAllOrganizationsResponse} message ApplyPlatformFeesToAllOrganizationsResponse message or plain object to encode
|
|
45170
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
45171
|
+
* @returns {$protobuf.Writer} Writer
|
|
45172
|
+
*/
|
|
45173
|
+
ApplyPlatformFeesToAllOrganizationsResponse.encodeDelimited = function encodeDelimited(message, writer) {
|
|
45174
|
+
return this.encode(message, writer).ldelim();
|
|
45175
|
+
};
|
|
45176
|
+
|
|
45177
|
+
/**
|
|
45178
|
+
* Decodes an ApplyPlatformFeesToAllOrganizationsResponse message from the specified reader or buffer.
|
|
45179
|
+
* @function decode
|
|
45180
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsResponse
|
|
45181
|
+
* @static
|
|
45182
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
45183
|
+
* @param {number} [length] Message length if known beforehand
|
|
45184
|
+
* @returns {ApplyPlatformFeesToAllOrganizationsResponse} ApplyPlatformFeesToAllOrganizationsResponse
|
|
45185
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
45186
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
45187
|
+
*/
|
|
45188
|
+
ApplyPlatformFeesToAllOrganizationsResponse.decode = function decode(reader, length) {
|
|
45189
|
+
if (!(reader instanceof $Reader))
|
|
45190
|
+
reader = $Reader.create(reader);
|
|
45191
|
+
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.ApplyPlatformFeesToAllOrganizationsResponse();
|
|
45192
|
+
while (reader.pos < end) {
|
|
45193
|
+
var tag = reader.uint32();
|
|
45194
|
+
switch (tag >>> 3) {
|
|
45195
|
+
case 0:
|
|
45196
|
+
message.status = reader.int32();
|
|
45197
|
+
break;
|
|
45198
|
+
case 1:
|
|
45199
|
+
if (!(message.errors && message.errors.length))
|
|
45200
|
+
message.errors = [];
|
|
45201
|
+
message.errors.push($root.Error.decode(reader, reader.uint32()));
|
|
45202
|
+
break;
|
|
45203
|
+
case 2:
|
|
45204
|
+
message.success = reader.bool();
|
|
45205
|
+
break;
|
|
45206
|
+
default:
|
|
45207
|
+
reader.skipType(tag & 7);
|
|
45208
|
+
break;
|
|
45209
|
+
}
|
|
45210
|
+
}
|
|
45211
|
+
return message;
|
|
45212
|
+
};
|
|
45213
|
+
|
|
45214
|
+
/**
|
|
45215
|
+
* Decodes an ApplyPlatformFeesToAllOrganizationsResponse message from the specified reader or buffer, length delimited.
|
|
45216
|
+
* @function decodeDelimited
|
|
45217
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsResponse
|
|
45218
|
+
* @static
|
|
45219
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
45220
|
+
* @returns {ApplyPlatformFeesToAllOrganizationsResponse} ApplyPlatformFeesToAllOrganizationsResponse
|
|
45221
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
45222
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
45223
|
+
*/
|
|
45224
|
+
ApplyPlatformFeesToAllOrganizationsResponse.decodeDelimited = function decodeDelimited(reader) {
|
|
45225
|
+
if (!(reader instanceof $Reader))
|
|
45226
|
+
reader = new $Reader(reader);
|
|
45227
|
+
return this.decode(reader, reader.uint32());
|
|
45228
|
+
};
|
|
45229
|
+
|
|
45230
|
+
/**
|
|
45231
|
+
* Verifies an ApplyPlatformFeesToAllOrganizationsResponse message.
|
|
45232
|
+
* @function verify
|
|
45233
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsResponse
|
|
45234
|
+
* @static
|
|
45235
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
45236
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
45237
|
+
*/
|
|
45238
|
+
ApplyPlatformFeesToAllOrganizationsResponse.verify = function verify(message) {
|
|
45239
|
+
if (typeof message !== "object" || message === null)
|
|
45240
|
+
return "object expected";
|
|
45241
|
+
if (message.status != null && message.hasOwnProperty("status"))
|
|
45242
|
+
switch (message.status) {
|
|
45243
|
+
default:
|
|
45244
|
+
return "status: enum value expected";
|
|
45245
|
+
case 0:
|
|
45246
|
+
case 200:
|
|
45247
|
+
case 400:
|
|
45248
|
+
case 401:
|
|
45249
|
+
case 403:
|
|
45250
|
+
case 422:
|
|
45251
|
+
case 500:
|
|
45252
|
+
case 504:
|
|
45253
|
+
break;
|
|
45254
|
+
}
|
|
45255
|
+
if (message.errors != null && message.hasOwnProperty("errors")) {
|
|
45256
|
+
if (!Array.isArray(message.errors))
|
|
45257
|
+
return "errors: array expected";
|
|
45258
|
+
for (var i = 0; i < message.errors.length; ++i) {
|
|
45259
|
+
var error = $root.Error.verify(message.errors[i]);
|
|
45260
|
+
if (error)
|
|
45261
|
+
return "errors." + error;
|
|
45262
|
+
}
|
|
45263
|
+
}
|
|
45264
|
+
if (message.success != null && message.hasOwnProperty("success"))
|
|
45265
|
+
if (typeof message.success !== "boolean")
|
|
45266
|
+
return "success: boolean expected";
|
|
45267
|
+
return null;
|
|
45268
|
+
};
|
|
45269
|
+
|
|
45270
|
+
/**
|
|
45271
|
+
* Creates an ApplyPlatformFeesToAllOrganizationsResponse message from a plain object. Also converts values to their respective internal types.
|
|
45272
|
+
* @function fromObject
|
|
45273
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsResponse
|
|
45274
|
+
* @static
|
|
45275
|
+
* @param {Object.<string,*>} object Plain object
|
|
45276
|
+
* @returns {ApplyPlatformFeesToAllOrganizationsResponse} ApplyPlatformFeesToAllOrganizationsResponse
|
|
45277
|
+
*/
|
|
45278
|
+
ApplyPlatformFeesToAllOrganizationsResponse.fromObject = function fromObject(object) {
|
|
45279
|
+
if (object instanceof $root.ApplyPlatformFeesToAllOrganizationsResponse)
|
|
45280
|
+
return object;
|
|
45281
|
+
var message = new $root.ApplyPlatformFeesToAllOrganizationsResponse();
|
|
45282
|
+
switch (object.status) {
|
|
45283
|
+
case "UNKNOWN_CODE":
|
|
45284
|
+
case 0:
|
|
45285
|
+
message.status = 0;
|
|
45286
|
+
break;
|
|
45287
|
+
case "OK":
|
|
45288
|
+
case 200:
|
|
45289
|
+
message.status = 200;
|
|
45290
|
+
break;
|
|
45291
|
+
case "BAD_REQUEST":
|
|
45292
|
+
case 400:
|
|
45293
|
+
message.status = 400;
|
|
45294
|
+
break;
|
|
45295
|
+
case "UNAUTHORIZED":
|
|
45296
|
+
case 401:
|
|
45297
|
+
message.status = 401;
|
|
45298
|
+
break;
|
|
45299
|
+
case "FORBIDDEN":
|
|
45300
|
+
case 403:
|
|
45301
|
+
message.status = 403;
|
|
45302
|
+
break;
|
|
45303
|
+
case "UNPROCESSABLE_ENTITY":
|
|
45304
|
+
case 422:
|
|
45305
|
+
message.status = 422;
|
|
45306
|
+
break;
|
|
45307
|
+
case "INTERNAL_SERVER_ERROR":
|
|
45308
|
+
case 500:
|
|
45309
|
+
message.status = 500;
|
|
45310
|
+
break;
|
|
45311
|
+
case "GATEWAY_TIMEOUT":
|
|
45312
|
+
case 504:
|
|
45313
|
+
message.status = 504;
|
|
45314
|
+
break;
|
|
45315
|
+
}
|
|
45316
|
+
if (object.errors) {
|
|
45317
|
+
if (!Array.isArray(object.errors))
|
|
45318
|
+
throw TypeError(".ApplyPlatformFeesToAllOrganizationsResponse.errors: array expected");
|
|
45319
|
+
message.errors = [];
|
|
45320
|
+
for (var i = 0; i < object.errors.length; ++i) {
|
|
45321
|
+
if (typeof object.errors[i] !== "object")
|
|
45322
|
+
throw TypeError(".ApplyPlatformFeesToAllOrganizationsResponse.errors: object expected");
|
|
45323
|
+
message.errors[i] = $root.Error.fromObject(object.errors[i]);
|
|
45324
|
+
}
|
|
45325
|
+
}
|
|
45326
|
+
if (object.success != null)
|
|
45327
|
+
message.success = Boolean(object.success);
|
|
45328
|
+
return message;
|
|
45329
|
+
};
|
|
45330
|
+
|
|
45331
|
+
/**
|
|
45332
|
+
* Creates a plain object from an ApplyPlatformFeesToAllOrganizationsResponse message. Also converts values to other types if specified.
|
|
45333
|
+
* @function toObject
|
|
45334
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsResponse
|
|
45335
|
+
* @static
|
|
45336
|
+
* @param {ApplyPlatformFeesToAllOrganizationsResponse} message ApplyPlatformFeesToAllOrganizationsResponse
|
|
45337
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
45338
|
+
* @returns {Object.<string,*>} Plain object
|
|
45339
|
+
*/
|
|
45340
|
+
ApplyPlatformFeesToAllOrganizationsResponse.toObject = function toObject(message, options) {
|
|
45341
|
+
if (!options)
|
|
45342
|
+
options = {};
|
|
45343
|
+
var object = {};
|
|
45344
|
+
if (options.arrays || options.defaults)
|
|
45345
|
+
object.errors = [];
|
|
45346
|
+
if (options.defaults) {
|
|
45347
|
+
object.status = options.enums === String ? "UNKNOWN_CODE" : 0;
|
|
45348
|
+
object.success = false;
|
|
45349
|
+
}
|
|
45350
|
+
if (message.status != null && message.hasOwnProperty("status"))
|
|
45351
|
+
object.status = options.enums === String ? $root.StatusCode[message.status] : message.status;
|
|
45352
|
+
if (message.errors && message.errors.length) {
|
|
45353
|
+
object.errors = [];
|
|
45354
|
+
for (var j = 0; j < message.errors.length; ++j)
|
|
45355
|
+
object.errors[j] = $root.Error.toObject(message.errors[j], options);
|
|
45356
|
+
}
|
|
45357
|
+
if (message.success != null && message.hasOwnProperty("success"))
|
|
45358
|
+
object.success = message.success;
|
|
45359
|
+
return object;
|
|
45360
|
+
};
|
|
45361
|
+
|
|
45362
|
+
/**
|
|
45363
|
+
* Converts this ApplyPlatformFeesToAllOrganizationsResponse to JSON.
|
|
45364
|
+
* @function toJSON
|
|
45365
|
+
* @memberof ApplyPlatformFeesToAllOrganizationsResponse
|
|
45366
|
+
* @instance
|
|
45367
|
+
* @returns {Object.<string,*>} JSON object
|
|
45368
|
+
*/
|
|
45369
|
+
ApplyPlatformFeesToAllOrganizationsResponse.prototype.toJSON = function toJSON() {
|
|
45370
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
45371
|
+
};
|
|
45372
|
+
|
|
45373
|
+
return ApplyPlatformFeesToAllOrganizationsResponse;
|
|
45374
|
+
})();
|
|
45375
|
+
|
|
44892
45376
|
$root.FeeService = (function() {
|
|
44893
45377
|
|
|
44894
45378
|
/**
|
|
@@ -45416,6 +45900,39 @@ $root.FeeService = (function() {
|
|
|
45416
45900
|
* @variation 2
|
|
45417
45901
|
*/
|
|
45418
45902
|
|
|
45903
|
+
/**
|
|
45904
|
+
* Callback as used by {@link FeeService#applyPlatformFeesToAllOrganizations}.
|
|
45905
|
+
* @memberof FeeService
|
|
45906
|
+
* @typedef applyPlatformFeesToAllOrganizationsCallback
|
|
45907
|
+
* @type {function}
|
|
45908
|
+
* @param {Error|null} error Error, if any
|
|
45909
|
+
* @param {ApplyPlatformFeesToAllOrganizationsResponse} [response] ApplyPlatformFeesToAllOrganizationsResponse
|
|
45910
|
+
*/
|
|
45911
|
+
|
|
45912
|
+
/**
|
|
45913
|
+
* Calls applyPlatformFeesToAllOrganizations.
|
|
45914
|
+
* @function applyPlatformFeesToAllOrganizations
|
|
45915
|
+
* @memberof FeeService
|
|
45916
|
+
* @instance
|
|
45917
|
+
* @param {IApplyPlatformFeesToAllOrganizationsRequest} request ApplyPlatformFeesToAllOrganizationsRequest message or plain object
|
|
45918
|
+
* @param {FeeService.applyPlatformFeesToAllOrganizationsCallback} callback Node-style callback called with the error, if any, and ApplyPlatformFeesToAllOrganizationsResponse
|
|
45919
|
+
* @returns {undefined}
|
|
45920
|
+
* @variation 1
|
|
45921
|
+
*/
|
|
45922
|
+
Object.defineProperty(FeeService.prototype.applyPlatformFeesToAllOrganizations = function applyPlatformFeesToAllOrganizations(request, callback) {
|
|
45923
|
+
return this.rpcCall(applyPlatformFeesToAllOrganizations, $root.ApplyPlatformFeesToAllOrganizationsRequest, $root.ApplyPlatformFeesToAllOrganizationsResponse, request, callback);
|
|
45924
|
+
}, "name", { value: "applyPlatformFeesToAllOrganizations" });
|
|
45925
|
+
|
|
45926
|
+
/**
|
|
45927
|
+
* Calls applyPlatformFeesToAllOrganizations.
|
|
45928
|
+
* @function applyPlatformFeesToAllOrganizations
|
|
45929
|
+
* @memberof FeeService
|
|
45930
|
+
* @instance
|
|
45931
|
+
* @param {IApplyPlatformFeesToAllOrganizationsRequest} request ApplyPlatformFeesToAllOrganizationsRequest message or plain object
|
|
45932
|
+
* @returns {Promise<ApplyPlatformFeesToAllOrganizationsResponse>} Promise
|
|
45933
|
+
* @variation 2
|
|
45934
|
+
*/
|
|
45935
|
+
|
|
45419
45936
|
return FeeService;
|
|
45420
45937
|
})();
|
|
45421
45938
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ICreateOrderTicketParams, ICreateOrderUpgradeParams } from '../interfaces/ICreateOrderParams';
|
|
2
|
+
import IFee from '../interfaces/IFee';
|
|
3
|
+
import { PaymentMethodTypeEnum } from '../enums/PaymentMethodTypeEnum';
|
|
4
|
+
interface IPaymentCalculatorParams {
|
|
5
|
+
tickets: ICreateOrderTicketParams[];
|
|
6
|
+
upgrades: ICreateOrderUpgradeParams[];
|
|
7
|
+
fees: IFee[];
|
|
8
|
+
paymentMethodType: PaymentMethodTypeEnum;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: {
|
|
11
|
+
calculateTotal(params: IPaymentCalculatorParams): number;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const IFee_1 = require("../interfaces/IFee");
|
|
4
|
+
const PaymentMethodTypeEnum_1 = require("../enums/PaymentMethodTypeEnum");
|
|
5
|
+
exports.default = {
|
|
6
|
+
calculateTotal(params) {
|
|
7
|
+
const { tickets = [], upgrades = [], fees = [], paymentMethodType, } = params;
|
|
8
|
+
console.log(fees);
|
|
9
|
+
// No items, total is always 0
|
|
10
|
+
if (!tickets.length && !upgrades.length)
|
|
11
|
+
return 0;
|
|
12
|
+
const ticketFees = fees.filter(f => f.appliedTo === IFee_1.FeeAppliedToEnum.Ticket);
|
|
13
|
+
const upgradeFees = fees.filter(f => f.appliedTo === IFee_1.FeeAppliedToEnum.Upgrade);
|
|
14
|
+
// Orders mattes here. Flat type fees must be applied before Percent type fees
|
|
15
|
+
const orderFees = fees.filter(f => f.appliedTo === IFee_1.FeeAppliedToEnum.Order).sort(({ type }) => {
|
|
16
|
+
if (type === 'Flat')
|
|
17
|
+
return -1;
|
|
18
|
+
return 1;
|
|
19
|
+
});
|
|
20
|
+
function applyTicketFee(ticket, fee) {
|
|
21
|
+
// // Ignore rolled fees
|
|
22
|
+
// if (ticket.rollFees) {
|
|
23
|
+
// return 0;
|
|
24
|
+
// }
|
|
25
|
+
// Ignore seated fees
|
|
26
|
+
if (fee.filters && fee.filters.includes(IFee_1.FeeFiltersEnum.Seated) && !ticket.seat) {
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
// Ignore card reader fees for non card reader payemnts
|
|
30
|
+
if (fee.filters && fee.filters.includes(IFee_1.FeeFiltersEnum.CardReader) && paymentMethodType !== PaymentMethodTypeEnum_1.PaymentMethodTypeEnum.CardReader) {
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
// Ignore card entry fees for non card entry payemnts
|
|
34
|
+
if (fee.filters && fee.filters.includes(IFee_1.FeeFiltersEnum.CardEntry) && paymentMethodType !== PaymentMethodTypeEnum_1.PaymentMethodTypeEnum.CardEntry) {
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
const minFee = fee.minAppliedToPrice || 0;
|
|
38
|
+
const maxFee = fee.maxAppliedToPrice || Infinity;
|
|
39
|
+
if (minFee <= ticket.price && ticket.price <= maxFee) {
|
|
40
|
+
if (fee.type === IFee_1.FeeTypeEnum.Flat) {
|
|
41
|
+
return fee.value;
|
|
42
|
+
}
|
|
43
|
+
if (fee.type === IFee_1.FeeTypeEnum.Percent) {
|
|
44
|
+
return (ticket.price * fee.value / 100);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
function applyUpgradeFee(upgrade, fee) {
|
|
53
|
+
// // Ignore rolled fees
|
|
54
|
+
// if (upgrade.rollFees) {
|
|
55
|
+
// return 0;
|
|
56
|
+
// }
|
|
57
|
+
const minFee = fee.minAppliedToPrice || 0;
|
|
58
|
+
const maxFee = fee.maxAppliedToPrice || Infinity;
|
|
59
|
+
if (minFee <= upgrade.price && upgrade.price <= maxFee) {
|
|
60
|
+
if (fee.type === IFee_1.FeeTypeEnum.Flat) {
|
|
61
|
+
return fee.value;
|
|
62
|
+
}
|
|
63
|
+
if (fee.type === IFee_1.FeeTypeEnum.Percent) {
|
|
64
|
+
return (upgrade.price * fee.value / 100);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
return 0;
|
|
69
|
+
}
|
|
70
|
+
return 0;
|
|
71
|
+
}
|
|
72
|
+
function applyOrderFee(orderSubtotal, fee) {
|
|
73
|
+
if (fee.type === IFee_1.FeeTypeEnum.Flat) {
|
|
74
|
+
return orderSubtotal + fee.value;
|
|
75
|
+
}
|
|
76
|
+
if (fee.type === IFee_1.FeeTypeEnum.Percent) {
|
|
77
|
+
return (orderSubtotal / (1 - fee.value / 100));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const ticketTotal = tickets.reduce((cur, ticket) => cur + ticket.price, 0);
|
|
81
|
+
const ticketFeeTotal = tickets.reduce((cur, ticket) => {
|
|
82
|
+
return cur + ticketFees.reduce((cur, fee) => cur + applyTicketFee(ticket, fee), 0);
|
|
83
|
+
}, 0);
|
|
84
|
+
const upgradeTotal = upgrades.reduce((cur, upgrade) => cur + upgrade.price, 0);
|
|
85
|
+
const upgradeFeeTotal = upgrades.reduce((cur, upgrade) => {
|
|
86
|
+
return cur + upgradeFees.reduce((cur, fee) => cur + applyUpgradeFee(upgrade, fee), 0);
|
|
87
|
+
}, 0);
|
|
88
|
+
const orderSubtotal = ticketTotal + ticketFeeTotal + upgradeTotal + upgradeFeeTotal;
|
|
89
|
+
const orderTotal = orderFees.reduce((cur, fee) => {
|
|
90
|
+
return applyOrderFee(cur, fee);
|
|
91
|
+
}, orderSubtotal);
|
|
92
|
+
return Math.round(orderTotal);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=PaymentUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaymentUtil.js","sourceRoot":"","sources":["../../src/utils/PaymentUtil.ts"],"names":[],"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G,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;YACvD,OAAO,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,eAAe,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACxF,CAAC,EAAE,CAAC,CAAC,CAAC;QAEN,MAAM,aAAa,GAAG,WAAW,GAAG,cAAc,GAAG,YAAY,GAAG,eAAe,CAAC;QAEpF,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAC/C,OAAO,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACjC,CAAC,EAAE,aAAa,CAAC,CAAC;QAElB,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import ITicketType from '../interfaces/ITicketType';
|
|
2
|
+
import ITicketTier from "../interfaces/ITicketTier";
|
|
3
|
+
import { TierStatusEnum } from "../enums/TierStatusEnum";
|
|
4
|
+
declare const _default: {
|
|
5
|
+
isPastTier(ticketType: ITicketType, tier: ITicketTier): boolean;
|
|
6
|
+
isInProgress(ticketType: ITicketType, tier: ITicketTier): boolean;
|
|
7
|
+
isNotStarted(ticketType: ITicketType, tier: ITicketTier): boolean;
|
|
8
|
+
currentTier(ticketType: ITicketType): ITicketTier | null;
|
|
9
|
+
tierStatus(ticketType: ITicketType, tier: ITicketTier): TierStatusEnum;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
const TierStatusEnum_1 = require("../enums/TierStatusEnum");
|
|
23
|
+
const Time = __importStar(require("@sellout/utils/.dist/time"));
|
|
24
|
+
exports.default = {
|
|
25
|
+
isPastTier(ticketType, tier) {
|
|
26
|
+
const now = Time.now();
|
|
27
|
+
const endsAt = tier === null || tier === void 0 ? void 0 : tier.endsAt;
|
|
28
|
+
if (tier.remainingQty === 0)
|
|
29
|
+
return true;
|
|
30
|
+
if (!endsAt || now <= endsAt)
|
|
31
|
+
return false;
|
|
32
|
+
else
|
|
33
|
+
return true;
|
|
34
|
+
},
|
|
35
|
+
isInProgress(ticketType, tier) {
|
|
36
|
+
var _a;
|
|
37
|
+
const now = Time.now();
|
|
38
|
+
// const startsAt = tier?.startsAt;
|
|
39
|
+
const endsAt = tier === null || tier === void 0 ? void 0 : tier.endsAt;
|
|
40
|
+
const remainingQty = tier.remainingQty;
|
|
41
|
+
const tierIndex = ticketType === null || ticketType === void 0 ? void 0 : ticketType.tiers.map((tier) => tier._id).indexOf(tier._id);
|
|
42
|
+
let previousTier = null;
|
|
43
|
+
if (tierIndex && tierIndex > -1) {
|
|
44
|
+
const previousTierIndex = tierIndex - 1;
|
|
45
|
+
previousTier = (_a = ticketType === null || ticketType === void 0 ? void 0 : ticketType.tiers[previousTierIndex]) !== null && _a !== void 0 ? _a : null;
|
|
46
|
+
}
|
|
47
|
+
const previousTierIsPast = previousTier
|
|
48
|
+
? this.isPastTier(ticketType, previousTier)
|
|
49
|
+
: true;
|
|
50
|
+
const hasBegun = previousTierIsPast;
|
|
51
|
+
const hasEnded = remainingQty <= 0 || (endsAt && endsAt < now);
|
|
52
|
+
return hasBegun && !hasEnded;
|
|
53
|
+
},
|
|
54
|
+
isNotStarted(ticketType, tier) {
|
|
55
|
+
var _a;
|
|
56
|
+
const now = Time.now();
|
|
57
|
+
// const startsAt = tier?.startsAt;
|
|
58
|
+
const endsAt = tier === null || tier === void 0 ? void 0 : tier.endsAt;
|
|
59
|
+
const remainingQty = tier.remainingQty;
|
|
60
|
+
const tierIndex = ticketType === null || ticketType === void 0 ? void 0 : ticketType.tiers.map((tier) => tier._id).indexOf(tier._id);
|
|
61
|
+
let previousTier = null;
|
|
62
|
+
if (tierIndex && tierIndex > -1) {
|
|
63
|
+
const previousTierIndex = tierIndex - 1;
|
|
64
|
+
previousTier = (_a = ticketType === null || ticketType === void 0 ? void 0 : ticketType.tiers[previousTierIndex]) !== null && _a !== void 0 ? _a : null;
|
|
65
|
+
}
|
|
66
|
+
const previousTierIsPast = previousTier
|
|
67
|
+
? this.isPastTier(ticketType, previousTier)
|
|
68
|
+
: true;
|
|
69
|
+
const hasBegun = previousTierIsPast;
|
|
70
|
+
const hasEnded = remainingQty <= 0 || (endsAt && endsAt < now);
|
|
71
|
+
return !hasBegun && !hasEnded;
|
|
72
|
+
},
|
|
73
|
+
currentTier(ticketType) {
|
|
74
|
+
const tiers = ticketType.tiers;
|
|
75
|
+
const tier = tiers.find(tier => this.isInProgress(ticketType, tier));
|
|
76
|
+
return tier || null;
|
|
77
|
+
},
|
|
78
|
+
tierStatus(ticketType, tier) {
|
|
79
|
+
if (this.isInProgress(ticketType, tier))
|
|
80
|
+
return TierStatusEnum_1.TierStatusEnum.InProgress;
|
|
81
|
+
if (this.isPastTier(ticketType, tier))
|
|
82
|
+
return TierStatusEnum_1.TierStatusEnum.Past;
|
|
83
|
+
if (this.isNotStarted(ticketType, tier))
|
|
84
|
+
return TierStatusEnum_1.TierStatusEnum.NotStarted;
|
|
85
|
+
return TierStatusEnum_1.TierStatusEnum.NotStarted;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=TierUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TierUtil.js","sourceRoot":"","sources":["../../src/utils/TierUtil.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,4DAAyD;AACzD,gEAAkD;AAElD,kBAAe;IACb,UAAU,CAAC,UAAuB,EAAE,IAAiB;QACnD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC;QAE5B,IAAI,IAAI,CAAC,YAAY,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACzC,IAAI,CAAC,MAAM,IAAI,GAAG,IAAI,MAAM;YAAE,OAAO,KAAK,CAAC;;YACtC,OAAO,IAAI,CAAC;IACnB,CAAC;IACD,YAAY,CAAC,UAAuB,EAAE,IAAiB;;QACrD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,mCAAmC;QACnC,MAAM,MAAM,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC;QAC5B,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QAEvC,MAAM,SAAS,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GA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|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"author": "samheutmaker@gmail.com",
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@sellout/service": "^0.0.
|
|
20
|
-
"@sellout/utils": "^0.0.
|
|
19
|
+
"@sellout/service": "^0.0.60",
|
|
20
|
+
"@sellout/utils": "^0.0.60",
|
|
21
21
|
"@types/shortid": "0.0.29",
|
|
22
22
|
"apollo-link-debounce": "^2.1.0",
|
|
23
23
|
"graphql": "^14.6.0",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"protobufjs": "~6.10.1",
|
|
31
31
|
"typescript": "^3.8.3"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "551f1a01e488368e342661719a0946ad0071197b"
|
|
34
34
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import IOrderCustomField from "../interfaces/IOrderCustomField";
|
|
2
|
+
import { OrderTypeEnum } from "../interfaces/IOrderType";
|
|
3
|
+
import { OrderDeliveryMethodEnum } from "../enums/OrderDeliveryMethodEnum";
|
|
4
|
+
import { PaymentMethodTypeEnum } from '../enums/PaymentMethodTypeEnum';
|
|
5
|
+
|
|
6
|
+
export default interface ICreateOrderParams {
|
|
7
|
+
userId: string;
|
|
8
|
+
orgId: string;
|
|
9
|
+
eventId: string;
|
|
10
|
+
tickets: ICreateOrderTicketParams[];
|
|
11
|
+
upgrades: ICreateOrderUpgradeParams[];
|
|
12
|
+
type: OrderTypeEnum;
|
|
13
|
+
promotionCode: string;
|
|
14
|
+
customFields: IOrderCustomField[];
|
|
15
|
+
deliveryMethod: OrderDeliveryMethodEnum;
|
|
16
|
+
paymentMethodType: PaymentMethodTypeEnum;
|
|
17
|
+
holdToken?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ICreateOrderTicketParams {
|
|
21
|
+
name: string;
|
|
22
|
+
ticketTypeId: string;
|
|
23
|
+
ticketTierId: string;
|
|
24
|
+
price: number;
|
|
25
|
+
rollFees: boolean;
|
|
26
|
+
seat?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ICreateOrderUpgradeParams {
|
|
30
|
+
name: string;
|
|
31
|
+
upgradeId: string;
|
|
32
|
+
price: number;
|
|
33
|
+
rollFees: boolean;
|
|
34
|
+
}
|
package/src/interfaces/IFee.ts
CHANGED
|
@@ -15,7 +15,7 @@ export enum FeeAppliedByEnum {
|
|
|
15
15
|
Organization = 'Organization',
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export enum
|
|
18
|
+
export enum FeeFiltersEnum {
|
|
19
19
|
Seated = 'Seated',
|
|
20
20
|
CardEntry = 'Card Entry',
|
|
21
21
|
CardReader = 'Card Reader',
|
|
@@ -32,7 +32,7 @@ export default interface IFee {
|
|
|
32
32
|
appliedBy: FeeAppliedByEnum;
|
|
33
33
|
minAppliedToPrice?: number;
|
|
34
34
|
maxAppliedToPrice?: number;
|
|
35
|
-
filters?:
|
|
35
|
+
filters?: FeeFiltersEnum[];
|
|
36
36
|
createdBy?: string;
|
|
37
37
|
createdAt?: number;
|
|
38
38
|
updatedBy?: string;
|
package/src/proto/fee.proto
CHANGED
|
@@ -170,6 +170,20 @@ message DeletePlatformFeeResponse {
|
|
|
170
170
|
repeated Error errors = 1;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
/****************************************************************************************
|
|
174
|
+
Apply Platform Fees
|
|
175
|
+
****************************************************************************************/
|
|
176
|
+
message ApplyPlatformFeesToAllOrganizationsRequest {
|
|
177
|
+
string spanContext = 0;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
message ApplyPlatformFeesToAllOrganizationsResponse {
|
|
181
|
+
StatusCode status = 0;
|
|
182
|
+
repeated Error errors = 1;
|
|
183
|
+
bool success = 2;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
|
|
173
187
|
|
|
174
188
|
service FeeService {
|
|
175
189
|
// Create
|
|
@@ -192,5 +206,7 @@ service FeeService {
|
|
|
192
206
|
rpc disableFee(DisableFeeRequest) returns (DisableFeeResponse) {}
|
|
193
207
|
rpc deleteOrganizationFee(DeleteOrganizationFeeRequest) returns (DeleteOrganizationFeeResponse) {}
|
|
194
208
|
rpc deletePlatformFee(DeletePlatformFeeRequest) returns (DeletePlatformFeeResponse) {}
|
|
209
|
+
// Apply Platform Fees
|
|
210
|
+
rpc applyPlatformFeesToAllOrganizations(ApplyPlatformFeesToAllOrganizationsRequest) returns (ApplyPlatformFeesToAllOrganizationsResponse) {}
|
|
195
211
|
|
|
196
212
|
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { ICreateOrderTicketParams, ICreateOrderUpgradeParams } from '../interfaces/ICreateOrderParams';
|
|
2
|
+
import IFee, { FeeAppliedToEnum, FeeFiltersEnum, FeeTypeEnum } from '../interfaces/IFee';
|
|
3
|
+
import { PaymentMethodTypeEnum } from '../enums/PaymentMethodTypeEnum';
|
|
4
|
+
|
|
5
|
+
interface IPaymentCalculatorParams {
|
|
6
|
+
tickets: ICreateOrderTicketParams[];
|
|
7
|
+
upgrades: ICreateOrderUpgradeParams[];
|
|
8
|
+
fees: IFee[];
|
|
9
|
+
paymentMethodType: PaymentMethodTypeEnum
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
calculateTotal(params: IPaymentCalculatorParams): number {
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
tickets = [],
|
|
17
|
+
upgrades = [],
|
|
18
|
+
fees = [],
|
|
19
|
+
paymentMethodType,
|
|
20
|
+
} = params;
|
|
21
|
+
|
|
22
|
+
console.log(fees);
|
|
23
|
+
|
|
24
|
+
// No items, total is always 0
|
|
25
|
+
if(!tickets.length && !upgrades.length) return 0;
|
|
26
|
+
|
|
27
|
+
const ticketFees = fees.filter(f => f.appliedTo === FeeAppliedToEnum.Ticket);
|
|
28
|
+
const upgradeFees = fees.filter(f => f.appliedTo === FeeAppliedToEnum.Upgrade);
|
|
29
|
+
// Orders mattes here. Flat type fees must be applied before Percent type fees
|
|
30
|
+
const orderFees = fees.filter(f => f.appliedTo === FeeAppliedToEnum.Order).sort(({ type }) => {
|
|
31
|
+
if (type === 'Flat') return -1;
|
|
32
|
+
return 1;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
function applyTicketFee(ticket: ICreateOrderTicketParams, fee: IFee): number {
|
|
36
|
+
// // Ignore rolled fees
|
|
37
|
+
// if (ticket.rollFees) {
|
|
38
|
+
// return 0;
|
|
39
|
+
// }
|
|
40
|
+
|
|
41
|
+
// Ignore seated fees
|
|
42
|
+
if (fee.filters && fee.filters.includes(FeeFiltersEnum.Seated) && !ticket.seat) {
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Ignore card reader fees for non card reader payemnts
|
|
47
|
+
if (fee.filters && fee.filters.includes(FeeFiltersEnum.CardReader) && paymentMethodType !== PaymentMethodTypeEnum.CardReader) {
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Ignore card entry fees for non card entry payemnts
|
|
52
|
+
if (fee.filters && fee.filters.includes(FeeFiltersEnum.CardEntry) && paymentMethodType !== PaymentMethodTypeEnum.CardEntry) {
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const minFee = fee.minAppliedToPrice || 0;
|
|
57
|
+
const maxFee = fee.maxAppliedToPrice || Infinity;
|
|
58
|
+
|
|
59
|
+
if (minFee <= ticket.price && ticket.price <= maxFee) {
|
|
60
|
+
if (fee.type === FeeTypeEnum.Flat) {
|
|
61
|
+
return fee.value;
|
|
62
|
+
} if (fee.type === FeeTypeEnum.Percent) {
|
|
63
|
+
return (ticket.price * fee.value / 100);
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function applyUpgradeFee(upgrade: ICreateOrderUpgradeParams, fee: IFee): number {
|
|
73
|
+
// // Ignore rolled fees
|
|
74
|
+
// if (upgrade.rollFees) {
|
|
75
|
+
// return 0;
|
|
76
|
+
// }
|
|
77
|
+
|
|
78
|
+
const minFee = fee.minAppliedToPrice || 0;
|
|
79
|
+
const maxFee = fee.maxAppliedToPrice || Infinity;
|
|
80
|
+
|
|
81
|
+
if (minFee <= upgrade.price && upgrade.price <= maxFee) {
|
|
82
|
+
if (fee.type === FeeTypeEnum.Flat) {
|
|
83
|
+
return fee.value;
|
|
84
|
+
} if (fee.type === FeeTypeEnum.Percent) {
|
|
85
|
+
return (upgrade.price * fee.value / 100);
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
return 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function applyOrderFee(orderSubtotal, fee) {
|
|
95
|
+
if (fee.type === FeeTypeEnum.Flat) {
|
|
96
|
+
return orderSubtotal + fee.value;
|
|
97
|
+
} if (fee.type === FeeTypeEnum.Percent) {
|
|
98
|
+
return (orderSubtotal / (1 - fee.value / 100));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const ticketTotal = tickets.reduce((cur, ticket) => cur + ticket.price, 0);
|
|
103
|
+
|
|
104
|
+
const ticketFeeTotal = tickets.reduce((cur, ticket) => {
|
|
105
|
+
return cur + ticketFees.reduce((cur, fee) => cur + applyTicketFee(ticket, fee), 0);
|
|
106
|
+
}, 0);
|
|
107
|
+
|
|
108
|
+
const upgradeTotal = upgrades.reduce((cur, upgrade) => cur + upgrade.price, 0);
|
|
109
|
+
|
|
110
|
+
const upgradeFeeTotal = upgrades.reduce((cur, upgrade) => {
|
|
111
|
+
return cur + upgradeFees.reduce((cur, fee) => cur + applyUpgradeFee(upgrade, fee), 0);
|
|
112
|
+
}, 0);
|
|
113
|
+
|
|
114
|
+
const orderSubtotal = ticketTotal + ticketFeeTotal + upgradeTotal + upgradeFeeTotal;
|
|
115
|
+
|
|
116
|
+
const orderTotal = orderFees.reduce((cur, fee) => {
|
|
117
|
+
return applyOrderFee(cur, fee);
|
|
118
|
+
}, orderSubtotal);
|
|
119
|
+
|
|
120
|
+
return Math.round(orderTotal);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import ITicketType from '../interfaces/ITicketType';
|
|
2
|
+
import ITicketTier from "../interfaces/ITicketTier";
|
|
3
|
+
import { TierStatusEnum } from "../enums/TierStatusEnum";
|
|
4
|
+
import * as Time from "@sellout/utils/.dist/time";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
isPastTier(ticketType: ITicketType, tier: ITicketTier): boolean {
|
|
8
|
+
const now = Time.now();
|
|
9
|
+
const endsAt = tier?.endsAt;
|
|
10
|
+
|
|
11
|
+
if (tier.remainingQty === 0) return true;
|
|
12
|
+
if (!endsAt || now <= endsAt) return false;
|
|
13
|
+
else return true;
|
|
14
|
+
},
|
|
15
|
+
isInProgress(ticketType: ITicketType, tier: ITicketTier): boolean {
|
|
16
|
+
const now = Time.now();
|
|
17
|
+
// const startsAt = tier?.startsAt;
|
|
18
|
+
const endsAt = tier?.endsAt;
|
|
19
|
+
const remainingQty = tier.remainingQty;
|
|
20
|
+
|
|
21
|
+
const tierIndex = ticketType?.tiers.map((tier) => tier._id).indexOf(tier._id);
|
|
22
|
+
|
|
23
|
+
let previousTier: ITicketTier | null = null;
|
|
24
|
+
|
|
25
|
+
if (tierIndex && tierIndex > -1) {
|
|
26
|
+
const previousTierIndex = tierIndex - 1;
|
|
27
|
+
previousTier = ticketType?.tiers[previousTierIndex] ?? null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const previousTierIsPast = previousTier
|
|
31
|
+
? this.isPastTier(ticketType, previousTier)
|
|
32
|
+
: true;
|
|
33
|
+
|
|
34
|
+
const hasBegun = previousTierIsPast;
|
|
35
|
+
const hasEnded = remainingQty <= 0 || (endsAt && endsAt < now);
|
|
36
|
+
|
|
37
|
+
return hasBegun && !hasEnded;
|
|
38
|
+
},
|
|
39
|
+
isNotStarted(ticketType: ITicketType, tier: ITicketTier): boolean {
|
|
40
|
+
const now = Time.now();
|
|
41
|
+
// const startsAt = tier?.startsAt;
|
|
42
|
+
const endsAt = tier?.endsAt;
|
|
43
|
+
const remainingQty = tier.remainingQty;
|
|
44
|
+
|
|
45
|
+
const tierIndex = ticketType?.tiers.map((tier) => tier._id).indexOf(tier._id);
|
|
46
|
+
|
|
47
|
+
let previousTier: ITicketTier | null = null;
|
|
48
|
+
|
|
49
|
+
if (tierIndex && tierIndex > -1) {
|
|
50
|
+
const previousTierIndex = tierIndex - 1;
|
|
51
|
+
previousTier = ticketType?.tiers[previousTierIndex] ?? null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const previousTierIsPast = previousTier
|
|
55
|
+
? this.isPastTier(ticketType, previousTier)
|
|
56
|
+
: true;
|
|
57
|
+
|
|
58
|
+
const hasBegun = previousTierIsPast;
|
|
59
|
+
const hasEnded = remainingQty <= 0 || (endsAt && endsAt < now);
|
|
60
|
+
|
|
61
|
+
return !hasBegun && !hasEnded;
|
|
62
|
+
},
|
|
63
|
+
currentTier(ticketType: ITicketType): ITicketTier | null {
|
|
64
|
+
const tiers = ticketType.tiers;
|
|
65
|
+
const tier = tiers.find(tier => this.isInProgress(ticketType, tier));
|
|
66
|
+
return tier || null;
|
|
67
|
+
},
|
|
68
|
+
tierStatus(
|
|
69
|
+
ticketType: ITicketType,
|
|
70
|
+
tier: ITicketTier
|
|
71
|
+
): TierStatusEnum {
|
|
72
|
+
if (this.isInProgress(ticketType, tier)) return TierStatusEnum.InProgress;
|
|
73
|
+
if (this.isPastTier(ticketType, tier)) return TierStatusEnum.Past;
|
|
74
|
+
if (this.isNotStarted(ticketType, tier)) return TierStatusEnum.NotStarted;
|
|
75
|
+
return TierStatusEnum.NotStarted;
|
|
76
|
+
}
|
|
77
|
+
};
|