npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@angular_faruk/paypal

v9.1.8

Published

this is new package with api

Downloads

82

Readme

Paypal

This library was generated with Angular CLI version 17.2.0.

Code scaffolding

Run ng generate component component-name --project paypal to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project paypal.

Note: Don't forget to add --project paypal or else it will be added to the default project in your angular.json file.

Build

Run ng build paypal to build the project. The build artifacts will be stored in the dist/ directory.

PayPal Developer link

Integrating PaypalModule into AppModule

To use the PaypalModule in your Angular application, follow these steps:

  1. Import PaypalModule into AppModule:

    import { NgModule } from '@angular/core';
    import { AppComponent } from './app.component';
    import { PaypalModule } from '@angular_faruk/paypal';
    import { IS_TESTING_MODE } from '@angular_faruk/paypal';
    import { PaypalComponent }  from '@angular_faruk/paypal';
    @NgModule({
      declarations: [
        AppComponent
      ],
      imports: [
        PaypalModule
      ],
      bootstrap: [AppComponent],
      providers: [PaypalComponent,
       { provide: IS_TESTING_MODE, useValue: true } 
    
          
       <!--useValue: true  FOR testing  -->      
       <!--useValue: false  FOR live  -->
    
          
     ]
    })
    export class AppModule {}
    
    
    

Configuration

  • Option 2: You can import in any componet.

    Example:

      import { IS_TESTING_MODE, PaypalComponent } from '@angular_faruk/paypal';
      import{PaypalService}from '@angular_faruk/paypal'
       import { Component, Inject } from '@angular/core';
    
    @Component({
      selector: 'app-demo',
      templateUrl: './demo.component.html',
      styleUrls: ['./demo.component.css']
    })
    export class LandingPageCoffeeComponent { 
      
       constructor( private PaypalComponent:PaypalComponent ,
        private paypalService: PaypalService,@Inject(IS_TESTING_MODE) 
        private isTestingMode: boolean ) {}
    
    
    }
    
    
    
    

example



    this.PaypalComponent.Access_token(ClientID, Secret_id).then((response) => {
      console.log('Response:', response);
    // Handle successful response here

    }).catch((error) => {
      console.error('Error:', error);
       // You can display a notification to the
        // user or perform any other error handling logic here 
    });
  


//  START*********create_order payload for single  items

 let OrderformData:any= {
  name: string;
  description: string;
  quantity: number;
  currency_code: string; //USD
  value: number;
  return_url: string; // Replace with your success page URL
  cancel_url: string; // Replace with your cancel page URL
}
// =============================== CAPTURE==================
let intent: string = 'CAPTURE';// The merchant intends to 
// capture payment immediately after 
// the customer makes a payment.
 //========================CAPTURE ==========

// ============ AUTHORIZE BOX READ ==
let intent: string = 'AUTHORIZE';
// The merchant intends to authorize a
//  payment and place funds on hold after 
//  the customer makes a payment. 
//  Authorized payments are best captured
//  within three days of authorization but are
//  available to capture for up to 29 days.
//   After the three-day honor period, 
//   the original authorized payment expires and
//  you must re-authorize the payment.
//  You must make a separate request
//   to capture payments on demand.
//  This intent is not supported 
//  when you have more than
//   one purchase_unit within your order.
// ======================== AUTHORIZE BOX READ =============

//  End**************************






// START ######create_order payload for multiple items

 let OrderformData:any= {
  name: string;
  description: string;
  quantity: number;
  currency_code: string; //USD
  value: number;
  return_url: string;// Replace with your success page URL
  cancel_url: string; // Replace with your cancel page URL
  items: Array<{
    name: string;
    description: string;
    quantity: number;
    unit_amount: {
      currency_code: string;
      value: number;
    };
  }>;
}
// =============================== CAPTURE==================================
let intent: string = 'CAPTURE'; // The merchant intends to capture payment 
      // immediately after the customer makes a payment.
 //=================================CAPTURE =====================================

// ===================================== AUTHORIZE BOX READ =============
let intent: string = 'AUTHORIZE';
// The merchant intends to authorize a payment 
// and place funds on hold after the customer makes a payment. Authorized
  //  payments are best captured within three days of authorization
  //  but are available to capture for up to 29 days.
  //  After the three-day honor period, 
  //  the original authorized payment expires and
  //  you must re-authorize the payment.
  //  You must make a separate request to capture payments on demand.
  // This intent is not supported when
  // you have more than one purchase_unit within your order.
// ===================================== AUTHORIZE BOX READ =============

// End ############################################





// start==========================You can hit  within this function ============ 
    this.PaypalComponent.create_order(OrderformData: Orderinterface,intent:string).then((response) => {
      //  this.order = response.orderss.id
      // localStorage.setItem("order", this.order)
      //  You can use localStorage

      // Handle successful response here
    }).catch((error) => {
        // You can display a notification to the 
        // user or perform any other error handling logic here
    });
  




  // start==========================You can hit  within this function ============ 

    this.PaypalComponent.order_details(order_id:string).then((response) => {
            // Handle successful response here     
    }).catch((error) => {
       // You can display a notification 
      //  to the user or perform any other error handling logic here
    });
  // END======================



   // start===============You can hit  within this function ============ 
 
    this.PaypalComponent.Authorize_payment(order_id).then((response) => {    
              // Handle successful response here  
    }).catch((error) => {
    // You can display a notification to the user or
    //  perform any other error handling logic here
    });
   // END======================

  
   // start===============You can hit  within this function ============ 

    this.PaypalComponent.Show_details_authorized_payments(authorization_id:string).then((response) => {
               // Handle successful response here   
    }).catch((error) => {
           // You can display a notification to the 
          //  user or perform any other error handling logic here
    });
  
    // END======================


   // start===============You can hit  within this function ============

    this.PaypalComponent.Reauthorize_authorized_payment(authorization_id).then((response) => {
        // Handle successful response here   
    }).catch((error) => {
        // You can display a notification to the 
        // user or perform any other error handling logic here
    });
  

    // END======================




   // start===============You can hit  within this function ============

    // Voids, or cancels, an authorized payment, by ID. 
    // You cannot void an authorized payment 
    // that has been fully captured.

    this.PaypalComponent.Void_authorized_payment(authorization_id: string).then((response) => {
      // Handle successful response here   
    }).catch((error) => {
        // You can display a notification to 
        // the user or perform any other error handling logic here
    });
  
   // END======================



   // start===============You can hit  within this function ============ 
  
    let Capturedata = {
      amount: {
        currency_code: 'USD',
        value: 2
      },
      final_capture: true
    };

  



    this.PaypalComponent.Capture_authorized_payment(authorization_id: string,Capturedata:CapturePayload).then((response) => {
        // Handle successful response here   

    }).catch((error) => {
         // You can display a notification to 
        //  the user or perform any other error handling logic here
    });  
  // END======================
    


   // start===============You can hit  within this function ============ 

    this.PaypalComponent.Show_captured_payment_details(capture_ids:string).then((response) => {
   // Handle successful response here  
    }).catch((error) => {
          // You can display a notification to
          //  the user or perform any other error handling logic here
    });
    // END======================




   // start===============You can hit  within this function ============ 
let Refund_captured = {
 amount: {
      value: number;
      currency_code: string;
  };
  note_to_payer: String;
}



    this.PaypalComponent.Refund_captured_payment(capture_id: string Refund_captured:Refund_captured_payments).then((response) => {
   // Handle successful response here  
    }).catch((error) => {
        // You can display a notification to 
        // the user or perform any other error handling logic here
    });
      // END======================



   // start=======You can hit  within this function ============ 

    this.PaypalComponent.Show_refund_details(capture_id).then((response) => {
 // Handle successful response here  
    }).catch((error) => {
   // You can display a notification to the user or 
  //  perform any other error handling logic here
    });
  
    // END======================

Example


Running unit tests

Run ng test paypal to execute the unit tests via Karma.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.