Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
Merge in invoicing api support
  • Loading branch information
avidas committed Apr 29, 2014
2 parents 4193ae1 + 20ed997 commit b615960
Show file tree
Hide file tree
Showing 110 changed files with 7,839 additions and 1,641 deletions.
24 changes: 0 additions & 24 deletions CHANGELOG.md

This file was deleted.

43 changes: 21 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
REST API SDK for PHP
====================
# REST API SDK for PHP

[![Build Status](https://travis-ci.org/paypal/rest-api-sdk-php.png?branch=master)](https://travis-ci.org/paypal/rest-api-sdk-php) [![Coverage Status](https://coveralls.io/repos/paypal/rest-api-sdk-php/badge.png?branch=master)](https://coveralls.io/r/paypal/rest-api-sdk-php?branch=master) [![Latest Stable Version](https://poser.pugx.org/paypal/rest-api-sdk-php/v/stable.png)](https://packagist.org/packages/paypal/rest-api-sdk-php) [![Total Downloads](https://poser.pugx.org/paypal/rest-api-sdk-php/downloads.png)](https://packagist.org/packages/paypal/rest-api-sdk-php)

This repository contains PayPal's PHP SDK and samples for REST API.


Prerequisites
-------------
## Prerequisites

* PHP 5.3 or above
* curl, json & openssl extensions must be enabled
* composer for running the sample out of the box (See http://getcomposer.org)
* composer for fetching dependencies (See http://getcomposer.org)



Running the sample
------------------
## Running the sample

* Ensure that you have composer installed on your machine.
* Navigate to the samples folder and run 'composer update'.
* `Composer` is the recommended way to get the SDK. Ensure that you have composer installed on your machine, navigate to the samples folder and run 'composer update --no-dev' to fetch the SDK.
* In case you cannot install composer on your machine, you can also fetch the SDK bundle from https://github.com/paypal/sdk-packages/raw/gh-pages/rest-api-sdk/php/rest-api-sdk-php-0.7.1.zip and unzip the bundle in to the samples folder.
* Optionally, update the bootstrap.php file with your own client Id and client secret.
* Run any of the samples in the 'samples' folder to see what the APIs can do.


Usage
-----
## Usage

To write an app that uses the SDK

* Copy the composer.json file from the sample folder over to your project and run 'composer update' to fetch all
dependencies
* Copy the sample configuration file sdk_config.ini to a location of your choice and let the SDK know your config path using the following define directive

* Copy the composer.json file from the sample folder over to your project and run 'composer update --no-dev' to fetch all dependencies.
* Copy the sample configuration file sdk_config.ini to a location of your choice and let the SDK know your config path using the following define directive.

```php
define('PP_CONFIG_PATH', /path/to/your/sdk_config.ini);
```
Expand All @@ -40,7 +37,7 @@ dependencies

```php

$apiContext = new ApiContext(new OAuthTokenCredential('<clientId>', '<clientSecret'));
$apiContext = new ApiContext(new OAuthTokenCredential('<clientId>', '<clientSecret>'));

$payment = new Payment();

Expand All @@ -55,14 +52,16 @@ dependencies
$payment = Payment::get('payment_id', $apiContext);
```

These examples pick the SDK configuration from the sdk_config.ini file. If you do not want to use an ini file or want to pick your configuration dynamically, you can use the `$apiContext->setConfig()` method to pass in the configuration.
## SDK Configuration

The samples in this repo pick the SDK configuration from the sdk_config.ini file. If you do not want to use an ini file or want to pick your configuration dynamically, you can use the `$apiContext->setConfig()` method to pass in the configuration as a hashmap. See the `sample/bootstrap.php` file for an example.


Contributing
------------
## Contributing

More help
---------
## More help

* [API Reference](https://developer.paypal.com/webapps/developer/docs/api/)
* [Reporting issues / feature requests] (https://github.com/paypal/rest-api-sdk-php/issues)
* [Reporting issues / feature requests] (https://github.com/paypal/rest-api-sdk-php/issues)

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/paypal/rest-api-sample-app-php/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"paypal/sdk-core-php": "2.4.*"
},
"require-dev": {
"phpunit/phpunit": "3.7.*",
"satooshi/php-coveralls": "dev-master"
"phpunit/phpunit": "3.7.*"
},
"autoload": {
"psr-0": {
Expand Down
19 changes: 19 additions & 0 deletions lib/PayPal/Api/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
namespace PayPal\Api;

use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;

class Address extends PPModel {
/**
* Line 1 of the Address (eg. number, street, etc).
*
* @param string $line1
*/
public function setLine1($line1) {
Expand All @@ -15,6 +17,7 @@ public function setLine1($line1) {

/**
* Line 1 of the Address (eg. number, street, etc).
*
* @return string
*/
public function getLine1() {
Expand All @@ -24,6 +27,7 @@ public function getLine1() {

/**
* Optional line 2 of the Address (eg. suite, apt #, etc.).
*
* @param string $line2
*/
public function setLine2($line2) {
Expand All @@ -33,6 +37,7 @@ public function setLine2($line2) {

/**
* Optional line 2 of the Address (eg. suite, apt #, etc.).
*
* @return string
*/
public function getLine2() {
Expand All @@ -42,6 +47,7 @@ public function getLine2() {

/**
* City name.
*
* @param string $city
*/
public function setCity($city) {
Expand All @@ -51,6 +57,7 @@ public function setCity($city) {

/**
* City name.
*
* @return string
*/
public function getCity() {
Expand All @@ -60,6 +67,7 @@ public function getCity() {

/**
* 2 letter country code.
*
* @param string $country_code
*/
public function setCountryCode($country_code) {
Expand All @@ -69,6 +77,7 @@ public function setCountryCode($country_code) {

/**
* 2 letter country code.
*
* @return string
*/
public function getCountryCode() {
Expand All @@ -77,6 +86,7 @@ public function getCountryCode() {

/**
* 2 letter country code.
*
* @param string $country_code
* @deprecated. Instead use setCountryCode
*/
Expand All @@ -86,6 +96,7 @@ public function setCountry_code($country_code) {
}
/**
* 2 letter country code.
*
* @return string
* @deprecated. Instead use getCountryCode
*/
Expand All @@ -95,6 +106,7 @@ public function getCountry_code() {

/**
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
*
* @param string $postal_code
*/
public function setPostalCode($postal_code) {
Expand All @@ -104,6 +116,7 @@ public function setPostalCode($postal_code) {

/**
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
*
* @return string
*/
public function getPostalCode() {
Expand All @@ -112,6 +125,7 @@ public function getPostalCode() {

/**
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
*
* @param string $postal_code
* @deprecated. Instead use setPostalCode
*/
Expand All @@ -121,6 +135,7 @@ public function setPostal_code($postal_code) {
}
/**
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
*
* @return string
* @deprecated. Instead use getPostalCode
*/
Expand All @@ -130,6 +145,7 @@ public function getPostal_code() {

/**
* 2 letter code for US states, and the equivalent for other countries.
*
* @param string $state
*/
public function setState($state) {
Expand All @@ -139,6 +155,7 @@ public function setState($state) {

/**
* 2 letter code for US states, and the equivalent for other countries.
*
* @return string
*/
public function getState() {
Expand All @@ -148,6 +165,7 @@ public function getState() {

/**
* Phone number in E.123 format.
*
* @param string $phone
*/
public function setPhone($phone) {
Expand All @@ -157,6 +175,7 @@ public function setPhone($phone) {

/**
* Phone number in E.123 format.
*
* @return string
*/
public function getPhone() {
Expand Down
7 changes: 7 additions & 0 deletions lib/PayPal/Api/Amount.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
namespace PayPal\Api;

use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;

class Amount extends PPModel {
/**
* 3 letter currency code
*
* @param string $currency
*/
public function setCurrency($currency) {
Expand All @@ -15,6 +17,7 @@ public function setCurrency($currency) {

/**
* 3 letter currency code
*
* @return string
*/
public function getCurrency() {
Expand All @@ -24,6 +27,7 @@ public function getCurrency() {

/**
* Total amount charged from the Payer account (or card) to Payee. In case of a refund, this is the refunded amount to the original Payer from Payee account.
*
* @param string $total
*/
public function setTotal($total) {
Expand All @@ -33,6 +37,7 @@ public function setTotal($total) {

/**
* Total amount charged from the Payer account (or card) to Payee. In case of a refund, this is the refunded amount to the original Payer from Payee account.
*
* @return string
*/
public function getTotal() {
Expand All @@ -42,6 +47,7 @@ public function getTotal() {

/**
* Additional details of the payment amount.
*
* @param PayPal\Api\Details $details
*/
public function setDetails($details) {
Expand All @@ -51,6 +57,7 @@ public function setDetails($details) {

/**
* Additional details of the payment amount.
*
* @return PayPal\Api\Details
*/
public function getDetails() {
Expand Down
Loading

0 comments on commit b615960

Please sign in to comment.