service: payment-page

provider:
  name: aws
  region: eu-central-1
  runtime: provided.al2
  stage: prod
plugins:
  - ./vendor/bref/bref
  - ./vendor/bref/extra-php-extensions
# Exclude files from deployment
package:
  exclude:
    - 'node_modules/**'
    - 'tests/**'
    - '.env.local'
functions:
  api:
    name: 'payment-page'
    handler: public/index.php
    description: 'Paynetics Payment Page'
    timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
    environment:
      APP_ENV: 'prod'
      GIT: 'd8873ea118524e259ccd28bcc9c19c868d4b5fba'
      DATABASE_URL: '${ssm:/ecommerce-service-v2/prod/db_dsn_v2}'
      TERMINAL_SERVICE: '${ssm:/services/prod/terminal}'
      TRANSACTION_SERVICE: '${ssm:/services/prod/transaction_v2}'
      CARD_SERVICE: '${ssm:/services/prod/card_v2}'
      GATEWAY_SERVICE: '${ssm:/services/prod/gateway-v2}'
      INSTANCE_SERVICE: '${ssm:/services/prod/instance}'
      MERCHANT_SERVICE: '${ssm:/services/prod/merchant}'
      THREE_DOMAIN_SERVICE: '${ssm:/services/prod/3d_v2}'
      BIN_SERVICE: '${ssm:/services/prod/bin}'
      MESSENGER_TRANSPORT_DSN: '${ssm:/rabbitmq}'
      PAYOO: https://api.payoo.digital
      PAYOO_API_KEY: a30ad7eb-e65e-4c32-b021-89336a94a470
    layers:
      - ${bref:layer.php-81-fpm}
      - ${bref-extra:amqp-php-81}
    events:
      - alb:
          listenerArn: '${ssm:/payment-page/prod/alb}'
          priority: 1
          multiValueHeaders: true
          conditions:
            path: /
      - schedule:
          rate: rate(5 minutes)
          input:
            warmer: true
    vpc:
      securityGroupIds:
        - '${ssm:/payment-page/prod/sg}'
      subnetIds:
        - '${ssm:/payment-page/prod/subnet}'
        - '${ssm:/payment-page/prod/subnet_1}'


