feat(payments): wallet screen with balances, benefits and storefront
CI / changes (pull_request) Successful in 3s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Successful in 19s
CI / ui (pull_request) Successful in 1m8s
CI / conformance (pull_request) Successful in 9s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m39s

Add the "Кошелёк" section to the settings hub: context-visible chip
balances, active benefits (no-ads term/forever, hints) and a storefront of
chip-priced values and money-priced chip packs. Guests have no wallet; the
Google Play build hides the money purchases behind a RuStore stub; a web
purchase that would draw VK/Telegram chips warns first.

Add the catalog read path the storefront needs — a context-projected
GET /api/v1/user/wallet/catalog (payments service + store, gateway op
wallet.catalog, FBS Catalog/CatalogProduct/CatalogAtom, client decode) —
plus the client leg for the existing wallet.get/buy ops. Value spends reuse
the existing spend path; the chip-pack purchase (money order flow) arrives
with payment intake, so its action is a disabled placeholder for now.

Covered by Go unit (catalog projection) + integration (/wallet/catalog over
Postgres), vitest (formatting, spendable selection, web-spend warning, GP
flag, codec + gateway encode round-trips) and Playwright mock e2e (render,
guest-hidden, GP stub, warning) on Chromium + WebKit.
This commit is contained in:
Ilia Denisov
2026-07-08 12:31:38 +02:00
parent 41f4fd3497
commit 4aa6174968
41 changed files with 2090 additions and 39 deletions
+3
View File
@@ -11,6 +11,9 @@ export { BestMoveTile } from './scrabblefb/best-move-tile.js';
export { BestMoveView } from './scrabblefb/best-move-view.js';
export { BlockList } from './scrabblefb/block-list.js';
export { BlockStatus } from './scrabblefb/block-status.js';
export { Catalog } from './scrabblefb/catalog.js';
export { CatalogAtom } from './scrabblefb/catalog-atom.js';
export { CatalogProduct } from './scrabblefb/catalog-product.js';
export { ChatList } from './scrabblefb/chat-list.js';
export { ChatMessage } from './scrabblefb/chat-message.js';
export { ChatPostRequest } from './scrabblefb/chat-post-request.js';
+58
View File
@@ -0,0 +1,58 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class CatalogAtom {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):CatalogAtom {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsCatalogAtom(bb:flatbuffers.ByteBuffer, obj?:CatalogAtom):CatalogAtom {
return (obj || new CatalogAtom()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsCatalogAtom(bb:flatbuffers.ByteBuffer, obj?:CatalogAtom):CatalogAtom {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new CatalogAtom()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
atomType():string|null
atomType(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
atomType(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
quantity():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
static startCatalogAtom(builder:flatbuffers.Builder) {
builder.startObject(2);
}
static addAtomType(builder:flatbuffers.Builder, atomTypeOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, atomTypeOffset, 0);
}
static addQuantity(builder:flatbuffers.Builder, quantity:number) {
builder.addFieldInt32(1, quantity, 0);
}
static endCatalogAtom(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createCatalogAtom(builder:flatbuffers.Builder, atomTypeOffset:flatbuffers.Offset, quantity:number):flatbuffers.Offset {
CatalogAtom.startCatalogAtom(builder);
CatalogAtom.addAtomType(builder, atomTypeOffset);
CatalogAtom.addQuantity(builder, quantity);
return CatalogAtom.endCatalogAtom(builder);
}
}
@@ -0,0 +1,134 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { CatalogAtom } from '../scrabblefb/catalog-atom.js';
export class CatalogProduct {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):CatalogProduct {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsCatalogProduct(bb:flatbuffers.ByteBuffer, obj?:CatalogProduct):CatalogProduct {
return (obj || new CatalogProduct()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsCatalogProduct(bb:flatbuffers.ByteBuffer, obj?:CatalogProduct):CatalogProduct {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new CatalogProduct()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
kind():string|null
kind(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
kind(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
productId():string|null
productId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
productId(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
title():string|null
title(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
title(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
chips():number {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
}
moneyAmount():bigint {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
}
moneyCurrency():string|null
moneyCurrency(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
moneyCurrency(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
atoms(index: number, obj?:CatalogAtom):CatalogAtom|null {
const offset = this.bb!.__offset(this.bb_pos, 16);
return offset ? (obj || new CatalogAtom()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
atomsLength():number {
const offset = this.bb!.__offset(this.bb_pos, 16);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
static startCatalogProduct(builder:flatbuffers.Builder) {
builder.startObject(7);
}
static addKind(builder:flatbuffers.Builder, kindOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, kindOffset, 0);
}
static addProductId(builder:flatbuffers.Builder, productIdOffset:flatbuffers.Offset) {
builder.addFieldOffset(1, productIdOffset, 0);
}
static addTitle(builder:flatbuffers.Builder, titleOffset:flatbuffers.Offset) {
builder.addFieldOffset(2, titleOffset, 0);
}
static addChips(builder:flatbuffers.Builder, chips:number) {
builder.addFieldInt32(3, chips, 0);
}
static addMoneyAmount(builder:flatbuffers.Builder, moneyAmount:bigint) {
builder.addFieldInt64(4, moneyAmount, BigInt('0'));
}
static addMoneyCurrency(builder:flatbuffers.Builder, moneyCurrencyOffset:flatbuffers.Offset) {
builder.addFieldOffset(5, moneyCurrencyOffset, 0);
}
static addAtoms(builder:flatbuffers.Builder, atomsOffset:flatbuffers.Offset) {
builder.addFieldOffset(6, atomsOffset, 0);
}
static createAtomsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startAtomsVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static endCatalogProduct(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createCatalogProduct(builder:flatbuffers.Builder, kindOffset:flatbuffers.Offset, productIdOffset:flatbuffers.Offset, titleOffset:flatbuffers.Offset, chips:number, moneyAmount:bigint, moneyCurrencyOffset:flatbuffers.Offset, atomsOffset:flatbuffers.Offset):flatbuffers.Offset {
CatalogProduct.startCatalogProduct(builder);
CatalogProduct.addKind(builder, kindOffset);
CatalogProduct.addProductId(builder, productIdOffset);
CatalogProduct.addTitle(builder, titleOffset);
CatalogProduct.addChips(builder, chips);
CatalogProduct.addMoneyAmount(builder, moneyAmount);
CatalogProduct.addMoneyCurrency(builder, moneyCurrencyOffset);
CatalogProduct.addAtoms(builder, atomsOffset);
return CatalogProduct.endCatalogProduct(builder);
}
}
+66
View File
@@ -0,0 +1,66 @@
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { CatalogProduct } from '../scrabblefb/catalog-product.js';
export class Catalog {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Catalog {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsCatalog(bb:flatbuffers.ByteBuffer, obj?:Catalog):Catalog {
return (obj || new Catalog()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsCatalog(bb:flatbuffers.ByteBuffer, obj?:Catalog):Catalog {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Catalog()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
products(index: number, obj?:CatalogProduct):CatalogProduct|null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? (obj || new CatalogProduct()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
}
productsLength():number {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
static startCatalog(builder:flatbuffers.Builder) {
builder.startObject(1);
}
static addProducts(builder:flatbuffers.Builder, productsOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, productsOffset, 0);
}
static createProductsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addOffset(data[i]!);
}
return builder.endVector();
}
static startProductsVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static endCatalog(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createCatalog(builder:flatbuffers.Builder, productsOffset:flatbuffers.Offset):flatbuffers.Offset {
Catalog.startCatalog(builder);
Catalog.addProducts(builder, productsOffset);
return Catalog.endCatalog(builder);
}
}