-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add new method to create new payment profiles * Merge branch 'AlphaLawless:main' into main * refactor: refactor payment profile create body
- Loading branch information
Showing
4 changed files
with
68 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,24 @@ | ||
import { Http } from '@/lib/http' | ||
import type { | ||
PaymentProfilesCreateRequest, | ||
PaymentProfilesCreateResponse | ||
} from './protocols' | ||
|
||
export const create = async ({ | ||
config, | ||
body | ||
}: PaymentProfilesCreateRequest): Promise<PaymentProfilesCreateResponse> => { | ||
return await Http.fetch<PaymentProfilesCreateResponse>( | ||
'/v1/payment_profiles', | ||
{ | ||
method: 'POST', | ||
headers: { | ||
Authorization: `Basic ${Buffer.from(`${config.key}:`).toString( | ||
'base64' | ||
)}` | ||
}, | ||
body: JSON.stringify(body), | ||
...config.options | ||
} | ||
) | ||
} |
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,20 @@ | ||
import type { ApiResponse, Options } from '@/protocols' | ||
import type { VindiClient } from '@/vindi-client' | ||
import type { | ||
PaymentProfilesCreateBody, | ||
PaymentProfilesReturn | ||
} from '../protocols' | ||
|
||
export declare interface PaymentProfilesCreateRequest | ||
extends Exclude<PaymentProfilesCreateData, 'requestOptions'> { | ||
config: VindiClient | ||
} | ||
|
||
export declare interface PaymentProfilesCreateData { | ||
body: PaymentProfilesCreateBody | ||
requestOptions?: Options | ||
} | ||
|
||
export declare interface PaymentProfilesCreateResponse extends ApiResponse { | ||
payment_profile: PaymentProfilesReturn | ||
} |
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