GenesisGateway / genesis.js

Genesis Node.JS client integration
MIT License
1 stars 2 forks source link

TypeError: Cannot set properties of undefined (setting 'payment_type') #15

Closed Ccj-pro closed 1 year ago

Ccj-pro commented 1 year ago

version:"^3.0.2", os:windows 11, language:ts,

I caught an error when I called the transaction.ppro() method.

TypeError: Cannot set properties of undefined (setting 'payment_type') at new PPRO (D:\A_test\emerchantpay_test\node_modules\genesis.js\lib\genesis\transactions\financial\alternative\ppro.js:22:41) at Transaction.ppro (D:\A_test\emerchantpay_test\node_modules\genesis.js\lib\genesis\transaction.js:242:14) at AppService.createOrder (D:\A_test\emerchantpay_test\src\app.service.ts:43:19) at AppController.createOrder (D:\A_test\emerchantpay_test\src\app.controller.ts:15:28) at D:\A_test\emerchantpay_test\node_modules\@nestjs\core\router\router-execution-context.js:38:29 at InterceptorsConsumer.intercept (D:\A_test\emerchantpay_test\node_modules\@nestjs\core\interceptors\interceptors-consumer.js:11:20) at D:\A_test\emerchantpay_test\node_modules\@nestjs\core\router\router-execution-context.js:46:60 at D:\A_test\emerchantpay_test\node_modules\@nestjs\core\router\router-proxy.js:9:23 at Layer.handle [as handle_request] (D:\A_test\emerchantpay_test\node_modules\express\lib\router\layer.js:95:5) at next (D:\A_test\emerchantpay_test\node_modules\express\lib\router\route.js:144:13) at Route.dispatch (D:\A_test\emerchantpay_test\node_modules\express\lib\router\route.js:114:3) at Layer.handle [as handle_request] (D:\A_test\emerchantpay_test\node_modules\express\lib\router\layer.js:95:5) at D:\A_test\emerchantpay_test\node_modules\express\lib\router\index.js:284:15 at Function.process_params (D:\A_test\emerchantpay_test\node_modules\express\lib\router\index.js:346:12) at next (D:\A_test\emerchantpay_test\node_modules\express\lib\router\index.js:280:10) at urlencodedParser (D:\A_test\emerchantpay_test\node_modules\body-parser\lib\types\urlencoded.js:91:7)

this is my code: config.util.setModuleDefaults('customer', { username: "", password: "", token: "****" }); config.util.setModuleDefaults('gateway', { "protocol": "https", "hostname": "emerchantpay.net", "timeout": "60000", "testing": true }); config.util.setModuleDefaults('notifications', { "host": "", "port": "", "path": "" });

let transaction = new genesis.transaction();

let failure = function (reason) {
  return console.log('fail---', reason);
};

let success = function (data) {
  return console.log('success---', data);
};
transaction.ppro(
  {
    "transaction_id": "119643250547501c79d8295",
    "payment_type": "eps",
    "usage": "40208 concert tickets",
    "remote_ip": "245.253.2.12",
    "return_success_url": "http://www.example.com/success",
    "return_failure_url": "http://www.example.com/failure",
    "amount": "100",
    "currency": "EUR",
    "billing_address": {
      "first_name": "Barney",
      "last_name": "Rubble",
      "address1": "14, Nerazdelni str",
      "zip_code": "1407",
      "city": "Vienna",
      "country": "AT"
    }
  }
).send()
  .then(success)
  .catch(failure);

}

dyd commented 1 year ago

Hello @Ccj-pro,

Thank you for your issue and take apologize for the late response. We are currently preparing a new version and will investigate this issue.

We will keep you posted.

dyd commented 1 year ago

@Ccj-pro https://github.com/GenesisGateway/genesis.js/releases/tag/3.0.3 was published. You can check it out.