Skip to content

Commit

Permalink
feat: add custom fields
Browse files Browse the repository at this point in the history
  • Loading branch information
kaioken committed Dec 20, 2024
1 parent 7ce4741 commit 4cb24d1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/types/custom-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export interface DeletedCustomField {

export interface CustomFieldInput {
name: string;
data: any;
data?: any;
value?: any;
public?: boolean;
}

Expand Down
22 changes: 22 additions & 0 deletions test/order.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,26 @@ describe('Test Commerce orders', () => {
expect(result.createOrderFromAppleInAppPurchase.id).toBeDefined();
expect(result.createOrderFromAppleInAppPurchase.uuid).toBeDefined();
});

it('create order from apple in app purchase with custom field', async () => {
const client = getClient();
const order = client.order;
const result = await order.createOrderFromAppleInAppPurchaseReceipt({
input: {
product_id: 'model_price_01',
transaction_id: '2000000778751927',
receipt: 'MIIUKQYJKoZIhvcNAQcCoIIUGjCCFBYCAQExDzANBglghkgBZQMEAgEFADCCA18GCSqGSIb3DQEHAaCCA1AEggNMMYIDSDAKAgEIAgEBBAIWADAKAgEUAgEBBAIMADALAgEBAgEBBAMCAQAwCwIBCwIBAQQDAgEAMAsCAQ8CAQEEAwIBADALAgEQAgEBBAMCAQAwCwIBGQIBAQQDAgEDMAwCAQMCAQEEBAwCNTYwDAIBCgIBAQQEFgI0KzAMAgEOAgEBBAQCAgEAMA0CAQ0CAQEEBQIDAr8hMA0CARMCAQEEBQwDMS4wMA4CAQkCAQEEBgIEUDMwNTAYAgEEAgECBBB/iVD6vEMO3K80msWsb6IzMBsCAQACAQEEEwwRUHJvZHVjdGlvblNhbmRib3gwHAIBAgIBAQQUDBJjb20uYWltZW1vLmFwcC5pb3MwHAIBBQIBAQQUsPK+qBQUgpVGe1jz83FGOoIl75cwHgIBDAIBAQQWFhQyMDI0LTExLTE4VDE1OjMwOjIxWjAeAgESAgEBBBYW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result.createOrderFromAppleInAppPurchase.id).toBeDefined();
expect(result.createOrderFromAppleInAppPurchase.uuid).toBeDefined();
});
});

0 comments on commit 4cb24d1

Please sign in to comment.