Giter Site home page Giter Site logo

xendit / xendit-node Goto Github PK

View Code? Open in Web Editor NEW
96.0 24.0 63.0 1.59 MB

Xendit REST API Client for Node.js - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets, QR Codes, Direct Debit

Home Page: https://developers.xendit.co/api-reference/

TypeScript 100.00%
xendit javascript payment payment-gateway card virtual-account invoice disbursement recurring-payments payout

xendit-node's People

Contributors

andriimedvediev avatar bob-xendit avatar bobari93 avatar cassiewang avatar coby9241 avatar daaishi avatar dependabot[bot] avatar dharmasatrya avatar edirates avatar ervanadetya avatar flamehamster avatar glendaesutanto avatar hakiemaul avatar hendryzheng avatar javiersuweijie avatar jmxendit avatar kevindavee avatar ligertsicat avatar mesmur avatar muthmainnah234 avatar mychaelgo avatar pelly-ryu avatar sekaranglila avatar stanleynguyen avatar stephenthajeb avatar u-viktor avatar willypt avatar xen-hendryzheng avatar xenzun avatar zakiarsyad 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

xendit-node's Issues

INSTALASI SUKSES TP PHP EROR

saya sudah install dengan composer dan muncul folder vendor

lalu next stepnya, saya buka di localhost
http://localhost/xendit/vendor/xendit/xendit-php/tests/TestCase.php

keluar eror
Fatal error: Uncaught Error: Class 'PHPUnit\Framework\TestCase' not found in C:\xampp\htdocs\xendit\vendor\xendit\xendit-php\tests\TestCase.php:25 Stack trace: #0 {main} thrown in C:\xampp\htdocs\xendit\vendor\xendit\xendit-php\tests\TestCase.php on line 25

boleh tolong ??

Xendit.js 404

Xendit.js link in README navigate to 404 page, is it expected?

Screenshot 2021-03-23 191714

[new] Tokenization for ewallet

this issue raised to ask for support tokenization flow for ewallet. we'll need Initialize Linked Account Tokenization method to be able to pass in cancel_redirect_url

Header issues with node v13

FetchError: request to https://api.xendit.co/available_disbursements_banks failed, reason: Parse Error: Invalid header value char
    at ClientRequest.<anonymous> (/Users/stanleynguyen/Documents/Projects/xendit-node/node_modules/node-fetch/lib/index.js:1455:11)
    at ClientRequest.emit (events.js:219:5)
    at TLSSocket.socketOnData (_http_client.js:474:9)
    at TLSSocket.emit (events.js:219:5)
    at addChunk (_stream_readable.js:332:12)
    at readableAddChunk (_stream_readable.js:307:11)
    at TLSSocket.Readable.push (_stream_readable.js:241:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:185:23) {
  message: 'request to https://api.xendit.co/available_disbursements_banks failed, reason: Parse Error: Invalid header value char',
  type: 'system',
  errno: 'HPE_INVALID_HEADER_TOKEN',
  code: 'HPE_INVALID_HEADER_TOKEN'
}

Integrate With Angular

Is it possible to integrate with Angular? I try to integrate API with angular HTTP but always response error CORS. Any solution about this ?

The expression of an export assignment must be an identifier or qualified name in an ambient context.

According https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#arbitrary-expressions-are-forbidden-in-export-assignments-in-ambient-contexts exporting ambient contexts are forbidden

exportig definition should be:

class Xendit {
    ...
}

export = Xendit

instead export directly:

export = class Xendit {
  ...
}

so we must refactoring https://github.com/xendit/xendit-node/blob/master/src/xendit.d.ts and related files

README.md touch up

  • Do refer to API Reference from each sub-header for easier understanding about each parameter
  • This line For the full documentation, please refer to Xendit Node Client Docs is no longer needed

[SDK][NEW API] Cards Get Token

In regards with cards new API and documentation update we will need new method of card.getToken on xendit-node client library.

This issue is request for it.

const x = new require('xendit-node')({ secretKey: 'xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==' });

const { Card } = x;
const cardSpecificOptions = {};
const card = new Card(cardSpecificOptions);

const resp = await card.getToken({ chargeID: '605c05d3f81fa60011b2fa4e' });
console.log(resp);

Ewallet Response Error Code

How to get Response error Code Ewallet OVO and Dana by PHP Script.

I received a response type string.

I try :

Param :
$data = [ 'external_id' => $Code, 'amount' => $Amount, 'phone' => '0' . $phone, 'ewallet_type' => $PaymentMethod ];

    try{
        $Result = EWallets::create($data);
    }catch (\ ApiExceptions $apiExceptions){
      // Condition A //
        $Data                       = [
            'status'                => false,
            'message'               => $apiExceptions->getMessage(),
            'code'                  => $apiExceptions->getCode()
        ];

        return response($Data, 200)
            ->header('Content-Type', 'text/plain');

    }catch (\ Exception $exception){
      // Condition B //
        $Data                       = [
            'status'                => false,
            'message'               => $exception->getMessage(),
            'code'                  => $exception->getCode()
        ];

        return response($Data, 200)
            ->header('Content-Type', 'text/plain');
    }

Respons condition B

Screen Shot 2020-02-28 at 16 08 30

Screen Shot 2020-02-28 at 16 08 46

success_redirect_url not functioning properly

we're using "xendit-node": "^1.1.0"

and this is our code :
const resp = await i.createInvoice({
externalID: cart_uuid,
amount: parseInt(cart_total_price),
payerEmail: user_email,
successRedirectUrl: Env.get('APP_DOMAIN_URL') + '/profile',
failureRedirectUrl: Env.get('APP_DOMAIN_URL') + '/profile',
shouldSendEmail: false,
description: 'Paying package with id: ' + cart_uuid,
});

we changed it to camelCase because last time i contact the technician, he asked me try to change it from snake_case to camelCase because we're using javascript. but it's still not working

Error: Cannot find module 'xendit-node' pada Node.js 10 di Firebase Cloud Functions

Sebelumnya saya menggunakan Node.js 12 dan saya bisa menggunakan xendit-node dengan lancar.
Tapi sekarang saya harus menggunakan Node.js 10 dan xendit-node tidak bisa lagi di gunakan dengan pesan error :

2021-03-24T16:54:23.277Z ? invoice-create: Provided module can't be loaded.
2021-03-24T16:54:23.278Z ? invoice-create: Did you list all required modules in the package.json dependencies?
2021-03-24T16:54:23.278Z ? invoice-create: Detailed stack trace: Error: Cannot find module 'xendit-node'

package.json :

  {
    "dependencies": {
      "xendit-node": "^1.10.0"
    }
  }

xendit.js :

  const Xendit = require("xendit-node");
  
  const xendit = new Xendit({
    secretKey: "xnd_production_T91prSZWogti1oXvhGhHicH",
    // secretKey: 'xnd_development_EJSQs9rwP7k66WDo1Pe',
  });
  
  module.exports = xendit;

invoice.js :

const functions = require("firebase-functions");
const admin = require("firebase-admin");
const xendit = require("../config/xendit");

const {
  Invoice,
} = xendit;
const invoice = new Invoice({});

exports.create = functions.https.onCall((data, context) => {
  const timestamp = Date.now();
  const auth = context.auth.token;

  // missing check
  if (data.type == undefined) return {code: "missing-type"};
  if (data.order == undefined) return {code: "missing-order"};
  // functions.logger.log("missing check", "success");

  // typeof check
  if (typeof data.type != "string") return {code: "typeof-type"};
  if (typeof data.order != "string") return {code: "typeof-order"};
  // functions.logger.log("typeof check", "success");

  if (data.type == "order") {
    return admin.firestore().collection("order").doc(data.order).get().then((doc) => {
      if (!doc.exists) {
        return {code: "order-not-found"};
      }
      const order = doc.data();
      if (order["buyer"]["uid"] != auth.uid) {
        return {code: "user-not-buyer"};
      }
      return admin.firestore().collection("users").doc(order["buyer"]["uid"]).get().then((doc) => {
        if (!doc.exists) {
          return {code: "buyer-not-found"};
        }
        const buyer = doc.data();
        return invoice.createInvoice({
          externalID: data.order,
          amount: order["deal"]["price"],
          payerEmail: buyer["email"],
          description: "ORDER : #" + order["id"] + " : " + order["product"]["name"],
          shouldSendEmail: true,
        }).then((invoice) => {
          invoice["order"] = data.order;
          invoice["user"] = auth.uid;
          invoice["seller"] = order["seller"]["uid"];
          invoice["registered"] = timestamp;
          return admin.firestore().collection("invoices").add(invoice)
              .then((doc) => {
                return admin.firestore().collection("order").doc(data.order).update({
                  "invoice": doc.id,
                  "status": "deal",
                  "updated": timestamp,
                }).then(() => {
                  functions.logger.info("INVOICE CREATED", invoice["amount"]);
                  return {code: "success", invoice: doc.id};
                }).catch((error) => {
                  return {code: "error", error: error};
                });
              }).catch((error) => {
                return {code: "error", error: error};
              });
        }).catch((error) => {
          functions.logger.error(error);
          return {code: "error", error: error};
        });
      }).catch((error) => {
        functions.logger.error(error);
        return {code: "error", error: error};
      });
    }).catch((error) => {
      functions.logger.error(error);
      return {code: "error", error: error};
    });
  }
});

Mohon bantuannya

[Feature Request] Typescript Code Completion

In the current state of typescript support, it doesn't show any suggestion for typescript which is definitely not a huge problem but I think it would be very helpful.
image
Besides, there's no actual type besides for the xendit class and xendit opts for initialization. There no invoice type, card type, etc even though from looking at the code the types actually exist it's not detected.
In javascript the suggestion still exist of course
image

createRefund Api error not fixing

when i am getting charge with with id retrieved from createCharge endpoint it is giving me success. But when i am using same id in refundCharge it is giving me error credit card charge not found please guide me this

Issue templates

create Github issue templates for:

  • Bug Report
  • Feature Request

Header issue with node v12

FetchError: request to https://api.xendit.co/available_virtual_account_banks failed, reason: Parse Error: Invalid header value char
    at ClientRequest.<anonymous> (/Users/stanleynguyen/Documents/Projects/xendit-node/node_modules/node-fetch/lib/index.js:1455:11)
    at ClientRequest.emit (events.js:210:5)
    at TLSSocket.socketOnData (_http_client.js:463:9)
    at TLSSocket.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at TLSSocket.Readable.push (_stream_readable.js:224:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:182:23) {
  message: 'request to https://api.xendit.co/available_virtual_account_banks failed, reason: Parse Error: Invalid header value char',
  type: 'system',
  errno: 'HPE_INVALID_HEADER_TOKEN',
  code: 'HPE_INVALID_HEADER_TOKEN'
}

Error expiration date when update Virtual Account

Hi, I just face a problem when I update my virtual account for expiration date. Here's my line of code when requesting for updating my virtual account.

const resp = await va.updateFixedVA({ id: <my_id>, expectedAmt: 10000, expirationDate: "2040-12-31T17:00:00.000Z" });

But get a message "data.expirationDate.toISOString is not a function". Any help please?

CICD

Setup a pipeline using Travis/BuddyWorks/GithubActions to trigger tests and report results on PRs to get rid of test on pre-commit

CORS Policy

How to handle CORS Policy? it's asking about the header. Is there any solution?

Payout change requirement

Changelog:

  • email is required when creating payout
  • passcode is removed from response in every payout endpoint

EWallet.createPayment() vs EWallet.createEWalletCharge()

What is the difference between EWallet.createPayment() and EWallet.createEWalletCharge()?

I've try DANA with createPayment() and with createEWalletCharge() too. Both have different flow.
Using createPayment(), I can test with the "real" flow (pages in DANA for topup). But, using createEWalletCharge() the url-redirection is just a simple page with button "Proceed to pay" and when it's clicked saying something like "test is done".
Is it supposed to be different in testing?

With createPayment() I can set the callback url, but where to set the callback url when using createEWalletCharge()?

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.