@rechargeapps/storefront-client 0.19.0 → 0.20.1
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/cjs/api/address.js +3 -5
- package/dist/cjs/api/address.js.map +1 -1
- package/dist/cjs/api/charge.js +2 -10
- package/dist/cjs/api/charge.js.map +1 -1
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/address.js +3 -5
- package/dist/esm/api/address.js.map +1 -1
- package/dist/esm/api/charge.js +3 -9
- package/dist/esm/api/charge.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/index.d.ts +44 -26
- package/dist/umd/recharge-client.min.js +9 -9
- package/package.json +1 -1
package/dist/cjs/api/address.js
CHANGED
|
@@ -19,13 +19,11 @@ async function updateAddress(session, id, updateRequest) {
|
|
|
19
19
|
const { address } = await request.rechargeApiRequest("put", `/addresses`, { id, data: updateRequest }, session);
|
|
20
20
|
return address;
|
|
21
21
|
}
|
|
22
|
-
async function applyDiscountToAddress(session, id,
|
|
23
|
-
|
|
24
|
-
return address;
|
|
22
|
+
async function applyDiscountToAddress(session, id, discountCode) {
|
|
23
|
+
return updateAddress(session, id, { discounts: [{ code: discountCode }] });
|
|
25
24
|
}
|
|
26
25
|
async function removeDiscountsFromAddress(session, id) {
|
|
27
|
-
|
|
28
|
-
return address;
|
|
26
|
+
return updateAddress(session, id, { discounts: [] });
|
|
29
27
|
}
|
|
30
28
|
function deleteAddress(session, id) {
|
|
31
29
|
return request.rechargeApiRequest("delete", `/addresses`, { id }, session);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.js","sources":["../../../src/api/address.ts"],"sourcesContent":["import { rechargeApiRequest } from '../utils/request';\nimport {\n AddressResponse,\n AddressListParams,\n CreateAddressRequest,\n UpdateAddressRequest,\n AddressListResponse,\n MergeAddressesRequest,\n SkipFutureChargeAddressRequest,\n SkipFutureChargeAddressResponse,\n} from '../types/address';\nimport { Session } from '../types/session';\n\n/** Returns all addresses from the store, or addresses for the customer given in the parameter. */\nexport function listAddresses(session: Session, query?: AddressListParams) {\n return rechargeApiRequest<AddressListResponse>('get', `/addresses`, { query }, session);\n}\n\n/** Retrieves address for customer based on specified address id. */\nexport async function getAddress(session: Session, id: string | number) {\n const { address } = await rechargeApiRequest<AddressResponse>('get', `/addresses`, { id }, session);\n return address;\n}\n\n/** Create a new address for a customer. */\nexport async function createAddress(session: Session, createRequest: CreateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>('post', `/addresses`, { data: createRequest }, session);\n return address;\n}\n\n/** Updates an existing address to match the specified parameters. */\nexport async function updateAddress(session: Session, id: string | number, updateRequest: UpdateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'put',\n `/addresses`,\n { id, data: updateRequest },\n session\n );\n return address;\n}\n\n/** Apply discount to an address. Addresses are currently limited to a single discount. */\nexport async function applyDiscountToAddress(session: Session, id: string | number,
|
|
1
|
+
{"version":3,"file":"address.js","sources":["../../../src/api/address.ts"],"sourcesContent":["import { rechargeApiRequest } from '../utils/request';\nimport {\n AddressResponse,\n AddressListParams,\n CreateAddressRequest,\n UpdateAddressRequest,\n AddressListResponse,\n MergeAddressesRequest,\n SkipFutureChargeAddressRequest,\n SkipFutureChargeAddressResponse,\n} from '../types/address';\nimport { Session } from '../types/session';\n\n/** Returns all addresses from the store, or addresses for the customer given in the parameter. */\nexport function listAddresses(session: Session, query?: AddressListParams) {\n return rechargeApiRequest<AddressListResponse>('get', `/addresses`, { query }, session);\n}\n\n/** Retrieves address for customer based on specified address id. */\nexport async function getAddress(session: Session, id: string | number) {\n const { address } = await rechargeApiRequest<AddressResponse>('get', `/addresses`, { id }, session);\n return address;\n}\n\n/** Create a new address for a customer. */\nexport async function createAddress(session: Session, createRequest: CreateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>('post', `/addresses`, { data: createRequest }, session);\n return address;\n}\n\n/** Updates an existing address to match the specified parameters. */\nexport async function updateAddress(session: Session, id: string | number, updateRequest: UpdateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'put',\n `/addresses`,\n { id, data: updateRequest },\n session\n );\n return address;\n}\n\n/** Apply discount code to an address. Addresses are currently limited to a single discount. */\nexport async function applyDiscountToAddress(session: Session, id: string | number, discountCode: string) {\n return updateAddress(session, id, { discounts: [{ code: discountCode }] });\n}\n\n/** Removes all discounts from an address. */\nexport async function removeDiscountsFromAddress(session: Session, id: string | number) {\n return updateAddress(session, id, { discounts: [] });\n}\n\n/** Deletes an address. Only Addresses with no active Subscriptions can be deleted. */\nexport function deleteAddress(session: Session, id: string | number) {\n return rechargeApiRequest<void>('delete', `/addresses`, { id }, session);\n}\n\n/**\n * Merges up to 10 source addresses into 1 target address.\n */\nexport async function mergeAddresses(session: Session, mergeRequest: MergeAddressesRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'post',\n `/addresses/merge`,\n {\n data: mergeRequest,\n },\n session\n );\n return address;\n}\n\n/**\n * Skip a Charge in the future for one or multiple Subscriptions associated with the Address.\n */\nexport async function skipFutureCharge(\n session: Session,\n id: string | number,\n skipRequest: SkipFutureChargeAddressRequest\n) {\n const { charge } = await rechargeApiRequest<SkipFutureChargeAddressResponse>(\n 'post',\n `/addresses/${id}/charges/skip`,\n {\n data: skipRequest,\n },\n session\n );\n return charge;\n}\n"],"names":["rechargeApiRequest"],"mappings":";;;;;;AACO,SAAS,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE;AAC9C,EAAE,OAAOA,0BAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC;AACM,eAAe,UAAU,CAAC,OAAO,EAAE,EAAE,EAAE;AAC9C,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAMA,0BAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AACrF,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACM,eAAe,aAAa,CAAC,OAAO,EAAE,aAAa,EAAE;AAC5D,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;AACvG,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACM,eAAe,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE;AAChE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAMA,0BAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;AAC1G,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACM,eAAe,sBAAsB,CAAC,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE;AACxE,EAAE,OAAO,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC;AAC7E,CAAC;AACM,eAAe,0BAA0B,CAAC,OAAO,EAAE,EAAE,EAAE;AAC9D,EAAE,OAAO,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;AACvD,CAAC;AACM,SAAS,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE;AAC3C,EAAE,OAAOA,0BAAkB,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC;AACM,eAAe,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE;AAC5D,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,gBAAgB,CAAC,EAAE;AAC3E,IAAI,IAAI,EAAE,YAAY;AACtB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACM,eAAe,gBAAgB,CAAC,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE;AACjE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE;AACvF,IAAI,IAAI,EAAE,WAAW;AACrB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,MAAM,CAAC;AAChB;;;;;;;;;;;;"}
|
package/dist/cjs/api/charge.js
CHANGED
|
@@ -11,18 +11,12 @@ async function getCharge(session, id) {
|
|
|
11
11
|
function listCharges(session, query) {
|
|
12
12
|
return request.rechargeApiRequest("get", `/charges`, { query }, session);
|
|
13
13
|
}
|
|
14
|
-
async function
|
|
15
|
-
return applyDiscountToCharge(session, id, applyRequest);
|
|
16
|
-
}
|
|
17
|
-
async function applyDiscountToCharge(session, id, applyRequest) {
|
|
14
|
+
async function applyDiscountToCharge(session, id, discountCode) {
|
|
18
15
|
const { charge } = await request.rechargeApiRequest("post", `/charges/${id}/apply_discount`, {
|
|
19
|
-
data:
|
|
16
|
+
data: { discount_code: discountCode }
|
|
20
17
|
}, session);
|
|
21
18
|
return charge;
|
|
22
19
|
}
|
|
23
|
-
async function removeDiscount(session, id) {
|
|
24
|
-
return removeDiscountsFromCharge(session, id);
|
|
25
|
-
}
|
|
26
20
|
async function removeDiscountsFromCharge(session, id) {
|
|
27
21
|
const { charge } = await request.rechargeApiRequest("post", `/charges/${id}/remove_discount`, {}, session);
|
|
28
22
|
return charge;
|
|
@@ -40,12 +34,10 @@ async function processCharge(session, id) {
|
|
|
40
34
|
return charge;
|
|
41
35
|
}
|
|
42
36
|
|
|
43
|
-
exports.applyDiscount = applyDiscount;
|
|
44
37
|
exports.applyDiscountToCharge = applyDiscountToCharge;
|
|
45
38
|
exports.getCharge = getCharge;
|
|
46
39
|
exports.listCharges = listCharges;
|
|
47
40
|
exports.processCharge = processCharge;
|
|
48
|
-
exports.removeDiscount = removeDiscount;
|
|
49
41
|
exports.removeDiscountsFromCharge = removeDiscountsFromCharge;
|
|
50
42
|
exports.skipCharge = skipCharge;
|
|
51
43
|
exports.unskipCharge = unskipCharge;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charge.js","sources":["../../../src/api/charge.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"charge.js","sources":["../../../src/api/charge.ts"],"sourcesContent":["import { ChargeListParams, ChargeListResponse, ChargeResponse } from '../types/charge';\nimport { Session } from '../types/session';\nimport { rechargeApiRequest } from '../utils/request';\n\n/* Retrieve a Charge using the charge_id. */\nexport async function getCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('get', `/charges`, { id }, session);\n return charge;\n}\n\n/** Lists charges */\nexport function listCharges(session: Session, query?: ChargeListParams) {\n return rechargeApiRequest<ChargeListResponse>('get', `/charges`, { query }, session);\n}\n\n/**\n * You cannot add a Discount to an existing queued Charge if the Charge or the associated Address already has one.\n * If a Charge has a Discount and it gets updated, or a regeneration occurs, the Discount will be lost. Regeneration is a process that refreshes the Charge JSON with new data in the case of the Subscription or Address being updated.\n */\nexport async function applyDiscountToCharge(session: Session, id: number | string, discountCode: string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/apply_discount`,\n {\n data: { discount_code: discountCode },\n },\n session\n );\n return charge;\n}\n\n/**\n * Remove all Discounts from a Charge without destroying the Discount.\n * In most cases the Discount should be removed from the Address. When the Discount is removed from the Address, the Discount is also removed from any future Charges.\n * If the Discount is on the parent Address, you cannot remove it using charge_id.\n * When removing your Discount, it is preferable to pass the address_id so that the Discount stays removed if the Charge is regenerated. Only pass charge_id in edge cases in which there are two or more Charges on a parent Address and you only want to remove the Discount from one Charge.\n * If you pass both parameters, it will remove the Discount from the Address.\n */\nexport async function removeDiscountsFromCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/remove_discount`, {}, session);\n return charge;\n}\n\n/* Skip a Charge. */\nexport async function skipCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/skip`, {}, session);\n return charge;\n}\n\n/* Unskip a Charge. */\nexport async function unskipCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/unskip`, {}, session);\n return charge;\n}\n\n/* Process a Charge. */\nexport async function processCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/process`, {}, session);\n return charge;\n}\n"],"names":["rechargeApiRequest"],"mappings":";;;;;;AACO,eAAe,SAAS,CAAC,OAAO,EAAE,EAAE,EAAE;AAC7C,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMA,0BAAkB,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAClF,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,SAAS,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE;AAC5C,EAAE,OAAOA,0BAAkB,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC;AACM,eAAe,qBAAqB,CAAC,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE;AACvE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE;AACvF,IAAI,IAAI,EAAE,EAAE,aAAa,EAAE,YAAY,EAAE;AACzC,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,eAAe,yBAAyB,CAAC,OAAO,EAAE,EAAE,EAAE;AAC7D,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AACrG,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,eAAe,UAAU,CAAC,OAAO,EAAE,EAAE,EAAE;AAC9C,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC1F,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,eAAe,YAAY,CAAC,OAAO,EAAE,EAAE,EAAE;AAChD,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC5F,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,eAAe,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE;AACjD,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC7F,EAAE,OAAO,MAAM,CAAC;AAChB;;;;;;;;;;"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -29,12 +29,10 @@ exports.skipFutureCharge = address.skipFutureCharge;
|
|
|
29
29
|
exports.updateAddress = address.updateAddress;
|
|
30
30
|
exports.loginShopifyApi = auth.loginShopifyApi;
|
|
31
31
|
exports.loginShopifyAppProxy = auth.loginShopifyAppProxy;
|
|
32
|
-
exports.applyDiscount = charge.applyDiscount;
|
|
33
32
|
exports.applyDiscountToCharge = charge.applyDiscountToCharge;
|
|
34
33
|
exports.getCharge = charge.getCharge;
|
|
35
34
|
exports.listCharges = charge.listCharges;
|
|
36
35
|
exports.processCharge = charge.processCharge;
|
|
37
|
-
exports.removeDiscount = charge.removeDiscount;
|
|
38
36
|
exports.removeDiscountsFromCharge = charge.removeDiscountsFromCharge;
|
|
39
37
|
exports.skipCharge = charge.skipCharge;
|
|
40
38
|
exports.unskipCharge = charge.unskipCharge;
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/esm/api/address.js
CHANGED
|
@@ -15,13 +15,11 @@ async function updateAddress(session, id, updateRequest) {
|
|
|
15
15
|
const { address } = await rechargeApiRequest("put", `/addresses`, { id, data: updateRequest }, session);
|
|
16
16
|
return address;
|
|
17
17
|
}
|
|
18
|
-
async function applyDiscountToAddress(session, id,
|
|
19
|
-
|
|
20
|
-
return address;
|
|
18
|
+
async function applyDiscountToAddress(session, id, discountCode) {
|
|
19
|
+
return updateAddress(session, id, { discounts: [{ code: discountCode }] });
|
|
21
20
|
}
|
|
22
21
|
async function removeDiscountsFromAddress(session, id) {
|
|
23
|
-
|
|
24
|
-
return address;
|
|
22
|
+
return updateAddress(session, id, { discounts: [] });
|
|
25
23
|
}
|
|
26
24
|
function deleteAddress(session, id) {
|
|
27
25
|
return rechargeApiRequest("delete", `/addresses`, { id }, session);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.js","sources":["../../../src/api/address.ts"],"sourcesContent":["import { rechargeApiRequest } from '../utils/request';\nimport {\n AddressResponse,\n AddressListParams,\n CreateAddressRequest,\n UpdateAddressRequest,\n AddressListResponse,\n MergeAddressesRequest,\n SkipFutureChargeAddressRequest,\n SkipFutureChargeAddressResponse,\n} from '../types/address';\nimport { Session } from '../types/session';\n\n/** Returns all addresses from the store, or addresses for the customer given in the parameter. */\nexport function listAddresses(session: Session, query?: AddressListParams) {\n return rechargeApiRequest<AddressListResponse>('get', `/addresses`, { query }, session);\n}\n\n/** Retrieves address for customer based on specified address id. */\nexport async function getAddress(session: Session, id: string | number) {\n const { address } = await rechargeApiRequest<AddressResponse>('get', `/addresses`, { id }, session);\n return address;\n}\n\n/** Create a new address for a customer. */\nexport async function createAddress(session: Session, createRequest: CreateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>('post', `/addresses`, { data: createRequest }, session);\n return address;\n}\n\n/** Updates an existing address to match the specified parameters. */\nexport async function updateAddress(session: Session, id: string | number, updateRequest: UpdateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'put',\n `/addresses`,\n { id, data: updateRequest },\n session\n );\n return address;\n}\n\n/** Apply discount to an address. Addresses are currently limited to a single discount. */\nexport async function applyDiscountToAddress(session: Session, id: string | number,
|
|
1
|
+
{"version":3,"file":"address.js","sources":["../../../src/api/address.ts"],"sourcesContent":["import { rechargeApiRequest } from '../utils/request';\nimport {\n AddressResponse,\n AddressListParams,\n CreateAddressRequest,\n UpdateAddressRequest,\n AddressListResponse,\n MergeAddressesRequest,\n SkipFutureChargeAddressRequest,\n SkipFutureChargeAddressResponse,\n} from '../types/address';\nimport { Session } from '../types/session';\n\n/** Returns all addresses from the store, or addresses for the customer given in the parameter. */\nexport function listAddresses(session: Session, query?: AddressListParams) {\n return rechargeApiRequest<AddressListResponse>('get', `/addresses`, { query }, session);\n}\n\n/** Retrieves address for customer based on specified address id. */\nexport async function getAddress(session: Session, id: string | number) {\n const { address } = await rechargeApiRequest<AddressResponse>('get', `/addresses`, { id }, session);\n return address;\n}\n\n/** Create a new address for a customer. */\nexport async function createAddress(session: Session, createRequest: CreateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>('post', `/addresses`, { data: createRequest }, session);\n return address;\n}\n\n/** Updates an existing address to match the specified parameters. */\nexport async function updateAddress(session: Session, id: string | number, updateRequest: UpdateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'put',\n `/addresses`,\n { id, data: updateRequest },\n session\n );\n return address;\n}\n\n/** Apply discount code to an address. Addresses are currently limited to a single discount. */\nexport async function applyDiscountToAddress(session: Session, id: string | number, discountCode: string) {\n return updateAddress(session, id, { discounts: [{ code: discountCode }] });\n}\n\n/** Removes all discounts from an address. */\nexport async function removeDiscountsFromAddress(session: Session, id: string | number) {\n return updateAddress(session, id, { discounts: [] });\n}\n\n/** Deletes an address. Only Addresses with no active Subscriptions can be deleted. */\nexport function deleteAddress(session: Session, id: string | number) {\n return rechargeApiRequest<void>('delete', `/addresses`, { id }, session);\n}\n\n/**\n * Merges up to 10 source addresses into 1 target address.\n */\nexport async function mergeAddresses(session: Session, mergeRequest: MergeAddressesRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'post',\n `/addresses/merge`,\n {\n data: mergeRequest,\n },\n session\n );\n return address;\n}\n\n/**\n * Skip a Charge in the future for one or multiple Subscriptions associated with the Address.\n */\nexport async function skipFutureCharge(\n session: Session,\n id: string | number,\n skipRequest: SkipFutureChargeAddressRequest\n) {\n const { charge } = await rechargeApiRequest<SkipFutureChargeAddressResponse>(\n 'post',\n `/addresses/${id}/charges/skip`,\n {\n data: skipRequest,\n },\n session\n );\n return charge;\n}\n"],"names":[],"mappings":";;AACO,SAAS,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE;AAC9C,EAAE,OAAO,kBAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC;AACM,eAAe,UAAU,CAAC,OAAO,EAAE,EAAE,EAAE;AAC9C,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AACrF,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACM,eAAe,aAAa,CAAC,OAAO,EAAE,aAAa,EAAE;AAC5D,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;AACvG,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACM,eAAe,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE;AAChE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;AAC1G,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACM,eAAe,sBAAsB,CAAC,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE;AACxE,EAAE,OAAO,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC;AAC7E,CAAC;AACM,eAAe,0BAA0B,CAAC,OAAO,EAAE,EAAE,EAAE;AAC9D,EAAE,OAAO,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;AACvD,CAAC;AACM,SAAS,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE;AAC3C,EAAE,OAAO,kBAAkB,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC;AACM,eAAe,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE;AAC5D,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,gBAAgB,CAAC,EAAE;AAC3E,IAAI,IAAI,EAAE,YAAY;AACtB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACM,eAAe,gBAAgB,CAAC,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE;AACjE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE;AACvF,IAAI,IAAI,EAAE,WAAW;AACrB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}
|
package/dist/esm/api/charge.js
CHANGED
|
@@ -7,18 +7,12 @@ async function getCharge(session, id) {
|
|
|
7
7
|
function listCharges(session, query) {
|
|
8
8
|
return rechargeApiRequest("get", `/charges`, { query }, session);
|
|
9
9
|
}
|
|
10
|
-
async function
|
|
11
|
-
return applyDiscountToCharge(session, id, applyRequest);
|
|
12
|
-
}
|
|
13
|
-
async function applyDiscountToCharge(session, id, applyRequest) {
|
|
10
|
+
async function applyDiscountToCharge(session, id, discountCode) {
|
|
14
11
|
const { charge } = await rechargeApiRequest("post", `/charges/${id}/apply_discount`, {
|
|
15
|
-
data:
|
|
12
|
+
data: { discount_code: discountCode }
|
|
16
13
|
}, session);
|
|
17
14
|
return charge;
|
|
18
15
|
}
|
|
19
|
-
async function removeDiscount(session, id) {
|
|
20
|
-
return removeDiscountsFromCharge(session, id);
|
|
21
|
-
}
|
|
22
16
|
async function removeDiscountsFromCharge(session, id) {
|
|
23
17
|
const { charge } = await rechargeApiRequest("post", `/charges/${id}/remove_discount`, {}, session);
|
|
24
18
|
return charge;
|
|
@@ -36,5 +30,5 @@ async function processCharge(session, id) {
|
|
|
36
30
|
return charge;
|
|
37
31
|
}
|
|
38
32
|
|
|
39
|
-
export {
|
|
33
|
+
export { applyDiscountToCharge, getCharge, listCharges, processCharge, removeDiscountsFromCharge, skipCharge, unskipCharge };
|
|
40
34
|
//# sourceMappingURL=charge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charge.js","sources":["../../../src/api/charge.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"charge.js","sources":["../../../src/api/charge.ts"],"sourcesContent":["import { ChargeListParams, ChargeListResponse, ChargeResponse } from '../types/charge';\nimport { Session } from '../types/session';\nimport { rechargeApiRequest } from '../utils/request';\n\n/* Retrieve a Charge using the charge_id. */\nexport async function getCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('get', `/charges`, { id }, session);\n return charge;\n}\n\n/** Lists charges */\nexport function listCharges(session: Session, query?: ChargeListParams) {\n return rechargeApiRequest<ChargeListResponse>('get', `/charges`, { query }, session);\n}\n\n/**\n * You cannot add a Discount to an existing queued Charge if the Charge or the associated Address already has one.\n * If a Charge has a Discount and it gets updated, or a regeneration occurs, the Discount will be lost. Regeneration is a process that refreshes the Charge JSON with new data in the case of the Subscription or Address being updated.\n */\nexport async function applyDiscountToCharge(session: Session, id: number | string, discountCode: string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/apply_discount`,\n {\n data: { discount_code: discountCode },\n },\n session\n );\n return charge;\n}\n\n/**\n * Remove all Discounts from a Charge without destroying the Discount.\n * In most cases the Discount should be removed from the Address. When the Discount is removed from the Address, the Discount is also removed from any future Charges.\n * If the Discount is on the parent Address, you cannot remove it using charge_id.\n * When removing your Discount, it is preferable to pass the address_id so that the Discount stays removed if the Charge is regenerated. Only pass charge_id in edge cases in which there are two or more Charges on a parent Address and you only want to remove the Discount from one Charge.\n * If you pass both parameters, it will remove the Discount from the Address.\n */\nexport async function removeDiscountsFromCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/remove_discount`, {}, session);\n return charge;\n}\n\n/* Skip a Charge. */\nexport async function skipCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/skip`, {}, session);\n return charge;\n}\n\n/* Unskip a Charge. */\nexport async function unskipCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/unskip`, {}, session);\n return charge;\n}\n\n/* Process a Charge. */\nexport async function processCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/process`, {}, session);\n return charge;\n}\n"],"names":[],"mappings":";;AACO,eAAe,SAAS,CAAC,OAAO,EAAE,EAAE,EAAE;AAC7C,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAClF,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,SAAS,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE;AAC5C,EAAE,OAAO,kBAAkB,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC;AACM,eAAe,qBAAqB,CAAC,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE;AACvE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE;AACvF,IAAI,IAAI,EAAE,EAAE,aAAa,EAAE,YAAY,EAAE;AACzC,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,eAAe,yBAAyB,CAAC,OAAO,EAAE,EAAE,EAAE;AAC7D,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AACrG,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,eAAe,UAAU,CAAC,OAAO,EAAE,EAAE,EAAE;AAC9C,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC1F,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,eAAe,YAAY,CAAC,OAAO,EAAE,EAAE,EAAE;AAChD,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC5F,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,eAAe,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE;AACjD,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC7F,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { applyDiscountToAddress, createAddress, deleteAddress, getAddress, listAddresses, mergeAddresses, removeDiscountsFromAddress, skipFutureCharge, updateAddress } from './api/address.js';
|
|
2
2
|
export { loginShopifyApi, loginShopifyAppProxy } from './api/auth.js';
|
|
3
|
-
export {
|
|
3
|
+
export { applyDiscountToCharge, getCharge, listCharges, processCharge, removeDiscountsFromCharge, skipCharge, unskipCharge } from './api/charge.js';
|
|
4
4
|
export { getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, resetCDNCache } from './api/cdn.js';
|
|
5
5
|
export { getBundleId, getDynamicBundleItems, validateBundle, validateDynamicBundle } from './api/bundle.js';
|
|
6
6
|
export { activateMembership, cancelMembership, getMembership, listMemberships } from './api/membership.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -50,7 +50,6 @@ interface ProductImage {
|
|
|
50
50
|
sort_order?: number;
|
|
51
51
|
}
|
|
52
52
|
interface LineItem {
|
|
53
|
-
subscription_id?: number;
|
|
54
53
|
/** The Subscription or Onetime ID associated with the line_item. */
|
|
55
54
|
purchase_item_id: number;
|
|
56
55
|
/** An object containing the associated product ID as it appears in the external system. */
|
|
@@ -358,12 +357,6 @@ interface ChargeListResponse {
|
|
|
358
357
|
previous_cursor: null | string;
|
|
359
358
|
charges: Charge[];
|
|
360
359
|
}
|
|
361
|
-
interface ApplyDiscountRequest {
|
|
362
|
-
/** Code of the Discount you want to apply to a Charge. */
|
|
363
|
-
discount_code?: string;
|
|
364
|
-
/** ID of the Discount you want to apply to a Charge. */
|
|
365
|
-
discount_id?: number;
|
|
366
|
-
}
|
|
367
360
|
declare type ChargeSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc' | 'scheduled_at-asc' | 'scheduled_at-desc';
|
|
368
361
|
interface ChargeListParams extends ListParams<ChargeSortBy> {
|
|
369
362
|
/** Filter Charges by Address. */
|
|
@@ -390,7 +383,7 @@ interface ChargeListParams extends ListParams<ChargeSortBy> {
|
|
|
390
383
|
/** Show Charges scheduled to be processed after the given date. */
|
|
391
384
|
scheduled_at_min?: IsoDateString;
|
|
392
385
|
/** Filter charges by status. */
|
|
393
|
-
status?: ChargeStatus;
|
|
386
|
+
status?: ChargeStatus[];
|
|
394
387
|
/** Show charges updated before the given date. */
|
|
395
388
|
updated_at_max?: IsoDateString;
|
|
396
389
|
/** Show charges updated after the given date. */
|
|
@@ -445,7 +438,11 @@ interface CreateAddressRequest {
|
|
|
445
438
|
/** The zip or postal code associated with the address. */
|
|
446
439
|
zip: string;
|
|
447
440
|
}
|
|
448
|
-
declare type UpdateAddressRequest = Omit<Partial<CreateAddressRequest>, 'presentment_currency' | 'customer_id'
|
|
441
|
+
declare type UpdateAddressRequest = Omit<Partial<CreateAddressRequest>, 'presentment_currency' | 'customer_id' | 'discounts'> & {
|
|
442
|
+
discounts?: {
|
|
443
|
+
code: string;
|
|
444
|
+
}[];
|
|
445
|
+
};
|
|
449
446
|
interface MergeAddressesRequest {
|
|
450
447
|
/** Indicates whether source addresses should be deleted. */
|
|
451
448
|
delete_source_addresses?: boolean;
|
|
@@ -553,8 +550,8 @@ declare function getAddress(session: Session, id: string | number): Promise<Addr
|
|
|
553
550
|
declare function createAddress(session: Session, createRequest: CreateAddressRequest): Promise<Address>;
|
|
554
551
|
/** Updates an existing address to match the specified parameters. */
|
|
555
552
|
declare function updateAddress(session: Session, id: string | number, updateRequest: UpdateAddressRequest): Promise<Address>;
|
|
556
|
-
/** Apply discount to an address. Addresses are currently limited to a single discount. */
|
|
557
|
-
declare function applyDiscountToAddress(session: Session, id: string | number,
|
|
553
|
+
/** Apply discount code to an address. Addresses are currently limited to a single discount. */
|
|
554
|
+
declare function applyDiscountToAddress(session: Session, id: string | number, discountCode: string): Promise<Address>;
|
|
558
555
|
/** Removes all discounts from an address. */
|
|
559
556
|
declare function removeDiscountsFromAddress(session: Session, id: string | number): Promise<Address>;
|
|
560
557
|
/** Deletes an address. Only Addresses with no active Subscriptions can be deleted. */
|
|
@@ -574,20 +571,11 @@ declare function loginShopifyApi(shopifyStorefrontToken: string, shopifyCustomer
|
|
|
574
571
|
declare function getCharge(session: Session, id: number | string): Promise<Charge>;
|
|
575
572
|
/** Lists charges */
|
|
576
573
|
declare function listCharges(session: Session, query?: ChargeListParams): Promise<ChargeListResponse>;
|
|
577
|
-
/**
|
|
578
|
-
* @deprecated will be removed at version 1.0 - replaced with applyDiscountToCharge
|
|
579
|
-
*/
|
|
580
|
-
declare function applyDiscount(session: Session, id: number | string, applyRequest: ApplyDiscountRequest): Promise<Charge>;
|
|
581
574
|
/**
|
|
582
575
|
* You cannot add a Discount to an existing queued Charge if the Charge or the associated Address already has one.
|
|
583
|
-
* You can provide either discount_id or discount_code. If both parameters are passed, the value for discount_id will take precedence.
|
|
584
576
|
* If a Charge has a Discount and it gets updated, or a regeneration occurs, the Discount will be lost. Regeneration is a process that refreshes the Charge JSON with new data in the case of the Subscription or Address being updated.
|
|
585
577
|
*/
|
|
586
|
-
declare function applyDiscountToCharge(session: Session, id: number | string,
|
|
587
|
-
/**
|
|
588
|
-
* @deprecated will be removed at version 1.0 - replaced with removeDiscountsFromCharge
|
|
589
|
-
*/
|
|
590
|
-
declare function removeDiscount(session: Session, id: number | string): Promise<Charge>;
|
|
578
|
+
declare function applyDiscountToCharge(session: Session, id: number | string, discountCode: string): Promise<Charge>;
|
|
591
579
|
/**
|
|
592
580
|
* Remove all Discounts from a Charge without destroying the Discount.
|
|
593
581
|
* In most cases the Discount should be removed from the Address. When the Discount is removed from the Address, the Discount is also removed from any future Charges.
|
|
@@ -1146,7 +1134,7 @@ interface Subscription {
|
|
|
1146
1134
|
/** The price of the item before discounts, taxes, or shipping have been applied. */
|
|
1147
1135
|
price: string;
|
|
1148
1136
|
/** The name of the product in a store’s catalog. */
|
|
1149
|
-
product_title: string
|
|
1137
|
+
product_title: string;
|
|
1150
1138
|
/** A list of line item objects, each one containing information about the subscription. Custom key-value pairs can be installed here, they will appear on the connected queued charge and after it is processed on the order itself. */
|
|
1151
1139
|
properties: Property[];
|
|
1152
1140
|
/** The number of items in the subscription. */
|
|
@@ -1192,7 +1180,7 @@ interface SubscriptionListParams extends ListParams<SubscriptionSortBy> {
|
|
|
1192
1180
|
updated_at_min?: IsoDateString;
|
|
1193
1181
|
}
|
|
1194
1182
|
declare type SubscriptionRequiredCreateProps = 'address_id' | 'charge_interval_frequency' | 'external_variant_id' | 'next_charge_scheduled_at' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity';
|
|
1195
|
-
declare type SubscriptionOptionalCreateProps = 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'external_product_id' | 'product_title' | 'properties' | 'status';
|
|
1183
|
+
declare type SubscriptionOptionalCreateProps = 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'external_product_id' | 'price' | 'product_title' | 'properties' | 'status';
|
|
1196
1184
|
declare type CreateSubscriptionRequest = SubType<Subscription, SubscriptionRequiredCreateProps, SubscriptionOptionalCreateProps>;
|
|
1197
1185
|
declare type SubscriptionOptionalUpdateProps = 'charge_interval_frequency' | 'expire_after_specific_number_of_charges' | 'order_day_of_month' | 'order_day_of_week' | 'order_interval_frequency' | 'order_interval_unit' | 'quantity' | 'external_product_id' | 'external_variant_id' | 'properties' | 'sku' | 'sku_override';
|
|
1198
1186
|
declare type UpdateSubscriptionRequest = Partial<Pick<Subscription, SubscriptionOptionalUpdateProps>>;
|
|
@@ -1253,9 +1241,39 @@ interface CustomerDeliveryScheduleParams {
|
|
|
1253
1241
|
future_internal?: number;
|
|
1254
1242
|
date_max?: IsoDateString;
|
|
1255
1243
|
}
|
|
1244
|
+
declare type DeliveryLineItem = Omit<LineItem, 'external_inventory_policy' | 'grams' | 'handle' | 'purchase_item_id' | 'purchase_item_type' | 'sku' | 'tax_due' | 'tax_lines' | 'taxable_amount' | 'taxable' | 'title' | 'total_price' | 'unit_price_includes_tax'> & {
|
|
1245
|
+
/** Value is set to true if it is not a onetime or a prepaid item */
|
|
1246
|
+
is_skippable: boolean;
|
|
1247
|
+
/** Value is set to true if the order is skipped. */
|
|
1248
|
+
is_skipped: boolean;
|
|
1249
|
+
/** The type of the plan. May return null value in certain cases. */
|
|
1250
|
+
plan_type: 'subscription' | 'onetime';
|
|
1251
|
+
/** Value is set to true if it is a prepaid item */
|
|
1252
|
+
is_prepaid: boolean;
|
|
1253
|
+
/** The name of the product in a store’s catalog. */
|
|
1254
|
+
product_title: string;
|
|
1255
|
+
/** Unique numeric identifier for the subscription linked to this line_item in the order. */
|
|
1256
|
+
subscription_id: number;
|
|
1257
|
+
/** The subtotal price (sum of all line items * their quantity) of the order less discounts. */
|
|
1258
|
+
subtotal_price: string;
|
|
1259
|
+
};
|
|
1260
|
+
declare type DeliveryPaymentMethod = Omit<PaymentMethod, 'created_at' | 'customer_id' | 'default' | 'payment_type' | 'processor_customer_token' | 'processor_name' | 'processor_payment_method_token' | 'status_reason' | 'status' | 'updated_at'> & {
|
|
1261
|
+
payment_details: PaymentDetails;
|
|
1262
|
+
billing_address: AssociatedAddress;
|
|
1263
|
+
};
|
|
1264
|
+
interface DeliveryOrder {
|
|
1265
|
+
id: number;
|
|
1266
|
+
address_id: number;
|
|
1267
|
+
charge_id: number;
|
|
1268
|
+
line_items: DeliveryLineItem[];
|
|
1269
|
+
payment_method: DeliveryPaymentMethod;
|
|
1270
|
+
shipping_address: AssociatedAddress;
|
|
1271
|
+
order_subtotal: string;
|
|
1272
|
+
currency: string;
|
|
1273
|
+
}
|
|
1256
1274
|
interface Delivery {
|
|
1257
1275
|
date: IsoDateString;
|
|
1258
|
-
orders:
|
|
1276
|
+
orders: DeliveryOrder[];
|
|
1259
1277
|
}
|
|
1260
1278
|
interface CustomerDeliveryScheduleResponse {
|
|
1261
1279
|
customer: {
|
|
@@ -1370,7 +1388,7 @@ interface Onetime {
|
|
|
1370
1388
|
/** Presentment currency */
|
|
1371
1389
|
presentment_currency: string | null;
|
|
1372
1390
|
}
|
|
1373
|
-
declare type OnetimeRequiredCreateProps = 'address_id' | 'external_variant_id' | 'next_charge_scheduled_at' | 'product_title' | 'quantity';
|
|
1391
|
+
declare type OnetimeRequiredCreateProps = 'address_id' | 'external_variant_id' | 'next_charge_scheduled_at' | 'price' | 'product_title' | 'quantity';
|
|
1374
1392
|
declare type OnetimeOptionalCreateProps = 'external_product_id' | 'properties' | 'sku';
|
|
1375
1393
|
interface OnetimeCreateProps {
|
|
1376
1394
|
/** Instructs to add the Onetime to the next charge scheduled under this Address. */
|
|
@@ -1598,4 +1616,4 @@ declare const api: {
|
|
|
1598
1616
|
};
|
|
1599
1617
|
declare function initRecharge(opt?: InitOptions): void;
|
|
1600
1618
|
|
|
1601
|
-
export { ActivateMembershipRequest, Address, AddressListParams, AddressListResponse, AddressResponse, AddressSortBy, AnalyticsData,
|
|
1619
|
+
export { ActivateMembershipRequest, Address, AddressListParams, AddressListResponse, AddressResponse, AddressSortBy, AnalyticsData, AssociatedAddress, Bundle, BundleItem, BundleProperties, BundleSelection, BundleTranslations, CDNBaseWidgetSettings, CDNBundleLayoutSettings, CDNBundleSettings, CDNBundleStep, CDNBundleStepOption, CDNBundleVariant, CDNBundleVariantOptionSource, CDNBundleVariantSelectionDefault, CDNPrices, CDNProduct, CDNProductAndSettings, CDNProductKeyObject, CDNProductOption, CDNProductOptionValue, CDNProductRaw, CDNProductResource, CDNProductsAndSettings, CDNProductsAndSettingsResource, CDNSellingPlan, CDNSellingPlanAllocations, CDNSellingPlanGroup, CDNStoreSettings, CDNSubscriptionOption, CDNVariant, CDNVariantOptionValue, CDNWidgetSettings, CDNWidgetSettingsRaw, CDNWidgetSettingsResource, CRUDRequestOptions, CancelMembershipRequest, CancelSubscriptionRequest, ChannelSettings, Charge, ChargeListParams, ChargeListResponse, ChargeResponse, ChargeSortBy, ChargeStatus, ColorString, CreateAddressRequest, CreateOnetimeRequest, CreateSubscriptionRequest, Customer, CustomerDeliveryScheduleParams, CustomerDeliveryScheduleResponse, CustomerIncludes, CustomerOptionalUpdateProps, Delivery, DeliveryLineItem, DeliveryOrder, DeliveryPaymentMethod, Discount, ExternalId, ExternalTransactionId, FirstOption, GetCustomerOptions, GetRequestOptions, HTMLString, InitOptions, IntervalUnit, IsoDateString, LineItem, ListParams, LoginResponse, Membership, MembershipIncludes, MembershipListParams, MembershipListResponse, MembershipResponse, MembershipStatus, MembershipsSortBy, MergeAddressesRequest, Method, Onetime, OnetimeCreateProps, OnetimeListParams, OnetimeOptionalCreateProps, OnetimeOptionalUpdateProps, OnetimeRequiredCreateProps, OnetimesResponse, OnetimesSortBy, Order, OrderListParams, OrderSortBy, OrderStatus, OrderType, OrdersResponse, PaymentDetails, PaymentMethod, PaymentMethodListParams, PaymentMethodOptionalUpdateProps, PaymentMethodSortBy, PaymentMethodStatus, PaymentMethodsResponse, PaymentType, Plan, PlanListParams, PlanSortBy, PlanType, PlansResponse, PriceAdjustmentsType, ProcessorName, ProductImage, Property, Request, RequestHeaders, RequestOptions, RequestOptionsHeaders, Session, ShippingLine, SkipFutureChargeAddressRequest, SkipFutureChargeAddressResponse, StorefrontEnvironment, StorefrontOptions, StorefrontPurchaseOption, SubType, Subscription, SubscriptionListParams, SubscriptionOptionalCreateProps, SubscriptionOptionalUpdateProps, SubscriptionPreferences, SubscriptionRequiredCreateProps, SubscriptionSortBy, SubscriptionStatus, SubscriptionsResponse, TaxLine, Translations, UpdateAddressRequest, UpdateCustomerRequest, UpdateOnetimeRequest, UpdatePaymentMethodRequest, UpdateSubscriptionParams, UpdateSubscriptionRequest, WidgetIconColor, WidgetTemplateType, activateMembership, activateSubscription, api, applyDiscountToAddress, applyDiscountToCharge, cancelMembership, cancelSubscription, createAddress, createOnetime, createSubscription, deleteAddress, deleteOnetime, getAddress, getBundleId, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCustomer, getDeliverySchedule, getDynamicBundleItems, getMembership, getOnetime, getOrder, getPaymentMethod, getPlan, getSubscription, initRecharge, listAddresses, listCharges, listMemberships, listOnetimes, listOrders, listPaymentMethods, listPlans, listSubscriptions, loginShopifyApi, loginShopifyAppProxy, membershipIncludes, mergeAddresses, processCharge, removeDiscountsFromAddress, removeDiscountsFromCharge, resetCDNCache, skipCharge, skipFutureCharge, skipSubscriptionCharge, unskipCharge, updateAddress, updateCustomer, updateOnetime, updatePaymentMethod, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, validateBundle, validateDynamicBundle };
|