Файловый менеджер - Редактировать - /home/easybachat/hisabat365.com/4a7891/razorpay.zip
Ðазад
PK �S*[��� razorpay/tests/PlanTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class PlanTest extends TestCase { /** * Specify unique plan id * for example plan_IEeswu4zFBRGwi */ private $planId = "plan_IEeswu4zFBRGwi"; public function setUp(): void { parent::setUp(); } /** * Create Plan */ public function testCreatePlan() { $data = $this->api->plan->create(array('period' => 'weekly', 'interval' => 1, 'item' => array('name' => 'Test Weekly 1 plan', 'description' => 'Description for the weekly 1 plan', 'amount' => 600, 'currency' => 'INR'),'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('plan',$data->toArray())); } /** * Fetch all plans * @covers \Razorpay\Api\Collection::count */ public function testFetchAllPlans() { $data = $this->api->plan->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue($data->count() >= 0); $this->assertTrue(is_array($data['items'])); } /** * Fetch particular plan */ public function testFetchPlan() { $data = $this->api->plan->fetch($this->planId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('plan',$data->toArray())); } }PK �S*[�~�l razorpay/tests/QrCodeTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class QrCodeTest extends TestCase { /** * Specify unique qrcode id & customer id * for example qr_IEjmDxjAY3iCnw & cust_IEfAt3ruD4OEzo */ private $qrCodeId = "qr_IEjmDxjAY3iCnw"; private $customerId = "cust_IEfAt3ruD4OEzo"; public function setUp(): void { parent::setUp(); } /** * Create Qr code */ public function testCreateQrCode() { $data = $this->api->qrCode->create(array("type" => "upi_qr","name" => "Store_1", "usage" => "single_use","fixed_amount" => 1,"payment_amount" => 300,"customer_id" => $this->customerId, "description" => "For Store 1","close_by" => strtotime('+3 minutes', time()),"notes" => array("purpose" => "Test UPI QR code notes"))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('qr_code',$data->toArray())); } /** * Fetch all Qr code */ public function testFetchAllQrCode() { $data = $this->api->plan->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch a Qr code */ public function testFetchQrCode() { $data = $this->api->qrCode->fetch($this->qrCodeId); $this->assertTrue(is_array($data->toArray())); } /** * Fetch a Qr code for customer id */ public function testFetchQrCodeByCustomerId() { $data = $this->api->qrCode->all(["customer_id" => $this->customerId ]); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch a Qr code for payment id */ public function testFetchQrCodePaymentById() { $data = $this->api->qrCode->all(); $this->assertTrue(is_array($data->toArray())); } /** * Close a QR Code */ public function testCloseQrCode() { $qrCodeId = $this->api->qrCode->create(array("type" => "upi_qr","name" => "Store_1", "usage" => "single_use","fixed_amount" => 1,"payment_amount" => 300,"customer_id" => $this->customerId, "description" => "For Store 1","close_by" => strtotime('+3 minutes', time()), "notes" => array("purpose" => "Test UPI QR code notes"))); $data = $this->api->qrCode->fetch($qrCodeId->id)->close(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('qr_code',$data->toArray())); } }PK �S*[��4* * razorpay/tests/TokenTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class TokenTest extends TestCase { /** * Specify unique payment id, token id & customer id * for example pay_IEczPDny6uzSnx, cust_IEcn7UdBOFmaNi & * token_IEcux6sQtS8eLx */ private $paymentId = "pay_IEczPDny6uzSnx"; private $customerId = "cust_IEcn7UdBOFmaNi"; private $tokenId = "token_IEcux6sQtS8eLx"; protected static $partnerTokenId ; public function setUp(): void { parent::setUp(); } /** * Create registration link */ public function testCreateRegistrationLink() { $data = $this->api->subscription->createSubscriptionRegistration(array('customer' => array('name' => 'Gaurav Kumar','email' => 'gaurav.kumar@example.com','contact' => '9123456780'),'amount' => 0,'currency' => 'INR','type' => 'link','description' => '12 p.m. Meals','subscription_registration' => array('method' => 'nach','auth_type' => 'physical','bank_account' => array('beneficiary_name' => 'Gaurav Kumar','account_number' => '11214311215411','account_type' => 'savings','ifsc_code' => 'HDFC0001233'),'nach' => array('form_reference1' => 'Recurring Payment for Gaurav Kumar','form_reference2' => 'Method Paper NACH'),'expire_at' => strtotime('+1 day'),'max_amount' => 50000),'receipt' => 'Receipt No. '.time(),'sms_notify' => 1,'email_notify' => 1,'expire_by' => strtotime('+1 day'),'notes' => array('note_key 1' => 'Beam me up Scotty','note_key 2' => 'Tea. Earl Gray. Hot.'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Fetch token by payment id */ public function testFetchTokenByPaymentId() { $data = $this->api->payment->fetch($this->paymentId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('payment',$data->toArray())); } /** * Fetch particular token */ public function testFetchTokenByCustomerId() { $data = $this->api->customer->fetch($this->customerId)->tokens()->fetch($this->tokenId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('payment',$data->toArray())); } public function testCreateToken() { $data = $this->api->token->create($this->requestAttribute($this->customerId)); self::$partnerTokenId = $data['id']; $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('card',$data->toArray())); } public function testFetchToken() { $data = $this->api->token->fetchCardPropertiesByToken(['id'=>self::$partnerTokenId]); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('card',$data->toArray())); } public function testProcessPaymentOnAlternatePAorPG() { $data = $this->api->token->processPaymentOnAlternatePAorPG(['id'=>self::$partnerTokenId]); $this->assertTrue(is_array($data->toArray())); } public function testDeleteToken() { $data = $this->api->token->deleteToken(['id'=>self::$partnerTokenId]); $this->assertTrue(is_array($data->toArray())); } public function requestAttribute($customerId){ return [ "customer_id" => $customerId, "method" => "card", "card" => [ "number" => "4854980604708430", "cvv" => "123", "expiry_month" => "12", "expiry_year" => "24", "name" => "Gaurav Kumar", ], "authentication" => [ "provider" => "razorpay", "provider_reference_id" => "pay_123wkejnsakd" ], "notes" => [], ]; } }PK �S*[��� � razorpay/tests/CardTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class CardTest extends TestCase { /** * Specify unique card id */ private $cardId = "card_LcQgzpfvWP0UKF"; public function setUp(): void { parent::setUp(); } /** * Fetch Card details */ public function testFetchCard() { $data = $this->api->card->fetch($this->cardId); $this->assertTrue(in_array($this->cardId, $data->toArray())); } }PK �S*[���4� � razorpay/tests/PaymentTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; use Razorpay\Api\Api; class PaymentTest extends TestCase { /** * Specify unique order id & payment id d * for example order_IEcrUMyevZFuCS & pay_IEczPDny6uzSnx */ private $orderId = "order_IEcrUMyevZFuCS"; private $paymentId = "pay_IEczPDny6uzSnx"; private $OtpPaymentId = ""; public function setUp(): void { parent::setUp(); } /** * Fetch all payment */ public function testFetchAllPayment() { $data = $this->api->payment->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch a payment */ public function testFetchPayment() { $payment = $this->api->payment->all(); if($payment['count'] !== 0){ $data = $this->api->payment->fetch($payment['items'][0]['id']); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('payment',$data->toArray())); } } /** * Fetch a payment */ public function testFetchOrderPayment() { $data = $this->api->order->fetch($this->orderId)->payments(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Update a payment */ public function testUpdatePayment() { $data = $this->api->payment->fetch($this->paymentId)->edit(array('notes'=> array('key_1'=> 'value1','key_2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('payment',$data->toArray())); } /** * Fetch card details with paymentId */ public function testFetchCardWithPaymentId() { $data = $this->api->payment->fetch($this->paymentId)->fetchCardDetails(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('card',$data->toArray())); } /** * Fetch Payment Downtime Details */ public function testfetchPaymentDowntime() { $data = $this->api->payment->fetchPaymentDowntime(); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey('count',$data->toArray()); } /** * Fetch Payment Downtime Details */ public function testfetchPaymentDowntimeById() { $downtime = $this->api->payment->fetchPaymentDowntime(); if(count($downtime['items'])>0){ $data = $this->api->payment->fetchPaymentDowntimeById($downtime['items'][0]['id']); $this->assertTrue(is_array($data->toArray())); }else{ $this->assertArrayHasKey('count',$downtime->toArray()); } } /** * Otp Generate */ public function testOtpGenerate() { $api = new Api("key", ""); $data = $api->payment->otpGenerate($OtpPaymentId); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey('razorpay_payment_id',$data->toArray()); } /** * Otp Submit */ public function testOtpSubmit() { $data = $this->api->payment->fetch($paymentId)->otpSubmit(array('otp'=> '12345')); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey('razorpay_payment_id',$data->toArray()); } /** * Otp Resend */ public function testOtpResend() { $data = $this->api->payment->fetch($paymentId)->otpResend(); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey('razorpay_payment_id',$data->toArray()); } }PK �S*[� V� � razorpay/tests/CustomerTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class CustomerTest extends TestCase { /** * Specify unique customer id * for example cust_IEfAt3ruD4OEzo */ private $customerId = "cust_IEfAt3ruD4OEzo"; static private $baId; public function setUp(): void { parent::setUp(); } /** * Create customer */ public function testCreateCustomer() { $data = $this->api->customer->create(array('name' => 'Razorpay User 38', 'email' => 'customer38@razorpay.com' ,'fail_existing'=>'0')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer',$data->toArray())); } /** * Edit customer */ public function testEditCustomer() { $data = $this->api->customer->fetch($this->customerId)->edit(array('name' => 'Razorpay User 21' ,'contact'=>'9123456780')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array($this->customerId, $data->toArray())); } /** * Fetch customer All */ public function testFetchAll() { $data = $this->api->customer->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_numeric($data->count())); $this->assertTrue(is_array($data['items'])); } /** * Fetch a customer */ public function testFetchCustomer() { $data = $this->api->customer->fetch($this->customerId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array($this->customerId, $data->toArray())); } /** * Add Bank account */ public function testBankAccount() { $data = $this->api->customer->fetch($this->customerId)->addBankAccount([ "ifsc_code" => "UTIB0000194", "account_number" => "919999999999", "beneficiary_name" => "Pratheek", "beneficiary_address1" => "address 1", "beneficiary_address2" => "address 2", "beneficiary_address3" => "address 3", "beneficiary_address4" => "address 4", "beneficiary_email" => "random@email.com", "beneficiary_mobile" => "8762489310", "beneficiary_city" => "Bangalore", "beneficiary_state" => "KA", "beneficiary_country" => "IN", ]); CustomerTest::$baId = $data->id; $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array("bank_account", $data->toArray())); } public function testDeleteBankAccount(){ if(CustomerTest::$baId) { $data = $this->api->customer->fetch($this->customerId)->deleteBankAccount(CustomerTest::$baId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array("bank_account", $data->toArray())); } } }PK �S*[g�߈� � , razorpay/tests/SignatureVerificationTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class SignatureVerificationTest extends TestCase { private static $subscriptionId; public function setUp(): void { parent::setUp(); } /** * Verify Payment verification */ public function testPaymentVerification() { $orderId = 'order_IEIaMR65cu6nz3'; $paymentId = 'pay_IH4NVgf4Dreq1l'; $signature = '97f18ee6577a33ca7c37b949912de807b379afb3f39ccb571ffd76017463f8e5'; $this->assertNull($this->api->utility->verifyPaymentSignature(array( 'razorpay_order_id' => $orderId, 'razorpay_payment_id' => $paymentId, 'razorpay_signature' => $signature ))); } /** * Verify PaymentLink verification */ public function testPaymentLinkVerification() { $paymentLinkId = 'plink_IH3cNucfVEgV68'; $paymentId = 'pay_IH3d0ara9bSsjQ'; $paymentLinkReferenceId = 'TSsd1989'; $paymentLinkStatus = 'paid'; $signature = '57bab821bfe7ebcf41b32e362d16aa23d408b76c36317f960ae99a9301e4d364'; $this->assertNull($this->api->utility->verifyPaymentSignature(array( 'razorpay_payment_link_id' => $paymentLinkId, 'razorpay_payment_link_reference_id' => $paymentLinkReferenceId, 'razorpay_payment_link_status' => $paymentLinkStatus, 'razorpay_payment_id' => $paymentId, 'razorpay_signature' => $signature ))); } /** * Verify Subscription verification */ public function testSubscriptionVerification() { $subscriptionId = 'sub_ID6MOhgkcoHj9I'; $paymentId = 'pay_IDZNwZZFtnjyym'; $signature = 'cbbaabf163d61fc9346b794b5f906bc2f6b0d944be71bc0e6b5c35fa21eade44'; $this->assertNull($this->api->utility->verifyPaymentSignature(array( 'razorpay_subscription_id' => $subscriptionId, 'razorpay_payment_id' => $paymentId, 'razorpay_signature' => $signature ))); } }PK �S*[�$agp p razorpay/tests/InvoiceTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class InvoiceTest extends TestCase { /** * Specify unique invoice id & customer id * for example inv_IF37M4q6SdOpjT & cust_IEfAt3ruD4OEzo */ private $invoiceId = "inv_IH69XFNA9IMQ7k"; private $invoiceIdNotify = "inv_JM5rC3ddYKVWgy"; private $customerId = "cust_IEfAt3ruD4OEzo"; public function setUp(): void { parent::setUp(); } /** * Create Invoice */ public function testCreateInvoice() { $data = $this->api->invoice->create(array ('type' => 'invoice', 'date' => time(), 'customer_id'=> $this->customerId, 'line_items'=>array(array("name"=> "Master Cloud Computing in 30 Days", "amount"=>10000, "currency" => "INR", "quantity"=> 1)))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } /** * Fetch all invoices */ public function testFetchAllInvoice() { $data = $this->api->invoice->fetch($this->invoiceId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } /** * Update invoice */ public function testUpdateInvoice() { $data = $this->api->invoice->fetch($this->invoiceId)->edit(array('notes' => array('updated-key' => 'An updated note.'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } /** * Send notification */ public function testSendNotification() { $data = $this->api->invoice->fetch($this->invoiceId)->notifyBy('sms'); $this->assertTrue(is_array($data)); } /** * Issue an invoice */ public function testInvoiceIssue() { $invoice = $this->api->invoice->create(array ('type' => 'invoice', 'draft'=> true , 'date' => time(), 'customer_id'=> $this->customerId, 'line_items'=>array(array("name"=> "Master Cloud Computing in 30 Days", "amount"=>10000, "currency" => "INR", "quantity"=> 1)))); $data = $this->api->invoice->fetch($invoice->id)->issue(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } /** * Delete an invoice */ public function testDeleteInvoice() { $invoice = $this->api->invoice->create(array ('type' => 'invoice', 'draft'=> true , 'date' => time(), 'customer_id'=> $this->customerId, 'line_items'=>array(array("name"=> "Master Cloud Computing in 30 Days", "amount"=>10000, "currency" => "INR", "quantity"=> 1)))); $data = $this->api->invoice->fetch($invoice->id)->delete(); $this->assertTrue(is_array($data)); } /** * Cancel an invoice */ public function testCancelInvoice() { $invoice = $this->api->invoice->create(array ('type' => 'invoice', 'draft'=> true , 'date' => time(), 'customer_id'=> $this->customerId, 'line_items'=>array(array("name"=> "Master Cloud Computing in 30 Days", "amount"=>10000, "currency" => "INR", "quantity"=> 1)))); $data = $this->api->invoice->fetch($invoice->id)->cancel(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } }PK �S*[���v� � razorpay/tests/UpiTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class UpiTest extends TestCase { /** * Specify unique customer id, invoice id & order id * for example cust_IEfAt3ruD4OEzo, inv_IEfS5mBV49bIQY & * order_IEgBdwYACpMLxd */ private $customerId = "cust_IEfAt3ruD4OEzo"; private $invoiceId = "inv_IEfS5mBV49bIQY"; private $orderId = "order_IEgBdwYACpMLxd"; public function setUp(): void { parent::setUp(); } /** * Create customer */ public function testCreateCustomer() { $data = $this->api->customer->create(array('name' => 'Razorpay User 21', 'email' => 'customer21@razorpay.com','fail_existing'=>'0')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer',$data->toArray())); } /** * Create Order */ public function testCreateOrder() { $data = $this->api->order->create(array('receipt' => '123', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey('id',$data->toArray()); } /** * Send/Resend notifications */ public function testSendNotification() { $data = $this->api->invoice->fetch($this->invoiceId)->notifyBy('email'); $this->assertTrue(in_array('success',$data)); } /** * Create registration link */ public function testCreateSubscriptionRegistration() { $data = $this->api->subscription->createSubscriptionRegistration(array('customer' => array('name' => 'Gaurav Kumar','email' => 'gaurav.kumar@example.com','contact' => '9123456780'),'amount' => 0,'currency' => 'INR','type' => 'link','description' => '12 p.m. Meals','subscription_registration' => array('method' => 'nach','auth_type' => 'physical','bank_account' => array('beneficiary_name' => 'Gaurav Kumar','account_number' => '11214311215411','account_type' => 'savings','ifsc_code' => 'HDFC0001233'),'nach' => array('form_reference1' => 'Recurring Payment for Gaurav Kumar','form_reference2' => 'Method Paper NACH'),'expire_at' => 1636772800,'max_amount' => 50000),'receipt' => 'Receipt No. '.time(),'sms_notify' => 1,'email_notify' => 1,'expire_by' => 1636772800,'notes' => array('note_key 1' => 'Beam me up Scotty','note_key 2' => 'Tea. Earl Gray. Hot.'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Cancel a registration link */ public function testCancelRegistrationLink() { $data = $this->api->subscription->createSubscriptionRegistration(array('customer' => array('name' => 'Gaurav Kumar','email' => 'gaurav.kumar@example.com','contact' => '9123456780'),'amount' => 0,'currency' => 'INR','type' => 'link','description' => '12 p.m. Meals','subscription_registration' => array('method' => 'nach','auth_type' => 'physical','bank_account' => array('beneficiary_name' => 'Gaurav Kumar','account_number' => '11214311215411','account_type' => 'savings','ifsc_code' => 'HDFC0001233'),'nach' => array('form_reference1' => 'Recurring Payment for Gaurav Kumar','form_reference2' => 'Method Paper NACH'),'expire_at' => 1636772800,'max_amount' => 50000),'receipt' => 'Receipt No. '.time(),'sms_notify' => 1,'email_notify' => 1,'expire_by' => 1636772800,'notes' => array('note_key 1' => 'Beam me up Scotty','note_key 2' => 'Tea. Earl Gray. Hot.'))); $data = $this->api->invoice->fetch($data->id)->cancel(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } /** * Fetch Payment ID using Order ID */ public function testFetchPaymentByorderId() { $data = $this->api->order->fetch($this->orderId)->payments(); $this->assertTrue(is_array($data->toArray())); } /** * Fetch tokens by customer id */ public function testFetchTokenByCustomerId() { $data = $this->api->customer->fetch($this->customerId)->tokens()->all(); $this->assertTrue(is_array($data->toArray())); } /** * Fetch token by payment ID */ public function testFetchTokenByPaymentId() { $payment = $this->api->payment->all(); if(!empty($payment)){ $data = $this->api->payment->fetch($payment['items'][0]['id']); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey('id',$data->toArray()); } } /** * Create an order to charge the customer */ public function testCreateOrderCharge() { $data = $this->api->order->create(array('receipt' => '122', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey('id',$data->toArray()); } }PK �S*[�*�I razorpay/tests/TransferTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class TransferTest extends TestCase { /** * Specify unique transfer id, account id & payment id * for example trf_IEn4KYFgfD7q3F, acc_HjVXbtpSCIxENR & * pay_I7watngocuEY4P */ private $transferId = "trf_JtBI1uAaDdKkpJ"; private $accountId = "acc_HjVXbtpSCIxENR"; private $paymentId = "pay_LdarHRbodWJeXO"; public function setUp(): void { parent::setUp(); } /** * Direct transfers */ public function testDirectTransfer() { $data = $this->api->transfer->create(array('account' => $this->accountId, 'amount' => 500, 'currency' => 'INR')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('collection',$data->toArray())); } /** * Create transfers from payment */ public function testCreateTransferPayment() { $data = $this->api->payment->fetch($this->paymentId)->transfer(array('transfers' => array(array('account'=> $this->accountId, 'amount'=> '100', 'currency'=>'INR', 'notes'=> array('name'=>'Gaurav Kumar', 'roll_no'=>'IEC2011025'), 'linked_account_notes'=>array('branch'), 'on_hold'=>'1', 'on_hold_until'=>'1671222870')))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('collection',$data->toArray())); } /** * Create transfers from order */ public function testCreateTransferOrder() { $data = $this->api->order->create(array('amount' => 100,'currency' => 'INR','transfers' => array(array('account' =>$this->accountId,'amount' => 100,'currency' => 'INR','notes' => array('branch' => 'Acme Corp Bangalore North','name' => 'Gaurav Kumar'),'linked_account_notes' => array('branch'),'on_hold' => 1,'on_hold_until' => 1671222870)))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('transfer',$data->toArray())); } /** * Fetch transfer for a payment */ public function testFetchTransferPayment() { $data = $this->api->payment->fetch($this->paymentId)->transfers(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('collection',$data->toArray())); } /** * Fetch transfer for an order */ public function testFetchTransferOrder() { $order = $this->api->order->all(); if($order['count'] !== 0){ $data = $this->api->order->fetch($order['items'][0]['id'])->transfers(array('expand[]'=>'transfers')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('order',$data->toArray())); } } /** * Fetch transfer */ public function testFetchTransfer() { $data = $this->api->transfer->fetch($this->transferId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('order',$data->toArray())); } /** * Fetch transfers for a settlement */ public function testFetchSettlement() { $settlement = $this->api->transfer->all(array('expand[]'=> 'recipient_settlement')); if($settlement['count'] !== 0){ $data = $this->api->transfer->all(array('recipient_settlement_id'=> $settlement['items'][0]['recipient_settlement_id'])); $this->assertTrue(is_array($data->toArray())); } } /** * Fetch settlement details */ public function testFetchSettlementDetails() { $data = $this->api->transfer->all(array('expand[]'=> 'recipient_settlement')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('collection',$data->toArray())); } /** * Refund payments and reverse transfer from a linked account */ public function testRefundPayment() { $data = $this->api->payment->fetch($this->paymentId)->refund(array('amount'=> '100')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('refund',$data->toArray())); } /** * Fetch payments of a linked account */ public function testFetchPaymentsLinkedAccounts() { $data = $this->api->payment->fetch($this->paymentId)->refund(array('amount'=> '100')); $this->assertTrue(is_array($data->toArray())); } /** * Reverse transfers from all linked accounts */ public function testReverseLinkedAccount() { $transfer = $this->api->transfer->create(array('account' => $this->accountId, 'amount' => 100, 'currency' => 'INR')); $data = $this->api->transfer->fetch($transfer->id)->reverse(array('amount'=>100)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('refund',$data->toArray())); } /** * Hold settlements for transfers */ public function testHoldSettlements() { $data = $this->api->payment->fetch($this->paymentId)->transfer(array('transfers' => array(array('account' => $this->accountId, 'amount' => '100', 'currency' => 'INR', 'on_hold'=>'1')))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('collection',$data->toArray())); } /** * Modify settlement hold for transfers */ public function testModifySettlements() { $data = $this->api->transfer->fetch($this->transferId)->edit(array('on_hold'=>1)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('transfer',$data->toArray())); } }PK �S*[(xnt� � razorpay/tests/OrdersTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class OrdersTest extends TestCase { /** * Specify unique order id * for example order_IEfF1OrQbqxYJq */ private $orderId = "order_IEfF1OrQbqxYJq"; public function setUp(): void { parent::setUp(); } /** * Create order */ public function testCreateOrder() { $data = $this->api->order->create(array('receipt' => '123', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey('id',$data->toArray()); } /** * Fetch all orders */ public function testAllOrders() { $data = $this->api->order->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch particular order */ public function testFetchOrder() { $data = $this->api->order->fetch($this->orderId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('order',$data->toArray())); } /** * Fetch payments for an order */ public function testOrderFetchById() { $data = $this->api->order->fetch($this->orderId)->payments(); $this->assertTrue(is_array($data->toArray())); } /** * Update Order */ public function testUpdateOrder() { $data = $this->api->order->fetch($this->orderId)->edit(array('notes'=> array('notes_key_1'=>'Beam me up Scotty. 1', 'notes_key_2'=>'Engage'))); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey('id',$data->toArray()); } }PK �S*[ � � ) ) razorpay/tests/PartnerTest.phpnu �[��� <?php namespace Razorpay\Tests; require_once realpath(__DIR__ . "/../vendor/autoload.php"); use Razorpay\Api\Api; use Dotenv\Dotenv; if (class_exists('Dotenv')) { $dotenv = Dotenv::createImmutable(__DIR__); $dotenv->load(); } class PartnerTest extends TestCase { protected $instance; protected static $account_id; protected static $stakeholder_id; protected static $product_id; protected static $webhook_id; protected $accId = "acc_M83Uw27KXuC7c8"; protected $stkId = "sth_M83WuwmrCFa55g"; protected $docId = "doc_NBpjajKtxrMDg7"; public function setUp(): void { $apiKey = getenv("RAZORPAY_API_KEY") ? getenv("RAZORPAY_PARTNER_API_KEY") : ""; $apiSecret = getenv("RAZORPAY_API_SECRET") ? getenv("RAZORPAY_PARTNER_API_SECRET") : ""; $this->instance = new Api( $apiKey, $apiSecret); } public function testCreateAccount() { $account = $this->instance->account->create($this->accountAttributes()); self::$account_id = $account['id']; $this->assertTrue(is_array($account->toArray())); $this->assertTrue(is_array((array) $account['legal_info'])); } public function testCreateStakerholder() { $stakeholder = $this->instance->account->fetch(self::$account_id)->stakeholders()->create($this->stakeholderAttributes()); $this->assertTrue(is_array($stakeholder->toArray())); self::$stakeholder_id = $stakeholder['id']; $this->assertTrue(is_array((array) $stakeholder['phone'])); } public function testFetchStakerholder() { $stakeholder = $this->instance->account->fetch(self::$account_id)->stakeholders()->fetch(self::$stakeholder_id); $this->assertTrue(is_array($stakeholder->toArray())); $this->assertTrue(is_array((array) $stakeholder['phone'])); } public function testFetchAllStakerholder() { $stakeholder = $this->instance->account->fetch(self::$account_id)->stakeholders()->all(); $this->assertTrue(is_array($stakeholder->toArray())); $this->assertTrue(is_array((array) $stakeholder['items'])); } public function testEditStakerholder() { $stakeholder = $this->instance->account->fetch(self::$account_id)->stakeholders()->edit(self::$stakeholder_id, $this->stakeholderAttributes()); $this->assertTrue(is_array($stakeholder->toArray())); $this->assertTrue(is_array((array) $stakeholder['phone'])); } public function testProductConfiguration(){ $product = $this->instance->account->fetch(self::$account_id)->products()->requestProductConfiguration([ "product_name" => "payment_gateway", "tnc_accepted" => true, "ip" => "233.233.233.234" ]); self::$product_id = $product['id']; $this->assertTrue(is_array($product->toArray())); $this->assertTrue(is_array((array) $product['requirements'])); } public function testProductFetch(){ $product = $this->instance->account->fetch(self::$account_id)->products()->fetch(self::$product_id); $this->assertTrue(is_array($product->toArray())); $this->assertTrue(is_array((array) $product['requirements'])); } public function testProductEdit(){ $product = $this->instance->account->fetch(self::$account_id)->products()->edit(self::$product_id,[ "tnc_accepted" => true, "ip" => "233.233.233.224" ]); $this->assertTrue(is_array($product->toArray())); } public function testFetchTnc() { $webhook = $this->instance->product->fetchTnc("payments"); $this->assertTrue(is_array($webhook->toArray())); } public function testWebhookCreate() { $webhook = $this->instance->account->fetch(self::$account_id)->webhooks()->create($this->webhookAttributes()); self::$webhook_id = $webhook['id']; $this->assertTrue(is_array($webhook->toArray())); $this->assertTrue(is_array((array) $webhook['id'])); } public function testWebhookFetch() { $webhook = $this->instance->account->fetch(self::$account_id)->webhooks()->fetch(self::$webhook_id); $this->assertTrue(is_array($webhook->toArray())); $this->assertTrue(is_array((array) $webhook['id'])); } public function testFetchAllWebhook() { $webhook = $this->instance->account->fetch(self::$account_id)->webhooks()->all(); $this->assertTrue(is_array($webhook->toArray())); $this->assertTrue(is_array((array) $webhook['items'])); } public function testEditWebhook() { $webhook = $this->instance->account->fetch(self::$account_id)->webhooks()->edit([ "url" => "https://www.linkedin.com", "events" => ["refund.created"], ],self::$webhook_id); $this->assertTrue(is_array($webhook->toArray())); $this->assertTrue(is_array((array) $webhook['events'])); } public function testDeleteWebhook() { $webhook = $this->instance->account->fetch(self::$account_id)->webhooks()->delete(self::$webhook_id); $this->assertTrue(is_array($webhook->toArray())); } public function testDeleteAccount() { $account = $this->instance->account->fetch(self::$account_id)->delete(); $this->assertTrue(is_array($account->toArray())); $this->assertTrue(is_array((array) $account['legal_info'])); } public function testFetchAccount() { $account = $this->instance->account->fetch(self::$account_id); $this->assertTrue(is_array($account->toArray())); $this->assertTrue(is_array((array) $account['legal_info'])); } public function testEditAccount() { $request = ["customer_facing_business_name" => "Ltd"]; $account = $this->instance->account->fetch(self::$account_id)->edit($request); $this->assertTrue(is_array($account->toArray())); $this->assertTrue(is_array((array) $account['legal_info'])); } public function accountAttributes(){ return $arrayVar = [ "email" => "gauriagain".time()."@example.org", "phone" => "9000090000", "legal_business_name" => "Acme Corp", "business_type" => "partnership", "customer_facing_business_name" => "Example", "profile" => [ "category" => "healthcare", "subcategory" => "clinic", "description" => "Healthcare E-commerce platform", "addresses" => [ "operation" => [ "street1" => "507, Koramangala 6th block", "street2" => "Kormanagala", "city" => "Bengaluru", "state" => "Karnataka", "postal_code" => 560047, "country" => "IN", ], "registered" => [ "street1" => "507, Koramangala 1st block", "street2" => "MG Road", "city" => "Bengaluru", "state" => "Karnataka", "postal_code" => 560034, "country" => "IN", ], ], "business_model" => "Online Clothing ( men, women, ethnic, modern ) fashion and lifestyle, accessories, t-shirt, shirt, track pant, shoes.", ], "legal_info" => ["pan" => "AAACL1234C", "gst" => "18AABCU9603R1ZM"], "brand" => ["color" => "FFFFFF"], "notes" => ["internal_ref_id" => "123123"], "contact_name" => "Gaurav Kumar", "contact_info" => [ "chargeback" => ["email" => "cb@example.org"], "refund" => ["email" => "cb@example.org"], "support" => [ "email" => "support@example.org", "phone" => "9999999998", "policy_url" => "https://www.google.com", ], ], "apps" => [ "websites" => ["https://www.example.org"], "android" => [["url" => "playstore.example.org", "name" => "Example"]], "ios" => [["url" => "appstore.example.org", "name" => "Example"]], ], ]; } public function stakeholderAttributes(){ return $arrayVar = [ "percentage_ownership" => 10, "name" => "Gaurav Kumar", "email" => "gaurav". time() .".kumar@example.com", "relationship" => ["director" => true, "executive" => false], "phone" => ["primary" => "7474747474", "secondary" => "7474747474"], "addresses" => [ "residential" => [ "street" => "506, Koramangala 1st block", "city" => "Bengaluru", "state" => "Karnataka", "postal_code" => "560034", "country" => "IN", ], ], "kyc" => ["pan" => "AVOPB1111K"], "notes" => ["random_key_by_partner" => "random_value"], ]; } public function webhookAttributes(){ return $arrayVar = [ "url" => "https://google.com", "alert_email" => "gaurav.kumar@example.com", "secret" => "12345", "events" => [ "payment.authorized", "payment.failed", "payment.captured", "payment.dispute.created", "refund.failed", "refund.created", ], ]; } public function testAccountFetchDocument() { $data = $this->instance->account->fetch($this->accId)->fetchAccountDoc(); $this->assertTrue(is_array($data->toArray())); } public function testStakeholderFetchDocument() { $data = $this->instance->account->fetch($this->accId)->stakeholders()->fetchStakeholderDoc($this->stkId); $this->assertTrue(is_array($data->toArray())); } public function testFetchDocument() { $data = $this->instance->document->fetch($this->docId); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey("entity", $data->toArray()); } } PK �S*[���76 6 razorpay/tests/ExceptionTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; use Razorpay\Api\Errors; class ExceptionTest extends TestCase { public function setUp(): void { parent::setUp(); } /** * Create an order from set header application/json */ public function testCreateOrderSetHeaderException() { $attribute = $this->payload(); try { $this->api->setHeader('content-type', 'application/json'); $data = $this->api->order->create($attribute); $this->assertTrue(is_array($data->toArray())); } catch(Error $e){ throw new InvalidArgumentException($e); } } /** * Create an order */ public function testCreateOrderSuccess() { $attribute = $this->payload(); try { $data = $this->api->order->create($attribute); $this->assertTrue(is_array($data->toArray())); } catch(Error $e){ throw new InvalidArgumentException($e); } } private function payload(){ $date = new \DateTime(); $receiptId = $date->getTimestamp(); return [ "receipt"=> (string) $receiptId, "amount"=>54900, "currency"=>"INR", "payment_capture"=>1, "app_offer"=>0, "notes" => [ "woocommerce_order_number" => 240186 ], "line_items_total" => 54900, "line_items" => [ [ "type" => "e-commerce", "sku"=> "", "variant_id" => "211444", "price" => "54900", "offer_price" => "54900", "quantity" => 1, "name" => "Personalised Kids T-shirts", "description" => "description" ] ] ]; } }PK �S*[2�g, , razorpay/tests/FundTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class FundTest extends TestCase { /** * Specify unique customer id * for example cust_IEfAt3ruD4OEzo */ private $customerId = "cust_IEfAt3ruD4OEzo"; public function setUp(): void { parent::setUp(); } /** * Create a fund account */ public function testCreateFundAccount() { $data = $this->api->fundAccount->create(array('customer_id'=>$this->customerId,'account_type'=>'bank_account','bank_account'=>array('name'=>'Gaurav Kumar', 'account_number'=>'11214311215411', 'ifsc'=>'HDFC0000053'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer_id',$data->toArray())); } /** * Fetch all fund accounts */ public function testCreateOrder() { $data = $this->api->fundAccount->all(array('customer_id'=>$this->customerId)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } }PK �S*[��x�� � razorpay/tests/AddonTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class AddonTest extends TestCase { /** * Specify unique addon id & plan id * for example ao_IEf05Yeu52LlKL & plan_IEeswu4zFBRGwi */ private $addonId = "ao_IEf05Yeu52LlKL"; private $planId = "plan_IEeswu4zFBRGwi"; public function setUp(): void { parent::setUp(); } /** * Create an Add-on */ public function testCreateAddon() { $subscription = $this->api->subscription->create(array('plan_id' => $this->planId, 'customer_notify' => 1,'quantity'=>1, 'total_count' => 6, 'addons' => array(array('item' => array('name' => 'Delivery charges', 'amount' => 3000, 'currency' => 'INR'))),'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $data = $this->api->subscription->fetch($subscription->id)->createAddon(array('item' => array('name' => 'Extra Chair', 'amount' => 3000, 'currency' => 'INR'), 'quantity' => 1)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_object($data['item'])); } /** * Fetch Subscription Link by ID */ public function testFetchSubscriptionLink() { $data = $this->api->addon->fetch($this->addonId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue($data['entity']=='addon'); } /** * Fetch all addons */ public function testFetchAllAddon() { $data = $this->api->addon->fetchAll(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } }PK �S*[���F F razorpay/tests/bootstrap.phpnu �[��� <?php $autoloader = require dirname(__DIR__) . '/vendor/autoload.php';PK �S*[+#��3 3 razorpay/tests/CoverageTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class CoverageTest extends TestCase { /** * @covers \Razorpay\Api\Token::all * @covers \Razorpay\Api\Token::fetch * @covers \Razorpay\Api\Token::create * @covers \Razorpay\Api\Token::fetchCardPropertiesByToken * @covers \Razorpay\Api\Token::deleteToken */ public function testTokenCoverage(){ $transfer = new TokenTest(); $transfer->setup(); $transfer->testFetchTokenByCustomerId(); $transfer->testCreateToken(); $transfer->testFetchTokenByPaymentId(); $transfer->testProcessPaymentOnAlternatePAorPG(); $transfer->testDeleteToken(); } /** * @covers \Razorpay\Api\Account::create * @covers \Razorpay\Api\Account::fetch * @covers \Razorpay\Api\Account::edit * @covers \Razorpay\Api\Account::delete */ public function testAccountCoverage(){ $account = new PartnerTest(); $account->setup(); $account->testCreateAccount(); $account->testFetchAccount(); //$account->testEditAccount(); $account->testDeleteAccount(); } /** * @covers \Razorpay\Api\Stakeholder::create * @covers \Razorpay\Api\Stakeholder::fetch * @covers \Razorpay\Api\Stakeholder::all */ public function testStakeholderCoverage(){ $stakeholder = new PartnerTest(); $stakeholder->setup(); $stakeholder->testCreateStakerholder(); $stakeholder->testFetchStakerholder(); $stakeholder->testFetchAllStakerholder(); } /** * @covers \Razorpay\Api\Product::requestProductConfiguration * @covers \Razorpay\Api\Product::fetch * @covers \Razorpay\Api\Product::edit * @covers \Razorpay\Api\Product::fetchTnc * @covers \Razorpay\Api\Stakeholder::edit */ public function testProductCoverage(){ $product = new PartnerTest(); $product->setup(); $product->testProductConfiguration(); $product->testProductFetch(); $product->testProductEdit(); $product->testFetchTnc(); //$product->testEditStakerholder(); } /** * @covers \Razorpay\Api\Webhook::create * @covers \Razorpay\Api\Webhook::fetch * @covers \Razorpay\Api\Webhook::all * @covers \Razorpay\Api\Webhook::edit * @covers \Razorpay\Api\Webhook::delete */ public function testWebhookCoverage(){ $webhook = new PartnerTest(); $webhook->setup(); $webhook->testWebhookCreate(); $webhook->testWebhookFetch(); $webhook->testFetchAllWebhook(); $webhook->testEditWebhook(); $webhook->testDeleteWebhook(); } /** * @covers \Razorpay\Api\Api::getAppsDetails * @uses \Razorpay\Api\Api::setAppDetails * @covers \Razorpay\Api\Api::getBaseUrl * @uses \Razorpay\Api\Api::setBaseUrl * @cover \Razorpay\Api\Api::getKey * @cover \Razorpay\Api\Api::getSecret * @cover \Razorpay\Api\Api::getFullUrl * @cover \Razorpay\Api\Api::testgetheader * @cover \Razorpay\Api\Request::addHeader * @cover \Razorpay\Api\Request::getHeader */ public function testApiInstance(){ $instance = new ApiTest(); $instance->setup(); $instance->testGetAppDetails(); $instance->testSetBaseUrl(); $instance->testGetkey(); $instance->testGetSecret(); $instance->testFullUrl(); $instance->testgetheader(); } /** * @covers \Razorpay\Api\Plan::create * @covers \Razorpay\Api\Plan::fetch * @covers \Razorpay\Api\Plan::all */ public function testPlanCoverage(){ $subscription = new PlanTest(); $subscription->setup(); $subscription->testCreatePlan(); $subscription->testFetchAllPlans(); $subscription->testFetchPlan(); } /** * @covers \Razorpay\Api\QrCode::create * @covers \Razorpay\Api\QrCode::fetch * @covers \Razorpay\Api\QrCode::close * @uses \Razorpay\Api\ArrayableInterface * @covers \Razorpay\Api\QrCode::all * @covers \Razorpay\Api\QrCode::fetchAllPayments */ public function testQrCodeCoverage(){ $qrCode = new QrCodeTest(); $qrCode->setup(); $qrCode->testCreateQrCode(); $qrCode->testFetchQrCode(); $qrCode->testCloseQrCode(); $qrCode->testFetchAllQrCode(); $qrCode->testFetchQrCodePaymentById(); } /** * @covers \Razorpay\Api\Refund::fetch * @covers \Razorpay\Api\Refund::edit * @covers \Razorpay\Api\Refund::all * @covers \Razorpay\Api\Payment::fetchMultipleRefund * @covers \Razorpay\Api\Payment::fetchRefund */ public function testRefundCoverage(){ $refund = new RefundTest(); $refund->setup(); $refund->testFetchRefund(); $refund->testFetchAllRefund(); $refund->testFetchMultipalRefund(); } /** * @covers \Razorpay\Api\Subscription::create * @covers \Razorpay\Api\Subscription::fetch * @covers \Razorpay\Api\Addon::fetchAll * @covers \Razorpay\Api\Subscription::all */ public function testSubscriptionCoverage(){ $subscription = new SubscriptionTest(); $subscription->setup(); $subscription->testCreateSubscription(); $subscription->testSubscriptionFetchId(); $subscription->testFetchAddons(); $subscription->testFetchAllSubscriptions(); } /** * @covers \Razorpay\Api\VirtualAccount::create * @covers \Razorpay\Api\VirtualAccount::all * @covers \Razorpay\Api\VirtualAccount::payments * @uses \Razorpay\Api\VirtualAccount::fetch * @covers \Razorpay\Api\VirtualAccount::close */ public function testVirtualAccountCoverage(){ $virtualAccount = new VirtualAccountTest(); $virtualAccount->setup(); $virtualAccount->testCreateVirtualAccount(); $virtualAccount->testFetchAllVirtualAccounts(); $virtualAccount->testFetchPayment(); $virtualAccount->testCloseVirtualAccount(); } /** * @covers \Razorpay\Api\Addon::fetch * @covers \Razorpay\Api\Addon::fetchAll */ public function testAddonCoverage(){ $addon = new AddonTest(); $addon->setUp(); $addon->testFetchSubscriptionLink(); $addon->testFetchAllAddon(); } /** * @covers \Razorpay\Api\Customer::create * @covers \Razorpay\Api\Entity::create * @covers \Razorpay\Api\Customer::edit * @covers \Razorpay\Api\Entity::getEntityUrl * @covers \Razorpay\Api\Customer::all * @covers \Razorpay\Api\Entity::all * @covers \Razorpay\Api\Customer::fetch * @covers \Razorpay\Api\Entity::fetch * @covers \Razorpay\Api\Entity::validateIdPresence * @covers \Razorpay\Api\Entity::snakeCase * @covers \Razorpay\Api\Entity::request * @covers \Razorpay\Api\Entity::buildEntity * @covers \Razorpay\Api\Entity::getDefinedEntitiesArray * @covers \Razorpay\Api\Entity::getEntityClass * @covers \Razorpay\Api\Entity::getEntity * @covers \Razorpay\Api\Entity::fill * @covers \Razorpay\Api\Entity::isAssocArray * @covers \Razorpay\Api\Entity::toArray * @covers \Razorpay\Api\Entity::convertToArray * @covers \Razorpay\Api\Collection::count */ public function testCustomerCoverage(){ $customer = new CustomerTest(); $customer->setUp(); $customer->testCreateCustomer(); $customer->testEditCustomer(); $customer->testFetchAll(); $customer->testFetchCustomer(); usleep(500000); } /** * @covers \Razorpay\Api\Card::fetch * @covers \Razorpay\Api\Request::request * @covers \Razorpay\Api\Request::checkErrors * @covers \Razorpay\Api\Request::getRequestHeaders * @covers \Razorpay\Api\Request::constructUa * @covers \Razorpay\Api\Request::getAppDetailsUa */ public function testCardCoverage(){ $card = new CardTest(); $card->setup(); $card->testFetchCard(); } /** * @covers \Razorpay\Api\FundAccount::create * @covers \Razorpay\Api\FundAccount::all */ public function testFundCoverage(){ $fund = new FundTest(); $fund->setup(); $fund->testCreateFundAccount(); $fund->testCreateOrder(); } /** * @covers \Razorpay\Api\Invoice::create * @covers \Razorpay\Api\Invoice::all * @covers \Razorpay\Api\Invoice::edit * @covers \Razorpay\Api\Invoice::notifyBy * @covers \Razorpay\Api\Invoice::delete * @covers \Razorpay\Api\Invoice::cancel * @uses \Razorpay\Api\Invoice::fetch */ public function testInvoiceCoverage(){ $invoice = new InvoiceTest(); $invoice->setup(); $invoice->testCreateInvoice(); $invoice->testFetchAllInvoice(); $invoice->testUpdateInvoice(); $invoice->testInvoiceIssue(); $invoice->testDeleteInvoice(); $invoice->testCancelInvoice(); } /** * @covers \Razorpay\Api\Item::create * @covers \Razorpay\Api\Item::fetch * @covers \Razorpay\Api\Item::edit * @covers \Razorpay\Api\Item::all * @covers \Razorpay\Api\Item::delete */ public function testItemCoverage(){ $item = new ItemTest(); $item->setup(); $item->testcreate(); $item->testAllItems(); $item->testfetchItem(); $item->testUpdate(); $item->testDelete(); } /** * @covers \Razorpay\Api\Order::create * @covers \Razorpay\Api\Order::all * @covers \Razorpay\Api\Order::fetch * @covers \Razorpay\Api\Order::edit */ public function testOrderCoverage(){ $order = new OrdersTest(); $order->setup(); $order->testCreateOrder(); $order->testAllOrders(); $order->testFetchOrder(); $order->testUpdateOrder(); } /** * @covers \Razorpay\Api\Payment::fetch * @covers \Razorpay\Api\Payment::all * @covers \Razorpay\Api\Payment::edit * @covers \Razorpay\Api\Order::payments * @covers \Razorpay\Api\Payment::fetchCardDetails * @covers \Razorpay\Api\Payment::fetchPaymentDowntime * @covers \Razorpay\Api\Payment::fetchPaymentDowntimeById */ public function testPaymentCoverage(){ $order = new PaymentTest(); $order->setup(); $order->testFetchPayment(); $order->testFetchAllPayment(); $order->testUpdatePayment(); $order->testFetchOrderPayment(); $order->testFetchCardWithPaymentId(); $order->testfetchPaymentDowntime(); $order->testfetchPaymentDowntimeById(); } /** * @covers \Razorpay\Api\PaymentLink::create * @covers \Razorpay\Api\PaymentLink::fetch * @covers \Razorpay\Api\PaymentLink::all * @covers \Razorpay\Api\PaymentLink::cancel * @covers \Razorpay\Api\PaymentLink::edit * @covers \Razorpay\Api\PaymentLink::notifyBy */ public function testPaymentlinkCoverage(){ $paymentlink = new PaymentLinkTest(); $paymentlink->setup(); $paymentlink->testCreatePaymentLink(); $paymentlink->testFetchRefund(); $paymentlink->testFetchAllMutlipleRefund(); $paymentlink->testCancelPaymentLink(); $paymentlink->testUpdatePaymentLink(); $paymentlink->testSendNotification(); } /** * @covers \Razorpay\Api\Settlement::all * @covers \Razorpay\Api\Settlement::settlementRecon */ public function testSettlementCoverage(){ $paymentlink = new SettlementTest(); $paymentlink->setup(); $paymentlink->testAllSettlements(); $paymentlink->testSettlementRecon(); } /** * @covers \Razorpay\Api\Order::transfers * @covers \Razorpay\Api\Transfer::all * @covers \Razorpay\Api\Payment::transfers * @covers \Razorpay\Api\Transfer::fetch * @covers \Razorpay\Api\Transfer::all */ public function testTransferCoverage(){ $transfer = new TransferTest(); $transfer->setup(); $transfer->testFetchTransferOrder(); $transfer->testFetchSettlement(); $transfer->testFetchTransferPayment(); $transfer->testFetchTransfer(); $transfer->testFetchSettlement(); } /** * @covers \Razorpay\Api\Utility::verifyPaymentSignature * @covers \Razorpay\Api\Utility::verifySignature * @covers \Razorpay\Api\Utility::hashEquals * @covers \Razorpay\Api\Errors\SignatureVerificationError */ public function testUtilityCoverage(){ $utility = new SignatureVerificationTest(); $utility->setup(); $utility->testPaymentVerification(); $utility->testPaymentLinkVerification(); $utility->testSubscriptionVerification(); } /** * @covers \Razorpay\Api\Order::create */ public function testSetHeaderJson() { $order = new ExceptionTest(); $order->setup(); $order->testCreateOrderSetHeaderException(); } /** * @covers \Razorpay\Api\Order::create */ public function testSendArrayPayload() { $order = new ExceptionTest(); $order->setup(); $order->testCreateOrderSuccess(); } } PK �S*[t��� � % razorpay/tests/VirtualAccountTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class VirtualAccountTest extends TestCase { /** * Specify unique customer id, payment id & virtual-account id * for example cust_IEm1ERQLCdRGPV, pay_IEljgrElHGxXAC & * va_IEmC8SOoyGxsNn */ private $customerId = "cust_IEm1ERQLCdRGPV"; private $paymentId = "pay_IEljgrElHGxXAC"; private $virtualAccountId = "va_IEmC8SOoyGxsNn"; public function setUp(): void { parent::setUp(); } /** * Create a virtual account */ public function testCreateVirtualAccount() { $data = $this->api->virtualAccount->create(array('receivers' => array('types' => array('bank_account')),'description' => 'Virtual Account created for Raftar Soft','customer_id' => $this->customerId ,'close_by' => strtotime('+16 minutes', time()), 'notes' => array('project_name' => 'Banking Software'))); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey('customer_id',$data->toArray()); } /** * Create a virtual account with TPV */ public function testCreateVirtualAccountTpv() { $data = $this->api->virtualAccount->create(array('receivers' => array('types'=> array('bank_account')),'allowed_payers' => array(array('type'=>'bank_account','bank_account'=>array('ifsc'=>'RATN0VAAPIS','account_number'=>'2223330027558515'))),'description' => 'Virtual Account created for Raftar Soft','customer_id' => $this->customerId, 'notes' => array('project_name' => 'Banking Software'))); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey('customer_id',$data->toArray()); } /** * Fetch all virtual account */ public function testFetchAllVirtualAccounts() { $data = $this->api->virtualAccount->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('collection',$data->toArray())); } /** * Fetch payments for a virtual account */ public function testFetchPayment() { $data = $this->api->virtualAccount->fetch($this->virtualAccountId)->payments(); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey('items',$data->toArray()); } /** * Refund payments made to a virtual account */ public function testFetchRefund() { $payment = $this->api->payment->all(); $data = $this->api->payment->fetch($this->paymentId)->refunds(); $this->assertTrue(is_array($data->toArray())); } /** * Close virtual account */ public function testCloseVirtualAccount() { $payment = $this->api->virtualAccount->all(); if($payment['count'] !== 0){ $data = $this->api->virtualAccount->fetch($payment['items'][0]['id'])->close(); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey('id',$data->toArray()); } } }PK �S*[�#6� � # razorpay/tests/SubscriptionTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class SubscriptionTest extends TestCase { /** * Specify unique subscription id & plan id * for example : sub_IEKtBfPIqTHLWd & plan_IEeswu4zFBRGwi */ private $subscriptionId = "sub_IEllLOZcf0PODu"; private $plan = "plan_IEeswu4zFBRGwi"; public function setUp(): void { parent::setUp(); } /** * Create a Subscription Link */ public function testCreateSubscription() { $data = $this->api->subscription->create(array('plan_id' => $this->plan, 'customer_notify' => 1,'quantity'=>1, 'total_count' => 6, 'addons' => array(array('item' => array('name' => 'Delivery charges', 'amount' => 3000, 'currency' => 'INR'))),'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Fetch Subscription Link by ID */ public function testSubscriptionFetchId() { $data = $this->api->subscription->fetch($this->subscriptionId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('plan_id',$data->toArray())); } /** * Pause a Subscription */ public function testPauseSubscription() { $data = $this->api->subscription->fetch($this->subscriptionId)->pause(['pause_at'=>'now']); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); $this->assertTrue($data['status'] == 'paused'); } /** * Resume a Subscription */ public function testResumeSubscription() { $data = $this->api->subscription->fetch($this->subscriptionId)->resume(['resume_at'=>'now']); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Update a Subscription */ public function testUpdateSubscription() { $data = $this->api->subscription->fetch($this->subscriptionId)->update(array('schedule_change_at'=>'cycle_end','quantity'=>2)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer_id',$data->toArray())); } /** * Fetch Details of a Pending Update */ public function testPendingUpdate() { $data = $this->api->subscription->fetch($this->subscriptionId)->pendingUpdate(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Cancel an Update */ public function testCancelUpdate() { $data = $this->api->subscription->fetch($this->subscriptionId)->cancelScheduledChanges(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Fetch All Invoices for a Subscription */ public function testSubscriptionInvoices() { $data = $this->api->invoice->all(['subscription_id'=>$this->subscriptionId]); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch all Add-ons */ public function testFetchAddons() { $data = $this->api->addon->fetchAll(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch all subscriptions */ public function testFetchAllSubscriptions() { $data = $this->api->subscription->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } }PK �S*[<��� ! razorpay/tests/SettlementTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class SettlementTest extends TestCase { /** * Specify unique settlement id * for example : setl_IAj6iuvvTATqOM */ private $settlementId = "setl_IAj6iuvvTATqOM"; public function setUp(): void { parent::setUp(); } /** * Create on-demand settlement */ public function testCreateOndemandSettlement() { $data = $this->api->settlement->createOndemandSettlement(array("amount"=> 1221, "settle_full_balance"=> false, "description"=>"Testing","notes" => array("notes_key_1"=> "Tea, Earl Grey, Hot","notes_key_2"=> "Tea, Earl Grey… decaf."))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('settlement.ondemand',$data->toArray())); } /** * Fetch all settlements */ public function testAllSettlements() { $data = $this->api->settlement->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('collection',$data->toArray())); } /** * Fetch a settlement */ public function testFetchSettlement() { $data = $this->api->settlement->fetch($this->settlementId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('settlement',$data->toArray())); } /** * Settlement report for a month */ public function testReports() { $data = $this->api->settlement->reports(array("year"=>2021,"month"=>9)); $this->assertTrue(is_array($data->toArray())); } /** * Settlement recon */ public function testSettlementRecon() { $data = $this->api->settlement->settlementRecon(array('year' => 2021, 'month' => 9)); $this->assertTrue(is_array($data->toArray())); $this->assertArrayHasKey('items',$data); } /** * Fetch all on-demand settlements */ public function testFetchAllOndemandSettlement() { $data = $this->api->settlement->fetchAllOndemandSettlement(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch on-demand settlement by ID */ public function testFetchAllOndemandSettlementById() { $data = $this->api->settlement->fetch($this->settlementId)->TestFetchAllOndemandSettlementById(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } }PK �S*[����� � razorpay/tests/RequestTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class RequestTest extends TestCase { public function setUp(): void { parent::setUp(); } /** * Create customer */ public function testaddHeader() { $data = $this->api->customer->create(array('name' => 'Razorpay User 38', 'email' => 'customer38@razorpay.com' ,'fail_existing'=>'0')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer',$data->toArray())); } /** * Edit customer */ public function testEditCustomer() { $data = $this->api->customer->fetch($this->customerId)->edit(array('name' => 'Razorpay User 21' ,'contact'=>'9123456780')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array($this->customerId, $data->toArray())); } /** * Fetch customer All */ public function testFetchAll() { $data = $this->api->customer->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_numeric($data->count())); $this->assertTrue(is_array($data['items'])); } /** * Fetch a customer */ public function testFetchCustomer() { $data = $this->api->customer->fetch($this->customerId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array($this->customerId, $data->toArray())); } }PK �S*[y�j � � razorpay/tests/ApiTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class ApiTest extends TestCase { private $title = "codecov_test"; private $url = 'https://api.razorpay.com'; public function setUp(): void { parent::setUp(); } /** * Get app details */ public function testGetAppDetails() { $this->api->setAppDetails($this->title); $data = $this->api->getAppsDetails(); $this->assertTrue(is_array($data)); $this->assertTrue($this->title==$data[0]['title']); } /** * Get app details */ public function testSetBaseUrl() { $this->api->setBaseUrl($this->url); $data = $this->api->getBaseUrl(); $this->assertTrue($this->url==$data); } public function testGetkey() { $data = $this->api->getKey(); $this->assertTrue(strlen($data) > 0); } public function testGetSecret() { $data = $this->api->getSecret(); $this->assertTrue(strlen($data) > 0); } public function testFullUrl() { $pattern = '/^(https?:\/\/)?([a-z0-9-]+\.)+[a-z]{2,}(\/.*)?$/i'; $url = $this->api->getFullUrl($this->api->getBaseUrl()."orders","v1"); $this->assertTrue(preg_match($pattern, $url, $matches)==true); } /** * @covers \Request */ public function testgetheader() { $data = Request::getHeaders(); $this->assertTrue(is_array($data)); } }PK �S*[�&1� � razorpay/tests/RefundTest.phpnu �[��� <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class RefundTest extends TestCase { /** * Specify unique payment id & refund id * for example pay_LatkcPaGiDxgRG & rfnd_IEjzeVghAS4vd1 */ private $paymentId = "pay_LatkcPaGiDxgRG"; private $refundId = "rfnd_Lcsb6JNwQVAtpi"; public function setUp(): void { parent::setUp(); } /** * Create an instant refund */ public function testCreateRefund() { $data = $this->api->payment->fetch($this->paymentId)->refund(array("amount"=> "100", "speed"=>"optimum", "receipt"=>"Receipt No. ".time())); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('refund',$data->toArray())); } /** * Fetch multiple refunds for a payment */ public function testFetchMultipalRefund() { $data = $this->api->payment->fetch($this->paymentId)->fetchMultipleRefund(array("count"=>1)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch a specific refund for a payment */ public function testFetchRefund() { $data = $this->api->payment->fetch($this->paymentId)->fetchRefund($this->refundId); $this->assertTrue(is_array($data->toArray())); } /** * Fetch all refunds */ public function testFetchAllRefund() { $data = $this->api->refund->all(array("count"=>1)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch particular refund */ public function testParticularRefund() { $data = $this->api->refund->fetch($this->refundId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('refund',$data->toArray())); } /** * Update the refund */ public function testUpdateRefund() { $data = $this->api->refund->fetch($this->refundId)->edit(array('notes'=> array('notes_key_1'=>'Beam me up Scotty.', 'notes_key_2'=>'Engage'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('refund',$data->toArray())); } }PK �S*[.�6�% �% "