Skip to content

Commit

Permalink
fix(keyboard): add missing payload for vk pay button
Browse files Browse the repository at this point in the history
  • Loading branch information
negezor committed May 31, 2022
1 parent 770b6ed commit 7561ea9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/vk-io/src/structures/keyboard/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,19 @@ export class KeyboardBuilder {
* })
* ```
*/
public payButton({ hash: rawHash }: IKeyboardVKPayButtonOptions): this {
public payButton({
payload: rawPayload,
hash: rawHash
}: IKeyboardVKPayButtonOptions): this {
const payload = serializePayload(rawPayload);

const hash = typeof rawHash === 'object'
? String(new URLSearchParams(Object.entries(rawHash)))
: rawHash;

return this.addWideButton({
action: {
payload,
hash,

type: 'vkpay'
Expand Down
7 changes: 7 additions & 0 deletions packages/vk-io/src/structures/keyboard/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ export interface IVKPayButton extends IButton {
action: {
type: 'vkpay';

/**
* Payload, preferably use object
*/
payload: ButtonPayload;

/**
* line containing VK Pay payment parameters
* and application ID in the aid parameter, separated by &.
Expand Down Expand Up @@ -308,6 +313,8 @@ export type KeyboardVKPayHash =
};

export interface IKeyboardVKPayButtonOptions {
payload: ButtonPayload;

/**
* line containing VK Pay payment parameters
* and application ID in the aid parameter, separated by &.
Expand Down

0 comments on commit 7561ea9

Please sign in to comment.