Git Product home page Git Product logo

medusa-payment-paystack's People

Contributors

a11rew avatar dependabot[bot] avatar femakin avatar femitosin avatar github-actions[bot] avatar jaekralj avatar mannyandem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

medusa-payment-paystack's Issues

Automatically mark payments as "Captured"

Payments successfully completed via Paystack are marked as "Awaiting Capture" even though they're completed and there is nothing more to do. Paystack does not have the concept of capturing funds from payments.

We should automatically mark payments as captured on successful completion of the payment flow.

Update deprecated subscriber implementation

Issue

The subscriber implementation pattern used in the plugin's automatic order capturing subscriber has been deprecated since Medusa v1.18.

This warning is logged out when a server with the plugin is started as a result

The subscriber in /app/node_modules/medusa-payment-paystack/dist/subscribers/orderCapturer.js is missing a config.

Expected outcome

At the completion of this issue the automatic order capturing subscriber would have been updated to use the new Subscriber API. This guide describes the new API and migration details.

Order reconciliation issue

Some transactions are not getting updated correctly on the Medusa dashboard. This happened randomly.

Manually had to fulfil some orders. Successful orders (2 of them) were recorded as pending on Medusa

Handle Paystack 5xx errors better

Issue

Paystack 5xx errors especially during the verification of payments break the payment order flow with little feedback to the developer on what went wrong.

Proposed solution

We should be internally retrying on 5xx errors from Paystack, with a limit and a backoff. 5xx errors which occur in spite of these should be logged out better (even without debug mode enabled)

Duplicate Transaction Reference "KES" not issue #74, but similar

We are using KES and are guessing the plugin takes the cart amount as the actual cart amount, e.g KES 3650 is translated as KES 3650 to Paystack by plugin.

The issue comes in the popup, when one passes 3650 * 100 you get a 'duplicate transaction reference'.
Passing it as original amount "3650" makes the payment KES 36.5 which is wrong but payment succeeds.

Also I don't know whether to raise a new issue for this too. But when the erroneous "KES 36.5" transaction completes the plugin fails to complete the cart with error

error:   current transaction is aborted, commands ignored until end of transaction block
QueryFailedError: current transaction is aborted, commands ignored until end of transaction block

and

node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25) {
  query: 'SELECT "Cart"."id" AS "Cart_id", "Cart"."created_at" AS "Cart_created_at", "Cart"."updated_at" AS "Cart_updated_at", "Cart"."deleted_at" AS "Cart_deleted_at", "Cart"."email" AS "Cart_email", "Cart"."billing_address_id" AS "Cart_billing_address_id", "Cart"."shipping_address_id" AS "Cart_shipping_address_id", "Cart"."region_id" AS "Cart_region_id", "Cart"."customer_id" AS "Cart_customer_id", "Cart"."payment_id" AS "Cart_payment_id", "Cart"."type" AS "Cart_type", "Cart"."completed_at" AS "Cart_completed_at", "Cart"."payment_authorized_at" AS "Cart_payment_authorized_at", "Cart"."idempotency_key" AS "Cart_idempotency_key", "Cart"."context" AS "Cart_context", "Cart"."metadata" AS "Cart_metadata", "Cart"."sales_channel_id" AS "Cart_sales_channel_id", "Cart"."store_id" AS "Cart_store_id" FROM "public"."cart" "Cart" WHERE ( (("Cart"."id" = $1)) ) AND ( "Cart"."deleted_at" IS NULL ) LIMIT 1',
  parameters: [ 'cart_01HRET3DYVETJMSF0P09NSD' ],
  driverError: error: current transaction is aborted, commands ignored until end of transaction block
     ) {
    length: 145,
    severity: 'ERROR',
    code: '25P02',
    detail: undefined,
    hint: undefined,
    position: undefined,
    internalPosition: undefined,
    internalQuery: undefined,
    where: undefined,
    schema: undefined,
    table: undefined,
    column: undefined,
    dataType: undefined,
    constraint: undefined,
    file: 'postgres.c',
    line: '1470',
    routine: 'exec_parse_message'
  },
  length: 145,
  severity: 'ERROR',
  code: '25P02',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'postgres.c',
  line: '1470',
  routine: 'exec_parse_message'
}

I am guessing the plugin is somehow looking to check if amounts are same. Which would always be false since cart has KES 3650 (in db/medusa) and paid amount is KES 36.5 (paystack)

Paystack popup flow complaining of duplicate transaction ref

Hi, When I try to use the popup flow as described in the README, The paystack popup throws an error of duplicate transaction reference. I'm guessing its because the plugin creates a transaction already but I'm not 100% sure. Is this the case, and how can I get around this? Thanks in advance!

Support payment verifications via webhook

Issue

Paystack provides webhook notifications on successful payments. We should be listening for these and verifying orders on successful payments so user payments are never lost in case anything else outside our control errors out

Medusa >=v1.8 support RFC

This issue will be used to track this plugin's support for the latest updates to Medusa.

Known Issues


Planned Updates



Comment with issues you face and or updates relevant to your use-case you'd like to see added.

Build failing pointing to plugin

Builds are failing all of a sudden and checking the logs it points to the plugin.
Check the logs
Railway
message="Initializing API" activity_id="01HSBPB3SX1V9764MZSB32W5DQ" config={} level="info" timestamp="2024-03-19 15:47:37" message="API initialized" activity_id="01HSBPB3SX1V9764MZSB32W5DQ" duration=76 level="info" timestamp="2024-03-19 15:47:37" message="Initializing defaults" activity_id="01HSBPB3X0QXY2NZEGGKSMP89X" config={} level="info" timestamp="2024-03-19 15:47:37" message="You don't have any notification provider plugins installed. You may want to add one to your project." level="warn" timestamp="2024-03-19 15:47:37" message="You don't have any taxProviders provider plugins installed. You may want to add one to your project." level="warn" timestamp="2024-03-19 15:47:37" message="Error starting server" level="error" stack=[{"columnNumber":15,"fileName":"node:internal/modules/cjs/loader","functionName":"Module._resolveFilename","lineNumber":1077,"methodName":"_resolveFilename","native":false,"typeName":"Module"},{"columnNumber":27,"fileName":"node:internal/modules/cjs/loader","functionName":"Module._load","lineNumber":922,"methodName":"_load","native":false,"typeName":"Module"},{"columnNumber":19,"fileName":"node:internal/modules/cjs/loader","functionName":"Module.require","lineNumber":1143,"methodName":"require","native":false,"typeName":"Module"},{"columnNumber":18,"fileName":"node:internal/modules/cjs/helpers","functionName":"require","lineNumber":119,"methodName":null,"native":false,"typeName":null},{"columnNumber":27,"fileName":"/app/node_modules/medusa-payment-paystack/dist/services/paystack-payment-processor.js","functionName":"new PaystackPaymentProcessor","lineNumber":76,"methodName":null,"native":false,"typeName":null},{"columnNumber":99,"fileName":"/app/node_modules/@medusajs/medusa/dist/loaders/helpers/plugins.js","functionName":"container.registerAdd.lifetime","lineNumber":14,"methodName":"lifetime","native":false,"typeName":"container.registerAdd"},{"columnNumber":20,"fileName":"/app/node_modules/awilix/lib/resolvers.js","functionName":"Object.resolve","lineNumber":295,"methodName":"resolve","native":false,"typeName":"Object"},{"columnNumber":37,"fileName":"/app/node_modules/awilix/lib/container.js","functionName":"Object.build","lineNumber":325,"methodName":"build","native":false,"typeName":"Object"},{"columnNumber":73,"fileName":"/app/node_modules/medusa-core-utils/dist/medusa-container.js","functionName":null,"lineNumber":8,"methodName":null,"native":false,"typeName":null},{"columnNumber":null,"fileName":null,"functionName":"Array.map","lineNumber":null,"methodName":"map","native":false,"typeName":"Array"}] timestamp="2024-03-19 15:47:38"

Local logs

You don't have any taxProviders provider plugins installed. You may want to add one to you
⠧ Initializing defaults
error:   Error starting server
Error: Cannot find module 'msw/node'
Require stack:
- /Users/user/Documents/GitHub/admin/node_modules/medusa-payment-paystack/dist/services/paystack-payment-processor.js
- /Users/user/Documents/GitHub/admin/node_modules/@medusajs/medusa/dist/loaders/plugins.js
- /Users/user/Documents/GitHub/admin/node_modules/@medusajs/medusa/dist/loaders/index.js
- /Users/user/Documents/GitHub/admin/node_modules/@medusajs/medusa/dist/commands/start.js
- /opt/homebrew/lib/node_modules/@medusajs/medusa-cli/dist/create-cli.js
- /opt/homebrew/lib/node_modules/@medusajs/medusa-cli/dist/index.js
- /opt/homebrew/lib/node_modules/@medusajs/medusa-cli/cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at new PaystackPaymentProcessor (/Users/user/Documents/GitHub/admin/node_modules/medusa-payment-paystack/dist/services/paystack-payment-processor.js:76:27)
    at container.registerAdd.lifetime (/Users/user/Documents/GitHub/admin/node_modules/@medusajs/medusa/dist/loaders/helpers/plugins.js:14:99)
    at Object.resolve (/Users/user/Documents/GitHub/admin/node_modules/awilix/lib/resolvers.js:295:20)
    at Object.build (/Users/user/Documents/GitHub/admin/node_modules/awilix/lib/container.js:325:37)
    at /Users/user/Documents/GitHub/admin/node_modules/medusa-core-utils/dist/medusa-container.js:8:73
    at Array.map (<anonymous>) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/user/Documents/GitHub/admin/node_modules/medusa-payment-paystack/dist/services/paystack-payment-processor.js',
    '/Users/user/Documents/GitHub/admin/node_modules/@medusajs/medusa/dist/loaders/plugins.js',
    '/Users/user/Documents/GitHub/admin/node_modules/@medusajs/medusa/dist/loaders/index.js',
    '/Users/user/Documents/GitHub/admin/node_modules/@medusajs/medusa/dist/commands/start.js',
    '/opt/homebrew/lib/node_modules/@medusajs/medusa-cli/dist/create-cli.js',
    '/opt/homebrew/lib/node_modules/@medusajs/medusa-cli/dist/index.js',
    '/opt/homebrew/lib/node_modules/@medusajs/medusa-cli/cli.js'
  ]
}

Query Error on calling "complete transaction"

I am getting an error on calling

onSuccess: async (transaction) => {
       // Payment complete! Reference: transaction.reference
       console.log(transaction)
       const { type, data } = await medusa.carts.complete(cartId)
       console.log(type)
       console.log(data)
     },

the error in backend and logs.
The Debug log from plugin flow like

::1 - - [08/Mar/2024:15:28:07 +0000] "POST /store/carts/cart_01HRFASJ63GC39NS0W8ER05H4M HTTP/1.1" 200 4815 "-" "axios/0.24.0"
::1 - - [08/Mar/2024:15:28:41 +0000] "OPTIONS /store/carts/cart_01HRFASJ63GC39NS0W8ER05H4M/payment-sessions HTTP/1.1" 204 0 "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
PS_P_Debug: InitiatePayment {
  "amount": 365000,
  "context": {
    "ip": "::1",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
  },
  "currency_code": "kes",
  "customer": {
    "id": "cus_01HRD84CWXH76SF9PDS7M80MNX",
    "created_at": "2024-03-07T20:01:58.811Z",
    "updated_at": "2024-03-07T20:01:58.811Z",
    "deleted_at": null,
    "email": "[email protected]",
    "first_name": null,
    "last_name": null,
    "billing_address_id": null,
    "phone": null,
    "has_account": false,
    "metadata": null
  },
  "email": "[email protected]",
  "billing_address": null,
  "resource_id": "cart_01HRFASJ63GC39NS0W8ER05H4M",
  "paymentSessionData": {}
}
::1 - - [08/Mar/2024:15:28:49 +0000] "POST /store/carts/cart_01HRFASJ63GC39NS0W8ER05H4M/payment-sessions HTTP/1.1" 200 12430 "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
::1 - - [08/Mar/2024:15:29:07 +0000] "OPTIONS /store/carts/cart_01HRFASJ63GC39NS0W8ER05H4M/complete HTTP/1.1" 204 0 "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
PS_P_Debug: AuthorizePayment {
  "cartId": "cart_01HRFASJ63GC39NS0W8ER05H4M",
  "paystackTxRef": "3eg6u4benc",
  "paystackTxAuthData": {
    "reference": "3eg6u4benc",
    "access_code": "itxwli1w3yo3epx",
    "authorization_url": "https://checkout.paystack.com/itxwli1w3yo3epx"
  }
}
PS_P_Debug: AuthorizePayment: Verification {
  "status": true,
  "cart": {
    "object": "cart",
    "id": "cart_01HRFASJ63GC39NS0W8ER05H4M",
    "created_at": "2024-03-08T15:27:02.932Z",
    "updated_at": "2024-03-08T15:27:55.913Z",
    "deleted_at": null,
    "email": "[email protected]",
    "billing_address_id": null,
    "shipping_address_id": "addr_01HRFASJ64QGQ5BXS2JHTC09GY",
    "region_id": "reg_01HRD67V2GM8C10HVGGA0V59P8",
    "customer_id": "cus_01HRD84CWXH76SF9PDS7M80MNX",
    "payment_id": null,
    "type": "default",
    "completed_at": null,
    "payment_authorized_at": null,
    "idempotency_key": null,
    "context": {
      "ip": "::1",
      "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
    },
    "metadata": null,
    "sales_channel_id": "sc_01HRD67B6NKYHJQ3TZAPWD5Z6G",
    "store_id": "store_01HRD675TH1B6PZ1B8H6F2DSVP",
    "discounts": [],
    "gift_cards": [],
    "items": [
      {
        "id": "item_01HRFASR6V4DP2C3BE0BEKBQ2M",
        "created_at": "2024-03-08T15:27:02.932Z",
        "updated_at": "2024-03-08T15:27:02.932Z",
        "cart_id": "cart_01HRFASJ63GC39NS0W8ER05H4M",
        "order_id": null,
        "swap_id": null,
        "claim_order_id": null,
        "original_item_id": null,
        "order_edit_id": null,
        "title": "Medusa Hoodie",
        "description": "M",
        "thumbnail": "https://medusa-public-images.s3.eu-west-1.amazonaws.com/black_hoodie_front.png",
        "is_return": false,
        "is_giftcard": false,
        "should_merge": true,
        "allow_discounts": true,
        "has_shipping": false,
        "unit_price": 365000,
        "variant_id": "variant_01HRD6CTMZ50NRYJ8ZMBD943KQ",
        "quantity": 1,
        "fulfilled_quantity": null,
        "returned_quantity": null,
        "shipped_quantity": null,
        "metadata": {},
        "adjustments": [],
        "tax_lines": [
          {
            "rate": 0,
            "name": "default",
            "code": "default",
            "item_id": "item_01HRFASR6V4DP2C3BE0BEKBQ2M"
          }
        ],
        "variant": {
          "id": "variant_01HRD6CTMZ50NRYJ8ZMBD943KQ",
          "created_at": "2024-03-07T19:28:51.314Z",
          "updated_at": "2024-03-07T19:28:51.314Z",
          "deleted_at": null,
          "title": "M",
          "product_id": "prod_01HRD6CGGK11VV4BT53TG3RWS6",
          "sku": null,
          "barcode": null,
          "ean": null,
          "upc": null,
          "variant_rank": 1,
          "inventory_quantity": 100,
          "allow_backorder": false,
          "manage_inventory": true,
          "hs_code": null,
          "origin_country": null,
          "mid_code": null,
          "material": null,
          "weight": null,
          "length": null,
          "height": null,
          "width": null,
          "metadata": null,
          "product": {
            "id": "prod_01HRD6CGGK11VV4BT53TG3RWS6",
            "created_at": "2024-03-07T19:28:51.314Z",
            "updated_at": "2024-03-07T19:28:51.314Z",
            "deleted_at": null,
            "title": "Medusa Hoodie",
            "subtitle": null,
            "description": "Reimagine the feeling of a classic hoodie. With our cotton hoodie, everyday essentials no longer have to be ordinary.",
            "handle": "hoodie",
            "is_giftcard": false,
            "status": "published",
            "thumbnail": "https://medusa-public-images.s3.eu-west-1.amazonaws.com/black_hoodie_front.png",
            "weight": 400,
            "length": null,
            "height": null,
            "width": null,
            "hs_code": null,
            "origin_country": null,
            "mid_code": null,
            "material": null,
            "collection_id": null,
            "type_id": null,
            "discountable": true,
            "external_id": null,
            "metadata": null,
            "store_id": "store_01HRD675TH1B6PZ1B8H6F2DSVP",
            "profiles": [
              {
                "id": "sp_01HRD6773HWVG22T9NJCRM5EB3",
                "created_at": "2024-03-07T19:28:37.478Z",
                "updated_at": "2024-03-07T19:28:37.478Z",
                "deleted_at": null,
                "name": "Default Shipping Profile",
                "type": "default",
                "metadata": null
              }
            ],
            "profile": {
              "id": "sp_01HRD6773HWVG22T9NJCRM5EB3",
              "created_at": "2024-03-07T19:28:37.478Z",
              "updated_at": "2024-03-07T19:28:37.478Z",
              "deleted_at": null,
              "name": "Default Shipping Profile",
              "type": "default",
              "metadata": null
            },
            "profile_id": "sp_01HRD6773HWVG22T9NJCRM5EB3"
          }
        },
        "subtotal": 365000,
        "discount_total": 0,
        "total": 365000,
        "original_total": 365000,
        "original_tax_total": 0,
        "tax_total": 0,
        "raw_discount_total": 0
      }
    ],
    "region": {
      "id": "reg_01HRD67V2GM8C10HVGGA0V59P8",
      "created_at": "2024-03-07T19:28:51.314Z",
      "updated_at": "2024-03-07T19:28:51.314Z",
      "deleted_at": null,
      "name": "Kenya",
      "currency_code": "kes",
      "tax_rate": 0,
      "tax_code": null,
      "gift_cards_taxable": true,
      "automatic_taxes": true,
      "tax_provider_id": null,
      "metadata": null,
      "store_id": null,
      "tax_rates": []
    },
    "shipping_address": {
      "id": "addr_01HRFASJ64QGQ5BXS2JHTC09GY",
      "created_at": "2024-03-08T15:27:02.932Z",
      "updated_at": "2024-03-08T15:27:02.932Z",
      "deleted_at": null,
      "customer_id": null,
      "company": null,
      "first_name": null,
      "last_name": null,
      "address_1": null,
      "address_2": null,
      "city": null,
      "country_code": "ke",
      "province": null,
      "postal_code": null,
      "phone": null,
      "metadata": null
    },
    "shipping_methods": [],
    "subtotal": 365000,
    "discount_total": 0,
    "item_tax_total": 0,
    "shipping_total": 0,
    "shipping_tax_total": 0,
    "tax_total": 0,
    "raw_discount_total": 0,
    "gift_card_total": 0,
    "gift_card_tax_total": 0,
    "total": 365000
  },
  "data": {
    "id": 3613162318,
    "domain": "test",
    "status": "success",
    "reference": "3eg6u4benc",
    "receipt_number": null,
    "amount": 365000,
    "message": null,
    "gateway_response": "Successful",
    "paid_at": "2024-03-08T15:29:06.000Z",
    "created_at": "2024-03-08T15:28:46.000Z",
    "channel": "card",
    "currency": "KES",
    "ip_address": "102.216.154.22",
    "metadata": "",
    "log": {
      "start_time": 1709911732,
      "time_spent": 15,
      "attempts": 1,
      "errors": 0,
      "success": true,
      "mobile": false,
      "input": [],
      "history": [
        {
          "type": "action",
          "message": "Attempted to pay with card",
          "time": 13
        },
        {
          "type": "success",
          "message": "Successfully paid with card",
          "time": 15
        }
      ]
    },
    "fees": 10585,
    "fees_split": null,
    "authorization": {
      "authorization_code": "AUTH_el2nki8rfz",
      "bin": "408408",
      "last4": "4081",
      "exp_month": "12",
      "exp_year": "2030",
      "channel": "card",
      "card_type": "visa ",
      "bank": "TEST BANK",
      "country_code": "KE",
      "brand": "visa",
      "reusable": true,
      "signature": "SIG_U5pHKLz0bcUGdoiQGO8N",
      "account_name": null
    },
    "customer": {
      "id": 161294551,
      "first_name": null,
      "last_name": null,
      "email": "[email protected]",
      "customer_code": "CUS_8awg20qv0kc0gza",
      "phone": null,
      "metadata": null,
      "risk_action": "default",
      "international_format_phone": null
    },
    "plan": null,
    "split": {},
    "order_id": null,
    "paidAt": "2024-03-08T15:29:06.000Z",
    "createdAt": "2024-03-08T15:28:46.000Z",
    "requested_amount": 365000,
    "pos_transaction_data": null,
    "source": null,
    "fees_breakdown": null,
    "connect": null,
    "transaction_date": "2024-03-08T15:28:46.000Z",
    "plan_object": {},
    "subaccount": {}
  }
}
PS_P_Debug: RetrievePayment {
  "paystackTxId": 3613162318,
  "paystackTxData": {
    "id": 3613162318,
    "log": {
      "input": [],
      "errors": 0,
      "mobile": false,
      "history": [
        {
          "time": 13,
          "type": "action",
          "message": "Attempted to pay with card"
        },
        {
          "time": 15,
          "type": "success",
          "message": "Successfully paid with card"
        }
      ],
      "success": true,
      "attempts": 1,
      "start_time": 1709911732,
      "time_spent": 15
    },
    "fees": 10585,
    "plan": null,
    "split": {},
    "amount": 365000,
    "domain": "test",
    "paidAt": "2024-03-08T15:29:06.000Z",
    "source": null,
    "status": "success",
    "channel": "card",
    "connect": null,
    "message": null,
    "paid_at": "2024-03-08T15:29:06.000Z",
    "currency": "KES",
    "customer": {
      "id": 161294551,
      "email": "[email protected]",
      "phone": null,
      "metadata": null,
      "last_name": null,
      "first_name": null,
      "risk_action": "default",
      "customer_code": "CUS_8awg20qv0kc0gza",
      "international_format_phone": null
    },
    "metadata": "",
    "order_id": null,
    "createdAt": "2024-03-08T15:28:46.000Z",
    "reference": "3eg6u4benc",
    "created_at": "2024-03-08T15:28:46.000Z",
    "fees_split": null,
    "ip_address": "102.216.154.22",
    "subaccount": {},
    "plan_object": {},
    "authorization": {
      "bin": "408408",
      "bank": "TEST BANK",
      "brand": "visa",
      "last4": "4081",
      "channel": "card",
      "exp_year": "2030",
      "reusable": true,
      "card_type": "visa ",
      "exp_month": "12",
      "signature": "SIG_U5pHKLz0bcUGdoiQGO8N",
      "account_name": null,
      "country_code": "KE",
      "authorization_code": "AUTH_el2nki8rfz"
    },
    "fees_breakdown": null,
    "receipt_number": null,
    "gateway_response": "Successful",
    "requested_amount": 365000,
    "transaction_date": "2024-03-08T15:28:46.000Z",
    "pos_transaction_data": null
  }
}
PS_P_Debug: GetPaymentStatus {
  "paystackTxId": 3613162318,
  "paystackTxData": {
    "id": 3613162318,
    "log": {
      "input": [],
      "errors": 0,
      "mobile": false,
      "history": [
        {
          "time": 13,
          "type": "action",
          "message": "Attempted to pay with card"
        },
        {
          "time": 15,
          "type": "success",
          "message": "Successfully paid with card"
        }
      ],
      "success": true,
      "attempts": 1,
      "start_time": 1709911732,
      "time_spent": 15
    },
    "fees": 10585,
    "plan": {},
    "split": {},
    "amount": 365000,
    "domain": "test",
    "paidAt": "2024-03-08T15:29:06.000Z",
    "source": {
      "type": "api",
      "source": "merchant_api",
      "identifier": null
    },
    "status": "success",
    "channel": "card",
    "connect": null,
    "message": null,
    "paid_at": "2024-03-08T15:29:06.000Z",
    "currency": "KES",
    "customer": {
      "id": 161294551,
      "email": "[email protected]",
      "phone": null,
      "metadata": null,
      "last_name": null,
      "first_name": null,
      "risk_action": "default",
      "customer_code": "CUS_8awg20qv0kc0gza",
      "international_format_phone": null
    },
    "metadata": "",
    "order_id": null,
    "createdAt": "2024-03-08T15:28:46.000Z",
    "reference": "3eg6u4benc",
    "created_at": "2024-03-08T15:28:46.000Z",
    "fees_split": null,
    "ip_address": "102.216.154.22",
    "subaccount": {},
    "authorization": {
      "bin": "408408",
      "bank": "TEST BANK",
      "brand": "visa",
      "last4": "4081",
      "channel": "card",
      "exp_year": "2030",
      "reusable": true,
      "card_type": "visa ",
      "exp_month": "12",
      "signature": "SIG_U5pHKLz0bcUGdoiQGO8N",
      "account_name": null,
      "country_code": "KE",
      "authorization_code": "AUTH_el2nki8rfz"
    },
    "helpdesk_link": null,
    "fees_breakdown": null,
    "receipt_number": null,
    "gateway_response": "Successful",
    "requested_amount": 365000,
    "pos_transaction_data": null
  }
}

Then the error occurs right after

error:   current transaction is aborted, commands ignored until end of transaction block
QueryFailedError: current transaction is aborted, commands ignored until end of transaction block
    at PostgresQueryRunner.query (/Users/user/Documents/GitHub/admin/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SelectQueryBuilder.loadRawResults (/Users/user/Documents/GitHub/admin/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2192:25)
    at async SelectQueryBuilder.executeEntitiesAndRawResults (/Users/user/Documents/GitHub/admin/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2040:26)
    at async SelectQueryBuilder.getRawAndEntities (/Users/user/Documents/GitHub/admin/node_modules/typeorm/query-builder/SelectQueryBuilder.js:684:29)
    at async SelectQueryBuilder.getMany (/Users/user/Documents/GitHub/admin/node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25) {
  query: 'SELECT "Cart"."id" AS "Cart_id", "Cart"."created_at" AS "Cart_created_at", "Cart"."updated_at" AS "Cart_updated_at", "Cart"."deleted_at" AS "Cart_deleted_at", "Cart"."email" AS "Cart_email", "Cart"."billing_address_id" AS "Cart_billing_address_id", "Cart"."shipping_address_id" AS "Cart_shipping_address_id", "Cart"."region_id" AS "Cart_region_id", "Cart"."customer_id" AS "Cart_customer_id", "Cart"."payment_id" AS "Cart_payment_id", "Cart"."type" AS "Cart_type", "Cart"."completed_at" AS "Cart_completed_at", "Cart"."payment_authorized_at" AS "Cart_payment_authorized_at", "Cart"."idempotency_key" AS "Cart_idempotency_key", "Cart"."context" AS "Cart_context", "Cart"."metadata" AS "Cart_metadata", "Cart"."sales_channel_id" AS "Cart_sales_channel_id", "Cart"."store_id" AS "Cart_store_id" FROM "public"."cart" "Cart" WHERE ( (("Cart"."id" = $1)) ) AND ( "Cart"."deleted_at" IS NULL ) LIMIT 1',
  parameters: [ 'cart_01HRF8FTS2AVE4K0VZJCK87970' ],
  driverError: error: current transaction is aborted, commands ignored until end of transaction block
      at /Users/user/Documents/GitHub/admin/node_modules/pg/lib/client.js:526:17
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async PostgresQueryRunner.query (/Users/user/Documents/GitHub/admin/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:184:25)
      at async SelectQueryBuilder.loadRawResults (/Users/user/Documents/GitHub/admin/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2192:25)
      at async SelectQueryBuilder.executeEntitiesAndRawResults (/Users/user/Documents/GitHub/admin/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2040:26)
      at async SelectQueryBuilder.getRawAndEntities (/Users/user/Documents/GitHub/admin/node_modules/typeorm/query-builder/SelectQueryBuilder.js:684:29)
      at async SelectQueryBuilder.getMany (/Users/user/Documents/GitHub/admin/node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25) {
    length: 145,
    severity: 'ERROR',
    code: '25P02',
    detail: undefined,
    hint: undefined,
    position: undefined,
    internalPosition: undefined,
    internalQuery: undefined,
    where: undefined,
    schema: undefined,
    table: undefined,
    column: undefined,
    dataType: undefined,
    constraint: undefined,
    file: 'postgres.c',
    line: '1470',
    routine: 'exec_parse_message'
  },
  length: 145,
  severity: 'ERROR',
  code: '25P02',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'postgres.c',
  line: '1470',
  routine: 'exec_parse_message'
}
::1 - - [08/Mar/2024:14:48:35 +0000] "POST /store/carts/cart_01HRF8FTS2AVE4K0VZJCK87970/complete HTTP/1.1" 500 86 "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" 

Replace out of date `paystack-api` package

We currently depend on version ^2.0.6 of the paystack-api package, it's used internally for making calls to the Paystack API.

The package hasn't been updated in 2 years though and depends on a number of deprecated packages, triggering NPM deprecated package warnings when this plugin is installed.

Screenshot 2023-08-06 at 3 26 39 PM

We need to either replace this package with another maintained wrapper of the Paystack API or handle making the calls manually.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.