This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: subscription proration policies endpoint (#936)
* feat: subscription proration policies endpoint * fix: removed missing fields
- Loading branch information
1 parent
695c1a0
commit 58b715c
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import CRUDExtend from '../extends/crud' | ||
|
||
class SubscriptionProrationPoliciesEndpoint extends CRUDExtend { | ||
constructor(endpoint) { | ||
super(endpoint) | ||
|
||
this.endpoint = 'subscriptions/proration-policies' | ||
} | ||
|
||
Create(body) { | ||
return this.request.send(this.endpoint, 'POST', { | ||
...body | ||
}) | ||
} | ||
|
||
Update(id, body, token = null) { | ||
return this.request.send( | ||
`${this.endpoint}/${id}`, | ||
'PUT', | ||
{ | ||
...body | ||
}, | ||
token | ||
) | ||
} | ||
|
||
} | ||
|
||
export default SubscriptionProrationPoliciesEndpoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* Subscription Proration Policies | ||
* Description: Subscription Proration Policies. | ||
* DOCS: TODO: add docs when ready | ||
*/ | ||
import { | ||
Identifiable, | ||
CrudQueryableResource | ||
} from './core' | ||
|
||
/** | ||
* Core Subscription Proration Policies Base Interface | ||
* For custom flows, extend this interface | ||
* DOCS: TODO: add docs when ready | ||
*/ | ||
export interface SubscriptionProrationPolicyBase { | ||
type: 'proration_policy' | ||
attributes: { | ||
name: string | ||
rounding: 'up' | 'down' | 'nearest' | ||
external_ref?: string | ||
} | ||
} | ||
|
||
export interface SubscriptionProrationPolicy extends Identifiable, SubscriptionProrationPolicyBase { | ||
meta: { | ||
owner: 'store' | 'organization' | ||
timestamps: { | ||
updated_at: string | ||
created_at: string | ||
} | ||
} | ||
} | ||
|
||
export type SubscriptionProrationPolicyCreate = SubscriptionProrationPolicyBase | ||
export type SubscriptionProrationPolicyUpdate = Identifiable & Omit<SubscriptionProrationPolicyBase, 'attributes'> & {attributes: Partial<SubscriptionProrationPolicy['attributes']>} | ||
|
||
/** | ||
* Subscription Proration Policies Endpoints | ||
* DOCS: TODO: add docs when ready | ||
*/ | ||
export interface SubscriptionProrationPoliciesEndpoint | ||
extends CrudQueryableResource< | ||
SubscriptionProrationPolicy, | ||
SubscriptionProrationPolicyCreate, | ||
SubscriptionProrationPolicyUpdate, | ||
never, | ||
never, | ||
never | ||
> { | ||
endpoint: 'proration-policies' | ||
} |