Skip to content

Commit

Permalink
feat: add missing commits (#5)
Browse files Browse the repository at this point in the history
* fix: subscription proration policy prefix, offering attach/detach product (#940)

BREAKING CHANGE:

* feat: add breadcrumb types (#900)

* feat: add breadcrumb types

* fix: remove an old comment

* Feat: Add code to promotion filters (#902)

* feat: search code is eq, for promotion codes

* Update promotions.d.ts

feat: code filter

* feat: account association response (#901)

* feat: account association response

* feat: account association response

* Feat: Add code to promotion filters (#902)

* feat: search code is eq, for promotion codes

* Update promotions.d.ts

feat: code filter

---------

Co-authored-by: Steve Ramage <[email protected]>
Co-authored-by: yasamanloghman <[email protected]>

* feat: plan fixed pricing (#903)

* feat: added sort_order field to variation and variation option interfaces (#904)

feat: Add new sort_order field to variation and variation option interfaces

* chore: updated all jobs node version to 20 except test job (#905)

fix: Updated pipeline jobs' node version

* fix: updated sort_order field to include the null value (#906)

Fix: updated pcm variation sort_order to include null

* [MT-16581]feat: CRUD promotion builder (#890)

* feat: CRUD promotion builder

* fix: remove extra imports

* feat: rulepromotion type and endpoint

* feat: add the update and create functionality

* Create yarn-error.log

* feat: preview mode for builder setting , uodate builder types

* update type with limitations and conditions

* Update rule-promotions.ts

* fixed format

* fix: remove extra logs

* feat: release - promotion builder (#907)

* fix: Promotion builder release (#908)

* feat: release - promotion builder

* fix: update names

* fix: Promotion builder release (#910)

* feat: release - promotion builder

* fix: update names

* fix: rules builder condition typo

* Feat!: Corrected variation and variation option response and update body types (#909)

BREAKING CHANGE: Updated PCM Variation Option response types and names

* Fix: Variation option base type and update body corrections (#911)

Fix: Update variation and variation body corrections

* chore: Revert "Fix: Variation option base type and update body corrections (#911)" (#912)

chore: This reverts commit cc4e52297ae3cc4560b4ba92fe3e707dc855a03f.

* fix: Variation & variation option update body type (#913)

* fix: variation option base type correction and fixed inaccurate update body type for variation and variation option

* fix: changed update body types using intersection instead of mapped type

* fix: removed intermediate attributes type

* feat: Added useTemplateSlugs query param as optional argument to PCM.ExportProducts method (#914)

feat: Add useTemplateSlugs query param to PCM.ExportProducts method

* feat: subscribers endpoint (#915)

* feat: meta type to subscriber, subscription filter type (#916)

* feat: product type for offering build request, filter interface (#917)

* feat: subscription relationships (#918)

* feat: added subscription schedules and  jobs endpoints (#919)

* feat: Removed billing_day, billing_month_day and status from plans (#920)

* feat: Add tags to product interface (#921)

* feat: add codes to promotion builder (#922)

* feat: add codes to promotion builder

* fix: spacing

* feat: added update for subscriptions settings (#923)

* feat: subscriptions meta timestamp (#924)

* feat: Allow null for external reference in schedules (#925)

* feat: added GetAttachedPlans and GetAttachedProducts to subs (#927)

BREAKING CHANGE

* !feat: added CreateState endpoint to subscription, types update (#928)

BREAKING CHANGE: types change

* fix: Update product component interface (#931)

BREAKING CHANGE:

* feat(custom apis): adds the custom apis endpoint (#929)

* feat(custom apis): adds the custom apis endpoint

* updated export

* updated validation

* updated validation and its fields to optional

* updated name for validation

* updated to use slug

* feat: subscription update endpoint (#932)

* refactor(custom apis): updated entries to use id instead of slug (#933)

BREAKING CHANGE: changed the endpoint in entries and it now uses customApiId instead of
customApiSlug

* feat: 🎸 configurable token for account management auth settings (#930)

BREAKING CHANGE: 🧨 no

✅ Closes: MT-17759

* fix: Component Option default type (#934)

BREAKING CHANGE:

* feat: added subscription dunning rules endpoint (#935)

* feat: subscription proration policies endpoint (#936)

* feat: subscription proration policies endpoint

* fix: removed missing fields

* feat!:  added endpoint to attach proration policy to offerings (#937)

BREAKING CHANGE:

* feat: added ability to remove attached proration from offering (#938)

* feat: subscription offering replace products endpoint (#939)

BREAKING CHANGE: removed deprecated endpoint and types

* fix: subscription proration policy prefix, offering attach/detach product (#940)

BREAKING CHANGE:

* chore: cleanup

---------

Co-authored-by: Rostyk <[email protected]>
Co-authored-by: yasamanloghman <[email protected]>
Co-authored-by: sarawasim1 <[email protected]>
Co-authored-by: Steve Ramage <[email protected]>
Co-authored-by: Georgios Botzakis <[email protected]>
Co-authored-by: Dubno Petro <[email protected]>
Co-authored-by: mahsaelasticpath <[email protected]>
  • Loading branch information
8 people authored Jul 23, 2024
1 parent bd6365d commit dc2da7e
Show file tree
Hide file tree
Showing 39 changed files with 8,801 additions and 337 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@
"git add"
]
}
}
}
60 changes: 51 additions & 9 deletions src/endpoints/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CartEndpoint extends BaseExtend {
}

Get() {
const { includes } = this
const {includes} = this

return this.request.send(
buildURL(`${this.endpoint}/${this.cartId}`, {
Expand All @@ -27,7 +27,7 @@ class CartEndpoint extends BaseExtend {
}

Items() {
const { includes, sort, limit, offset, filter } = this
const {includes, sort, limit, offset, filter} = this

this.call = this.request.send(
buildURL(`${this.endpoint}/${this.cartId}/items`, {
Expand All @@ -51,7 +51,7 @@ class CartEndpoint extends BaseExtend {
return this.request.send(`${this.endpoint}/${this.cartId}/shipping-groups/${shippingGroupId}`, 'GET')
}

CreateShippingGroup(body){
CreateShippingGroup(body) {
const shippingObject = Object.assign(body, {
type: 'shipping-type'
})
Expand Down Expand Up @@ -161,7 +161,7 @@ class CartEndpoint extends BaseExtend {
BulkAddCartCustomDiscount(body, options) {
return this.request.send(`${this.endpoint}/${this.cartId}/custom-discounts`, 'POST', {
data: body,
...(options && { options })
...(options && {options})
})
}

Expand All @@ -179,7 +179,7 @@ class CartEndpoint extends BaseExtend {
BulkAdd(body, options) {
return this.request.send(`${this.endpoint}/${this.cartId}/items`, 'POST', {
data: body,
...(options && { options })
...(options && {options})
})
}

Expand Down Expand Up @@ -215,6 +215,48 @@ class CartEndpoint extends BaseExtend {
)
}

AddAccountAssociation(accountId, token) {
const body = [
{
type: 'account',
id: accountId
}
]
return this.request.send(
`${this.endpoint}/${this.cartId}/relationships/accounts`,
'POST',
body,
undefined,
this,
true,
null,
token
? { 'EP-ACCOUNT-MANAGEMENT-AUTHENTICATION-TOKEN': token }
: undefined
)
}

RemoveAccountAssociation(accountId, token) {
const body = [
{
type: 'account',
id: accountId
}
]
return this.request.send(
`${this.endpoint}/${this.cartId}/relationships/accounts`,
'DELETE',
body,
undefined,
this,
true,
null,
token
? { 'EP-ACCOUNT-MANAGEMENT-AUTHENTICATION-TOKEN': token }
: undefined
)
}

RemoveItem(itemId) {
return this.request.send(
`${this.endpoint}/${this.cartId}/items/${itemId}`,
Expand All @@ -232,7 +274,7 @@ class CartEndpoint extends BaseExtend {
return this.request.send(
`${this.endpoint}/${this.cartId}/items/${itemId}`,
'PUT',
{ ...body, ...data },
{...body, ...data},
null,
null,
true,
Expand All @@ -242,7 +284,7 @@ class CartEndpoint extends BaseExtend {
}

UpdateItems(items) {
const body = items.map(({ id, quantity, type, ...rest }) =>
const body = items.map(({id, quantity, type, ...rest}) =>
buildCartItemData(id, quantity, type, rest)
)

Expand Down Expand Up @@ -278,7 +320,7 @@ class CartEndpoint extends BaseExtend {
BulkAddItemTax(body, options) {
return this.request.send(`${this.endpoint}/${this.cartId}/taxes`, 'POST', {
data: body,
...(options && { options })
...(options && {options})
})
}

Expand Down Expand Up @@ -362,7 +404,7 @@ class CartEndpoint extends BaseExtend {
'POST',
{
data: body,
...(options && { options })
...(options && {options})
},
token
)
Expand Down
29 changes: 16 additions & 13 deletions src/endpoints/catalogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class Products extends CRUDExtend {
this.endpoint = 'products'
}


GetCatalogReleaseProduct({ catalogId, releaseId, productId, token = null }) {
return this.request.send(
`catalogs/${catalogId}/releases/${releaseId}/${this.endpoint}/${productId}`,
Expand Down Expand Up @@ -129,16 +128,24 @@ class Products extends CRUDExtend {
)
}

GetCatalogReleaseProductChildren({ catalogId, releaseId, productId, token = null }) {
GetCatalogReleaseProductChildren({
catalogId,
releaseId,
productId,
token = null
}) {
const { limit, offset, includes, sort, filter } = this
return this.request.send(
buildURL(`catalogs/${catalogId}/releases/${releaseId}/${this.endpoint}/${productId}/relationships/children`, {
includes,
sort,
limit,
offset,
filter
}),
buildURL(
`catalogs/${catalogId}/releases/${releaseId}/${this.endpoint}/${productId}/relationships/children`,
{
includes,
sort,
limit,
offset,
filter
}
),
'GET',
undefined,
token,
Expand Down Expand Up @@ -196,10 +203,6 @@ class Products extends CRUDExtend {
)
}

/**
* @deprecated The method should not be used. Instead, use
* @function GetCatalogProducts
*/
GetProductsInCatalogRelease({ catalogId, releaseId, token = null }) {
const { limit, offset, includes, sort, filter } = this

Expand Down
116 changes: 116 additions & 0 deletions src/endpoints/custom-apis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import CRUDExtend from '../extends/crud'

import { buildURL } from '../utils/helpers'

class CustomApisEndpoint extends CRUDExtend {
constructor(endpoint) {
super(endpoint)

this.endpoint = 'settings/extensions/custom-apis'
}

Create(body) {
return this.request.send(
this.endpoint,
'POST',
body
)
}

Update(id, body) {
return this.request.send(
`${this.endpoint}/${id}`,
'PUT',
body
)
}

GetFields(customApiId) {
const { limit, offset, sort } = this

return this.request.send(
buildURL(`${this.endpoint}/${customApiId}/fields`, {
limit,
offset,
sort
}),
'GET'
)
}

GetField(customApiId, customApiFieldId) {
return this.request.send(
`${this.endpoint}/${customApiId}/fields/${customApiFieldId}`,
'GET'
)
}

CreateField(customApiId, body) {
return this.request.send(
`${this.endpoint}/${customApiId}/fields`,
'POST',
body
)
}

UpdateField(customApiId, customApiFieldId, body) {
return this.request.send(
`${this.endpoint}/${customApiId}/fields/${customApiFieldId}`,
'PUT',
body
)
}

DeleteField(customApiId, customApiFieldId) {
return this.request.send(
`${this.endpoint}/${customApiId}/fields/${customApiFieldId}`,
'DELETE'
)
}

GetEntries(customApiId) {
const { limit, offset, sort, filter } = this

return this.request.send(
buildURL(`${this.endpoint}/${customApiId}/entries`, {
limit,
offset,
sort,
filter
}),
'GET'
)
}

GetEntry(customApiId, customApiEntryId) {
return this.request.send(
`${this.endpoint}/${customApiId}/entries/${customApiEntryId}`,
'GET'
)
}

CreateEntry(customApiId, body) {
return this.request.send(
`${this.endpoint}/${customApiId}/entries`,
'POST',
body
)
}

UpdateEntry(customApiId, customApiEntryId, body) {
return this.request.send(
`${this.endpoint}/${customApiId}/entries/${customApiEntryId}`,
'PUT',
body
)
}

DeleteEntry(customApiId, customApiEntryId) {
return this.request.send(
`${this.endpoint}/${customApiId}/entries/${customApiEntryId}`,
'DELETE'
)
}
}

export default CustomApisEndpoint
5 changes: 3 additions & 2 deletions src/endpoints/pcm.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ class PCMEndpoint extends CRUDExtend {
return this.request.send(`${this.endpoint}/detach_nodes`, 'POST', body)
}

ExportProducts(filter) {
ExportProducts(filter, useTemplateSlugs) {
return this.request.send(
buildURL(`${this.endpoint}/export`, {
filter
filter,
useTemplateSlugs
}),
'POST'
)
Expand Down
20 changes: 12 additions & 8 deletions src/endpoints/promotions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ class PromotionsEndpoint extends CRUDExtend {
return this.request.send(`${this.endpoint}/attributes`, 'GET')
}

Codes(promotionId) {
const { limit, offset } = this
return this.request.send(
buildURL(`${this.endpoint}/${promotionId}/codes`, {
limit,
offset
}),
'GET'
Codes(promotionId, token = null) {
const { limit, offset, filter } = this
return this.request.send(
buildURL(`${this.endpoint}/${promotionId}/codes`, {
limit,
offset,
filter
}),
'GET',
undefined,
token,
this
)
}

Expand Down
Loading

0 comments on commit dc2da7e

Please sign in to comment.