How to use the braintree.WebhookNotification function in braintree

To help you get started, we’ve selected a few braintree examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nestjsx / nestjs-braintree / src / __tests__ / webhooks.spec.ts View on Github external
it('Canceled', async () => {
    const braintreeProvider = module.get(BraintreeProvider);
    const braintreeWebhookProvider = module.get(BraintreeWebhookProvider);

    const webhookNotification = await braintreeProvider.parseWebhook(
      gateway.webhookTesting.sampleNotification(
        braintree.WebhookNotification.Kind.SubscriptionCanceled,
      ),
    );

    braintreeWebhookProvider.handle(webhookNotification);

    expect(TestProvider.called).toBe('canceled');
  });
github nestjsx / nestjs-braintree / src / __tests__ / e2e / braintree.controller.e2e-spec.ts View on Github external
it('/braintree/webhook (POST) Canceled', async () => {
    const webhook = gateway.webhookTesting.sampleNotification(
      braintree.WebhookNotification.Kind.SubscriptionCanceled,
    );
    
    return await request(app.getHttpServer())
      .post('/braintree/webhook')
      .set('Content-Type', 'application/json')
      .send(webhook)
      .expect(201);
  });
github nestjsx / nestjs-braintree / src / __tests__ / webhooks.spec.ts View on Github external
it('TrialEnded', async () => {
    const braintreeProvider = module.get(BraintreeProvider);
    const braintreeWebhookProvider = module.get(BraintreeWebhookProvider);

    const webhookNotification = await braintreeProvider.parseWebhook(
      gateway.webhookTesting.sampleNotification(
        braintree.WebhookNotification.Kind.SubscriptionTrialEnded,
      ),
    );

    braintreeWebhookProvider.handle(webhookNotification);

    expect(TestProvider.called).toBe('trialEnded');
  });
github nestjsx / nestjs-braintree / src / __tests__ / braintree.webhook.provider.spec.ts View on Github external
const gateway = braintree.connect({
      environment: braintree.Environment.Sandbox,
      merchantId: 'merchantId',
      publicKey: 'publicKey',
      privateKey: 'privateKey',
    });

    const braintreeProvider = module.get(BraintreeProvider);
    const webhookProvider = module.get(
      BraintreeWebhookProvider,
    );

    const webhookNotification = await braintreeProvider.parseWebhook(
      gateway.webhookTesting.sampleNotification(
        braintree.WebhookNotification.Kind.SubscriptionCanceled,
      ),
    );

    webhookProvider.handle(webhookNotification);

    expect(UselessProvider.called).toBeTruthy();
  });
github nestjsx / nestjs-braintree / src / __tests__ / braintree.webhook.provider.spec.ts View on Github external
const gateway = braintree.connect({
      environment: braintree.Environment.Sandbox,
      merchantId: 'merchantId',
      publicKey: 'publicKey',
      privateKey: 'privateKey',
    });

    const braintreeProvider = module.get(BraintreeProvider);
    const webhookProvider = module.get(
      BraintreeWebhookProvider,
    );

    const webhookNotification = await braintreeProvider.parseWebhook(
      gateway.webhookTesting.sampleNotification(
        braintree.WebhookNotification.Kind.SubscriptionCanceled,
      ),
    );

    webhookProvider.handle(webhookNotification);

    expect(SubscriptionProvider.called).toBeTruthy();
  });

braintree

A library for server-side integrating with Braintree.

MIT
Latest version published 2 months ago

Package Health Score

71 / 100
Full package analysis