Skip to content

Commit

Permalink
Enhanced payment plugin properties
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon committed Nov 19, 2024
1 parent 660c5bf commit a0a2f9a
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 36 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wrtnio/schema",
"version": "1.2.1",
"version": "1.2.2",
"description": "JSON and LLM function calling schemas extended for Wrtn Studio Pro",
"main": "lib/index.js",
"module": "./lib/index.mjs",
Expand Down
10 changes: 3 additions & 7 deletions src/IOpenAiSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,23 @@ export namespace IOpenAiSchema {
export interface IInteger
extends ILlmSchema.IInteger,
ISwaggerSchemaCommonPlugin,
ISwaggerSchemaPaymentPlugin.ITargetOrder,
ISwaggerSchemaPaymentPlugin.IPriceAmount {}
ISwaggerSchemaPaymentPlugin.INumeric {}

/**
* Number type schema info.
*/
export interface INumber
extends ILlmSchema.INumber,
ISwaggerSchemaCommonPlugin,
ISwaggerSchemaPaymentPlugin.ITargetOrder,
ISwaggerSchemaPaymentPlugin.IPriceAmount {}
ISwaggerSchemaPaymentPlugin.INumeric {}

/**
* String type schema info.
*/
export interface IString
extends ILlmSchema.IString,
ISwaggerSchemaCommonPlugin,
ISwaggerSchemaPaymentPlugin.ITargetOrder,
ISwaggerSchemaPaymentPlugin.IPriceCurrency,
ISwaggerSchemaPaymentPlugin.IVendor,
ISwaggerSchemaPaymentPlugin.IString,
ISwaggerSchemaSecurityPlugin {}

/**
Expand Down
10 changes: 3 additions & 7 deletions src/ISwaggerSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,22 @@ export namespace ISwaggerSchema {
export interface IInteger
extends OpenApi.IJsonSchema.IInteger,
ISwaggerSchemaCommonPlugin,
ISwaggerSchemaPaymentPlugin.ITargetOrder,
ISwaggerSchemaPaymentPlugin.IPriceAmount {}
ISwaggerSchemaPaymentPlugin.INumeric {}

/**
* Number (double) type info.
*/
export interface INumber
extends OpenApi.IJsonSchema.INumber,
ISwaggerSchemaPaymentPlugin.ITargetOrder,
ISwaggerSchemaPaymentPlugin.IPriceAmount {}
ISwaggerSchemaPaymentPlugin.INumeric {}

/**
* String type info.
*/
export interface IString
extends OpenApi.IJsonSchema.IString,
ISwaggerSchemaCommonPlugin,
ISwaggerSchemaPaymentPlugin.ITargetOrder,
ISwaggerSchemaPaymentPlugin.IPriceCurrency,
ISwaggerSchemaPaymentPlugin.IVendor,
ISwaggerSchemaPaymentPlugin.IString,
ISwaggerSchemaSecurityPlugin {}

/**
Expand Down
89 changes: 68 additions & 21 deletions src/ISwaggerSchemaPaymentPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/
export namespace ISwaggerSchemaPaymentPlugin {
/**
* Target of the payment.
* Plugin properties for `integer` and `number` types.
*/
export interface ITargetOrder {
export interface INumeric {
/**
* The payment target.
*
Expand All @@ -22,51 +22,41 @@ export namespace ISwaggerSchemaPaymentPlugin {
* issued by the payment vendor service. In other words,
* `x-wrtn-payment-order-id` is issued by the target API function.
*/
"x-wrtn-payment-order-id"?: string;
}
"x-wrtn-payment-order-id"?: true;

/**
* Price amount plugin property.
*/
export interface IPriceAmount {
/**
* The currency of the payment should be paid.
* The amount of the payment should be paid.
*
* If an order appliance function be called and it returns a value with
* `x-wrtn-payment-currency` property, the value means the currency of the
* `x-wrtn-payment-amount` property, the value means the amount of the
* payment should be paid at the next publishing plan.
*
* The payment would be proceeded by the payment vendor service, and you
* may fill the next payment function's parameter with the vendor service
* code and UID of the payment transaction that is signified by the
* `x-wrtn-payment-vendor` and `x-wrtn-payment-uid` typed properties.
*/
"x-wrtn-payment-currency"?: true;
"x-wrtn-payment-amount"?: true;
}

/**
* Price currency plugin property.
* Plugin properties for the `string` type.
*/
export interface IPriceCurrency {
export interface IString {
/**
* The amount of the payment should be paid.
* The currency of the payment should be paid.
*
* If an order appliance function be called and it returns a value with
* `x-wrtn-payment-amount` property, the value means the amount of the
* `x-wrtn-payment-currency` property, the value means the currency of the
* payment should be paid at the next publishing plan.
*
* The payment would be proceeded by the payment vendor service, and you
* may fill the next payment function's parameter with the vendor service
* code and UID of the payment transaction that is signified by the
* `x-wrtn-payment-vendor` and `x-wrtn-payment-uid` typed properties.
*/
"x-wrtn-payment-amount"?: true;
}
"x-wrtn-payment-currency"?: true;

/**
* Vendor plugin properties.
*/
export interface IVendor {
/**
* Code of the payment vendor service.
*
Expand Down Expand Up @@ -98,5 +88,62 @@ export namespace ISwaggerSchemaPaymentPlugin {
* {@link x-wrtn-payment-vendor} typed property.
*/
"x-wrtn-payment-uid"?: true;

/**
* The payment target's order ID.
*
* If an order appliance function be called and it returns a value with
* `x-wrtn-payment-target` property, the value means the identifier
* of the payment target, as an order.
*
* When processing the publish, you have to fill the next payment
* function's parameter with the target order's ID. Note that, this
* `x-wrtn-payment-order-id` is different with the
* {@link IVendor.x-wrtn-payment-uid}, which means the transation ID
* issued by the payment vendor service. In other words,
* `x-wrtn-payment-order-id` is issued by the target API function.
*/
"x-wrtn-payment-order-id"?: true;

/**
* The payment target's order name.
*
* If an order appliance function be called and it returns a value with
* `x-wrtn-payment-order-name` property, the value means the name of the
* payment target, as an order.
*
* When processing the publish, you have to fill the next payment
* function's parameter with the target order's name.
*
* Note that, this `x-wrtn-payment-order-name` is different with the
* {@link IVendor.x-wrtn-payment-order-citizen}. This is not the name
* or citizen, but of the target order.
*/
"x-wrtn-payment-order-name"?: true;

/**
* The citizen who've ordered the payment.
*
* If an order appliance function be called and it returns a value with
* `x-wrtn-payment-order-citizen` property, the value means the citizen
* who've ordered the payment.
*
* When processing the publish, you have to fill the next payment
* function's parameter with the citizen who've ordered the payment.
*/
"x-wrtn-payment-order-citizen"?: true;

/**
* The mobile phone number of the citizen who've ordered the payment.
*
* If an order appliance function be called and it returns a value with
* `x-wrtn-payment-order-mobile` property, the value means the mobile
* phone number of the citizen who've ordered the payment.
*
* When processing the publish, you have to fill the next payment
* function's parameter with the mobile phone number of the citizen
* who've ordered the payment.
*/
"x-wrtn-payment-order-mobile"?: true;
}
}

0 comments on commit a0a2f9a

Please sign in to comment.