Subiendo proyecto completo sin restricciones de git ignore

This commit is contained in:
Jose Sanchez
2023-08-17 11:44:02 -04:00
parent a0d4f5ba3b
commit 20f1c60600
19921 changed files with 2509159 additions and 45 deletions

View File

@@ -0,0 +1,77 @@
<?php
namespace Tests\Stubs;
use KingFlamez\Rave\RaveEventHandlerInterface;
class PaymentEventHandler implements RaveEventHandlerInterface {
/**
* This is called when the Rave class is initialized
* */
function onInit($initializationData){
// Save the transaction to your DB.
return 'Payment started......'.json_encode($initializationData).'<br />'; //Remember to delete this line
}
/**
* This is called only when a transaction is successful
* */
function onSuccessful($transactionData){
// Get the transaction from your DB using the transaction reference (txref)
// Check if you have previously given value for the transaction. If you have, redirect to your successpage else, continue
// Comfirm that the transaction is successful
// Confirm that the chargecode is 00 or 0
// Confirm that the currency on your db transaction is equal to the returned currency
// Confirm that the db transaction amount is equal to the returned amount
// Update the db transaction record (includeing parameters that didn't exist before the transaction is completed. for audit purpose)
// Give value for the transaction
// Update the transaction to note that you have given value for the transaction
// You can also redirect to your success page from here
return 'Payment Successful!'.json_encode($transactionData).'<br />'; //Remember to delete this line
}
/**
* This is called only when a transaction failed
* */
function onFailure($transactionData){
// Get the transaction from your DB using the transaction reference (txref)
// Update the db transaction record (includeing parameters that didn't exist before the transaction is completed. for audit purpose)
// You can also redirect to your failure page from here
return 'Payment Failed!'.json_encode($transactionData).'<br />'; //Remember to delete this line
}
/**
* This is called when a transaction is requeryed from the payment gateway
* */
function onRequery($transactionReference){
// Do something, anything!
return 'Payment requeried......'.$transactionReference.'<br />'; //Remember to delete this line
}
/**
* This is called a transaction requery returns with an error
* */
function onRequeryError($requeryResponse){
// Do something, anything!
return 'An error occured while requeying the transaction...'.json_encode($requeryResponse).'<br />'; //Remember to delete this line
}
/**
* This is called when a transaction is canceled by the user
* */
function onCancel($transactionReference){
// Do something, anything!
// Note: Somethings a payment can be successful, before a user clicks the cancel button so proceed with caution
return 'Payment canceled by user......'.$transactionReference.'<br />'; //Remember to delete this line
}
/**
* This is called when a transaction doesn't return with a success or a failure response. This can be a timedout transaction on the Rave server or an abandoned transaction by the customer.
* */
function onTimeout($transactionReference, $data){
// Get the transaction from your DB using the transaction reference (txref)
// Queue it for requery. Preferably using a queue system. The requery should be about 15 minutes after.
// Ask the customer to contact your support and you should escalate this issue to the flutterwave support team. Send this as an email and as a notification on the page. just incase the page timesout or disconnects
return 'Payment timeout......'.$transactionReference.' - '.json_encode($data).'<br />'; //Remember to delete this line
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Tests\Stubs;
use Illuminate\Http\Request as BaseRequest;
class Request extends BaseRequest {
public $email;
public $amount;
public $country;
public $currency;
public $lastname;
public $firstname;
public $phonenumber;
public $description;
public $payment_method;
public $pay_button_text;
function __construct( ) {
$data = (array) include __DIR__ . "/request_data.php";
array_walk($data["form"], function($value, $key) {
$this->{$key} = $value;
});
}
}

View File

@@ -0,0 +1,15 @@
<?php
/**
* Stub required environment variables.
*
* @return array
*/
return [
"prefix" => "rave",
"secretKey" => "FLWSECK-4127f15e63c9098402dcc7891798fb0f-X",
"publicKey" => "FLWPUBK-1cf610974690c2560cb4c36f4921244a-X",
"title" => "Rave Payment Gateway",
"env" => "testing",
"logo" => "https://files.readme.io/ee907a0-small-rave_by_flutterwave.png"
];

View File

@@ -0,0 +1,46 @@
<?php
/**
* Sample request data.
*
* @return array
*/
return [
/**
* Request mocking data
*/
"form" => [
"amount" => 30000,
"title" => "A Title",
"lastname" => "Last",
"currency" => "naira",
"country" => "Nigeria",
"firstname" => "First",
"payment_method" => "card",
"phonenumber" => "08012345678",
"email" => "email@example.org",
"pay_button_text" => "Pay Now",
"metadata" => "[{ flightid:3849 }]",
"description" => "Some random description.",
"logo" => "https://files.readme.io/ee907a0-small-rave_by_flutterwave.png",
],
/**
* Rave original properties representation.
*/
"class" => [
"amount",
"country",
"currency",
"lastname",
"firstname",
["logo" => "customLogo"],
"phonenumber",
["title" => "customTitle"],
"payButtonText",
["email" => "customerEmail"],
"payment_method",
["description" => "customeDescription"],
"metadata",
]
];