Google-pay-button paymentRequest typeErrors when building

Discussão em 'Angular' iniciado por Tom Rudge, Dezembro 3, 2024.

  1. Tom Rudge

    Tom Rudge Guest

    I've created this stackBlitz example where its building fine, no errors. I have uploaded this to a repository on github for me to clone and build locally or via github.dev /stackBlitz dev.

    On each of those clones it throws typeErrors with the import { GooglePayButtonModule } from '@google-pay/button-angular';.

    <google-pay-button environment="TEST" [paymentRequest]="paymentRequest"
    (loadpaymentdata)="onLoadPaymentData($event)"></google-pay-button>


    It complains about the paymentRequest config:

    paymentRequest = {
    apiVersion: 2,
    apiVersionMinor: 0,
    allowedPaymentMethods: [
    {
    type: 'CARD',
    parameters: {
    allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'],
    allowedCardNetworks: ['AMEX', 'VISA', 'MASTERCARD'],
    },
    tokenizationSpecification: {
    type: 'PAYMENT_GATEWAY',
    parameters: {
    gateway: 'example',
    gatewayMerchantId: 'exampleGatewayMerchantId',
    },
    },
    },
    ],
    merchantInfo: {
    merchantId: '12345678901234567890',
    merchantName: 'Demo Merchant',
    },
    transactionInfo: {
    totalPriceStatus: 'FINAL',
    totalPriceLabel: 'Total',
    totalPrice: '100.00',
    currencyCode: 'USD',
    countryCode: 'US',
    },
    };


    Example of error from other IDEs...

    [​IMG]

    Whats wrong and why does it work and not complain on stackBlitz?

    Is there some setting in tsconfig I'm missing about strict typings, where StackBlitz is more sympathetic?

    Continue reading...

Compartilhe esta Página