forked from LiveCarta/PayPal-PHP-SDK
Delete bank info vault samples, update index.php according and note the deprecated status of BankAccount Status (#849)
* Delete bank info vault samples, update index.php according and note the deprecated status of BankAccount Status * Change comments in bankAccount.php file * Change the comment of bankAccount file
This commit is contained in:
@@ -6,8 +6,9 @@ use PayPal\Common\PayPalModel;
|
||||
|
||||
/**
|
||||
* Class BankAccount
|
||||
*
|
||||
*
|
||||
* A resource representing a bank account that can be used to fund a payment.
|
||||
* @deprecated Deprecated. It is for internal use only. It may be removed in next major revision.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
|
||||
@@ -925,39 +925,6 @@ if (PHP_SAPI == 'cli') {
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Bank Account - Save</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="vault/CreateBankAccount.php" class="btn btn-primary pull-left execute"> Try It <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/vault/CreateBankAccount.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Bank Account - Retrieve</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="vault/GetBankAccount.php" class="btn btn-primary pull-left execute"> Try It <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/vault/GetBankAccount.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Bank Account - Delete</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="vault/DeleteBankAccount.php" class="btn btn-primary pull-left execute"> Try It <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/vault/DeleteBankAccount.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
// # Create Bank Account Sample
|
||||
// You can store credit card details securely
|
||||
// with PayPal. You can then use the returned
|
||||
// Bank Account id to process future payments.
|
||||
// API used: POST /v1/vault/bank-accounts
|
||||
|
||||
require __DIR__ . '/../bootstrap.php';
|
||||
use PayPal\Api\BankAccount;
|
||||
|
||||
// ### Bank Account
|
||||
// A resource representing a bank account that is
|
||||
// to be stored with PayPal.
|
||||
/*
|
||||
{
|
||||
"account_number": "4417119669820331",
|
||||
"account_number_type": "IBAN",
|
||||
"account_type": "SAVINGS",
|
||||
"account_name": "Ramraj",
|
||||
"check_type": "PERSONAL",
|
||||
"auth_type": "WEB",
|
||||
"bank_name": "CITI",
|
||||
"country_code": "US",
|
||||
"first_name": "Ramraj",
|
||||
"last_name": "K",
|
||||
"birth_date": "1987-08-13",
|
||||
"billing_address": {
|
||||
"line1": "52 N Main ST",
|
||||
"city": "Johnstown",
|
||||
"country_code": "US",
|
||||
"postal_code": "43210",
|
||||
"state": "OH",
|
||||
"phone": "408-334-8890"
|
||||
},
|
||||
"external_customer_id": "external_id"
|
||||
}
|
||||
*/
|
||||
$bankAccount = new BankAccount();
|
||||
$bankAccount->setAccountNumber("4417119669820331")
|
||||
->setAccountNumberType("IBAN")
|
||||
->setAccountType("SAVINGS")
|
||||
->setAccountName("Ramraj")
|
||||
->setCheckType("PERSONAL")
|
||||
->setAuthType("WEB")
|
||||
->setBankName("CITI")
|
||||
->setCountryCode("US")
|
||||
->setFirstName("Ramraj")
|
||||
->setLastName("K")
|
||||
->setBirthDate("1987-08-13")
|
||||
->setExternalCustomerId(uniqid());
|
||||
|
||||
$billingAddress = new \PayPal\Api\Address();
|
||||
$billingAddress->setLine1("52 N Main St")
|
||||
->setCity("Johnstown")
|
||||
->setState("OH")
|
||||
->setCountryCode("US")
|
||||
->setPostalCode("43210")
|
||||
->setPhone("408-334-8890");
|
||||
|
||||
$bankAccount->setBillingAddress($billingAddress);
|
||||
|
||||
// For Sample Purposes Only.
|
||||
$request = clone $bankAccount;
|
||||
|
||||
// ### Save bank account
|
||||
// Creates the bank account as a resource
|
||||
// in the PayPal vault. The response contains
|
||||
// an 'id' that you can use to refer to it
|
||||
// in future payments.
|
||||
// (See bootstrap.php for more on `ApiContext`)
|
||||
try {
|
||||
$bankAccount->create($apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Create Bank Account", "Bank Account", null, $request, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Create Bank Account", "Bank Account", $bankAccount->getId(), $request, $bankAccount);
|
||||
|
||||
return $bankAccount;
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
// # Delete Bank Account Sample
|
||||
// This sample code demonstrate how you can
|
||||
// delete a saved bank account
|
||||
// API used: /v1/vault/bank-accounts/{<bankAccountId>}
|
||||
// NOTE: HTTP method used here is DELETE
|
||||
|
||||
/** @var \PayPal\Api\BankAccount $card */
|
||||
$bankAccount = require 'CreateBankAccount.php';
|
||||
|
||||
try {
|
||||
// ### Delete Card
|
||||
// Lookup and delete a saved credit card.
|
||||
// (See bootstrap.php for more on `ApiContext`)
|
||||
$bankAccount->delete($apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Delete Bank Account", "Bank Account", null, null, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Delete Bank Account", "Bank Account", $bankAccount->getId(), null, null);
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
// # Get Bank Account Sample
|
||||
// The Bank Account resource allows you to
|
||||
// retrieve previously saved Bank Accounts.
|
||||
// API called: '/v1/vault/bank-accounts'
|
||||
|
||||
// The following code takes you through
|
||||
// the process of retrieving a saved Bank Account
|
||||
|
||||
/** @var \PayPal\Api\BankAccount $bankAccount */
|
||||
$bankAccount = require 'CreateBankAccount.php';
|
||||
|
||||
/// ### Retrieve Bank Account
|
||||
// (See bootstrap.php for more on `ApiContext`)
|
||||
try {
|
||||
$bankAccount = \PayPal\Api\BankAccount::get($bankAccount->getId(), $apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Get Bank Account", "Bank Account", $bankAccount->getId(), null, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Get Bank Account", "Bank Account", $bankAccount->getId(), null, $bankAccount);
|
||||
|
||||
return $bankAccount;
|
||||
Reference in New Issue
Block a user