Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add/Delete TPV Bank Account #239

Merged
merged 7 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ $reversal = $api->transfer->fetch($transferId)->reverse(); // Reverse a transfe
$links = $api->payment_link->all(); // fetch all payment links
$link = $api->payment_link->fetch('plink_GiwM9xbIZqbkJp'); // fetch payment link with id
$link = $api->payment_link->create(array('amount' => 98765,'description' => 'For XYZ purpose', 'customer' => array('email' => '[email protected]'))); // create payment link
$link = $api->payment_link->fetch('plink_GiwM9xbIZqbkJp')->cancel(); //cancel payment link
$link = $api->payment_link->fetch('plink_GiwM9xbIZqbkJp')->cancel(); //cancel payment link

// Invoices
$invoices = $api->invoice->all();
Expand All @@ -92,7 +92,7 @@ $invoice->delete();
// Virtual Accounts
$virtualAccount = $api->virtualAccount->create(array('receivers' => array('types'=> arra('bank_account')),'allowed_payers' => array(array('type'=>'bank_account','bank_account'=>array('ifsc'=>'RATN0VAAPIS','account_number'=>'2223330027558515'))),'description' => 'Virtual Account created for Raftar','customer_id' => 'cust_HssUOFiOd2b1TJ', 'notes' => array('project_name' => 'Banking Software'))); //Create a Virtual Account

$virtualAccount = $api->virtualAccount->fetch('va_HubTH8fZ4tnBnP')->addReceiver(array('types' => array('vpa'),'vpa' => array('descriptor'=>'gauravkumar'))); // Add Receiver to an Existing Virtual Account
$virtualAccount = $api->virtualAccount->fetch('va_HubTH8fZ4tnBnP')->addReceiver(array('types' => array('vpa'),'vpa' => array('descriptor'=>'gauravkumar'))); // Add Receiver to an Existing Virtual Account
$options = array('from'=> 1631099841,'to'=> 1631099852,'count'=> 1);
$virtualAccount = $api->virtualAccount->all($options); // Fetch All Virtual Accounts

Expand All @@ -113,7 +113,7 @@ $smartCollect = $api->payment->fetch('pay_8JpVEWsoNPKdQh')->bankTransfer(); // F

$options = array('from'=> 1631099841,'to'=> 1631099852,'count'=> 1);
$smartCollect = $virtualAccount->payments($options); // Fetch Payments made to a Virtual Account
$smartCollect = $api->virtualAccount->fetch('va_HubTH8fZ4tnBnP')->addReceiver(array('types' => array('vpa'),'vpa' => array('descriptor'=>'gauravkumar'))); // Add Receiver to an Existing Virtual Account
$smartCollect = $api->virtualAccount->fetch('va_HubTH8fZ4tnBnP')->addReceiver(array('types' => array('vpa'),'vpa' => array('descriptor'=>'gauravkumar'))); // Add Receiver to an Existing Virtual Account
$smartCollect = $virtualAccount->close(); // Close a Virtual Account

// Bharat QR
Expand All @@ -139,7 +139,7 @@ $subscription = $api->subscription->create(array('plan_id' => 'plan_7wAosPWtrkh
$subscription = $api->subscription->create(array('plan_id' => 'plan_HoYg68p5kmuvzD','total_count' => 12,'quantity' => 1,'expire_by' => 1633237807,'customer_notify' => 1, 'addons' => array(array('item'=>array('name' => 'Delivery charges','amount' => 30000,'currency' => 'INR'))),'offer_id' => 'offer_HrkIvgue2Uneqd','notes'=>array('notes_key_1'=>'Tea, Earl Grey, Hot','notes_key_2'=>'Tea, Earl Grey… decaf.'),'notify_info'=>array('notify_phone' => '9123456789','notify_email'=> '[email protected]'))); // Create a Subscription Link

$subscription = $api->subscription->fetch('sub_82uBGfpFK47AlA'); // Fetch Subscription by ID
$subscriptions = $api->subscription->all(); // Fetch All Subscriptions
$subscriptions = $api->subscription->all(); // Fetch All Subscriptions
$subscription = $api->subscription->fetch('sub_82uBGfpFK47AlA')->cancel($options); //$options = ['cancel_at_cycle_end' => 1];
$subscription = $api->subscription->fetch('sub_82uBGfpFK47AlA')->update($options); //$options = ['plan_id'=>'plan_00000000000002','offer_id'=>'offer_JHD834hjbxzhd38d','schedule_change_at'=>'cycle_end','quantity'=>5]; //Update a Subscription
$subscription = $api->subscription->fetch('sub_82uBGfpFK47AlA')->pendingUpdate(); // Fetch Details of Pending Update
Expand All @@ -148,7 +148,7 @@ $subscription = $api->subscription->fetch('sub_82uBGfpFK47AlA')->pause(['pause_
$subscription = $api->subscription->fetch('sub_82uBGfpFK47AlA')->resume(['resume_at'=>'now']); // Resume Subscription
$subscription = $api->subscription->fetch('sub_82uBGfpFK47AlA')->deleteOffer('offer_JHD834hjbxzhd38d') // Delete an Offer Linked to a Subscription
$subscription = $api->invoice->all(['subscription_id'=>'sub_HvNIkQUz9I5GBA']); // Fetch All Invoices for a Subscription
//For authentication transaction in subscription please refer this link https://razorpay.com/docs/api/subscriptions/#authentication-transaction
//For authentication transaction in subscription please refer this link https://razorpay.com/docs/api/subscriptions/#authentication-transaction

$attributes = array( 'razorpay_signature' => $razorpaySignature, 'razorpay_payment_id' => $razorpayPaymentId, 'razorpay_subscription_id' => $razorpaySubscriptionId);
$subscription = $api->utility->verifyPaymentSignature($attributes); // Payment Verification
Expand Down
8 changes: 4 additions & 4 deletions src/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,16 @@ protected function getEntity()
public function fill($data)
{
$attributes = array();


if(is_array($data))
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you format this code properly

foreach ($data as $key => $value)
{
if (is_array($value))
{
if (static::isAssocArray($value) === false)
{
$collection = array();

foreach ($value as $v)
{
if (is_array($v))
Expand All @@ -187,7 +188,6 @@ public function fill($data)
array_push($collection, $v);
}
}

$value = $collection;
}
else
Expand All @@ -198,7 +198,7 @@ public function fill($data)

$attributes[$key] = $value;
}

}
$this->attributes = $attributes;
}

Expand Down
14 changes: 14 additions & 0 deletions src/VirtualAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,18 @@ public function addReceiver($attributes = array())

return $this->request('POST', $relativeUrl, $attributes);
}

public function addAllowedPayer($attributes = array())
{
$relativeUrl = $this->getEntityUrl() . $this->id . '/allowed_payers';

return $this->request('POST', $relativeUrl, $attributes);
}

public function deleteAllowedPayer($allowedPlayerId)
{
$relativeUrl = $this->getEntityUrl() . $this->id . '/allowed_payers/'.$allowedPlayerId;

return $this->request('DELETE', $relativeUrl);
}
}