mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 23:24:36 -04:00
Fixes for blockonomics
This commit is contained in:
parent
9848a54192
commit
7f936ad18b
@ -237,7 +237,7 @@ class Gateway extends StaticModel
|
|||||||
],
|
],
|
||||||
GatewayType::ACSS => ['refund' => false, 'token_billing' => true, 'webhooks' => []]
|
GatewayType::ACSS => ['refund' => false, 'token_billing' => true, 'webhooks' => []]
|
||||||
]; // Rotessa
|
]; // Rotessa
|
||||||
case 64:
|
case 65:
|
||||||
return [
|
return [
|
||||||
GatewayType::CRYPTO => ['refund' => true, 'token_billing' => false, 'webhooks' => ['confirmed', 'paid_out', 'failed', 'fulfilled']],
|
GatewayType::CRYPTO => ['refund' => true, 'token_billing' => false, 'webhooks' => ['confirmed', 'paid_out', 'failed', 'fulfilled']],
|
||||||
]; //Blockonomics
|
]; //Blockonomics
|
||||||
|
@ -109,10 +109,11 @@ class Blockonomics implements MethodInterface
|
|||||||
$data['payment_method_id'] = $request->payment_method_id;
|
$data['payment_method_id'] = $request->payment_method_id;
|
||||||
$data['payment_type'] = PaymentType::CRYPTO;
|
$data['payment_type'] = PaymentType::CRYPTO;
|
||||||
$data['gateway_type_id'] = GatewayType::CRYPTO;
|
$data['gateway_type_id'] = GatewayType::CRYPTO;
|
||||||
$data['transaction_reference'] = "payment hash: " . $request->payment_hash . " txid: " . $request->txid . " BTC amount: " . $request->btc_amount;
|
$data['transaction_reference'] = $request->txid;
|
||||||
|
|
||||||
$statusId = Payment::STATUS_PENDING;
|
$statusId = Payment::STATUS_PENDING;
|
||||||
$payment = $this->blockonomics->createPayment($data, $statusId);
|
$payment = $this->blockonomics->createPayment($data, $statusId);
|
||||||
|
|
||||||
SystemLogger::dispatch(
|
SystemLogger::dispatch(
|
||||||
['response' => $payment, 'data' => $data],
|
['response' => $payment, 'data' => $data],
|
||||||
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||||
|
@ -115,10 +115,11 @@ class BlockonomicsPaymentDriver extends BaseDriver
|
|||||||
return $this->payment_method->paymentResponse($request);
|
return $this->payment_method->paymentResponse($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processWebhookRequest()
|
public function processWebhookRequest(PaymentWebhookRequest $request)
|
||||||
{
|
{
|
||||||
|
nlog($request->all());
|
||||||
$url_callback_secret = $_GET['secret'];
|
|
||||||
|
$url_callback_secret = $request->secret;
|
||||||
$db_callback_secret = $this->getCallbackSecret();
|
$db_callback_secret = $this->getCallbackSecret();
|
||||||
|
|
||||||
if ($url_callback_secret != $db_callback_secret) {
|
if ($url_callback_secret != $db_callback_secret) {
|
||||||
@ -150,13 +151,16 @@ class BlockonomicsPaymentDriver extends BaseDriver
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($payment->status_id == $statusId) {
|
if($payment->status_id == $statusId) {
|
||||||
header('HTTP/1.1 200 OK');
|
return response()->json([], 200);
|
||||||
echo "No change in payment status";
|
// header('HTTP/1.1 200 OK');
|
||||||
|
// echo "No change in payment status";
|
||||||
} else {
|
} else {
|
||||||
$payment->status_id = $statusId;
|
$payment->status_id = $statusId;
|
||||||
$payment->save();
|
$payment->save();
|
||||||
header('HTTP/1.1 200 OK');
|
|
||||||
echo "Payment status updated successfully";
|
return response()->json([], 200);
|
||||||
|
// header('HTTP/1.1 200 OK');
|
||||||
|
// echo "Payment status updated successfully";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,20 +12,19 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
if(!Gateway::find(64))
|
if(!Gateway::find(65))
|
||||||
{
|
{
|
||||||
|
|
||||||
$fields = new \stdClass;
|
$fields = new \stdClass;
|
||||||
$fields->apiKey = "";
|
$fields->apiKey = "";
|
||||||
$fields->callbackUrl = "";
|
|
||||||
$fields->callbackSecret = "";
|
$fields->callbackSecret = "";
|
||||||
|
|
||||||
$gateway = new Gateway;
|
$gateway = new Gateway;
|
||||||
$gateway->id = 64;
|
$gateway->id = 65;
|
||||||
$gateway->name = 'Blockonomics';
|
$gateway->name = 'Blockonomics';
|
||||||
$gateway->key = 'wbhf02us6owgo7p4nfjd0ymssdshks4d';
|
$gateway->key = 'wbhf02us6owgo7p4nfjd0ymssdshks4d';
|
||||||
$gateway->provider = 'Blockonomics';
|
$gateway->provider = 'Blockonomics';
|
||||||
$gateway->is_offsite = true;
|
$gateway->is_offsite = false;
|
||||||
$gateway->fields = \json_encode($fields);
|
$gateway->fields = \json_encode($fields);
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class PaymentLibrariesSeeder extends Seeder
|
|||||||
['id' => 61, 'name' => 'PayPal Platform', 'provider' => 'PayPal_PPCP', 'key' => '80af24a6a691230bbec33e930ab40666', 'fields' => '{"testMode":false}'],
|
['id' => 61, 'name' => 'PayPal Platform', 'provider' => 'PayPal_PPCP', 'key' => '80af24a6a691230bbec33e930ab40666', 'fields' => '{"testMode":false}'],
|
||||||
['id' => 62, 'name' => 'BTCPay', 'provider' => 'BTCPay', 'key' => 'vpyfbmdrkqcicpkjqdusgjfluebftuva', 'fields' => '{"btcpayUrl":"", "apiKey":"", "storeId":"", "webhookSecret":""}'],
|
['id' => 62, 'name' => 'BTCPay', 'provider' => 'BTCPay', 'key' => 'vpyfbmdrkqcicpkjqdusgjfluebftuva', 'fields' => '{"btcpayUrl":"", "apiKey":"", "storeId":"", "webhookSecret":""}'],
|
||||||
['id' => 63, 'name' => 'Rotessa', 'is_offsite' => false, 'sort_order' => 22, 'provider' => 'Rotessa', 'key' => '91be24c7b792230bced33e930ac61676', 'fields' => '{"apiKey":"", "testMode":""}'],
|
['id' => 63, 'name' => 'Rotessa', 'is_offsite' => false, 'sort_order' => 22, 'provider' => 'Rotessa', 'key' => '91be24c7b792230bced33e930ac61676', 'fields' => '{"apiKey":"", "testMode":""}'],
|
||||||
['id' => 64, 'name' => 'Blockonomics', 'provider' => 'Blockonomics', 'key' => 'wbhf02us6owgo7p4nfjd0ymssdshks4d', 'fields' => "$blockonomics_fields"],
|
['id' => 65, 'name' => 'Blockonomics', 'provider' => 'Blockonomics', 'key' => 'wbhf02us6owgo7p4nfjd0ymssdshks4d', 'fields' => "$blockonomics_fields"],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($gateways as $gateway) {
|
foreach ($gateways as $gateway) {
|
||||||
@ -115,7 +115,7 @@ class PaymentLibrariesSeeder extends Seeder
|
|||||||
|
|
||||||
Gateway::query()->update(['visible' => 0]);
|
Gateway::query()->update(['visible' => 0]);
|
||||||
|
|
||||||
Gateway::whereIn('id', [1, 3, 7, 11, 15, 20, 39, 46, 55, 50, 57, 52, 58, 59, 60, 62, 63, 64])->update(['visible' => 1]);
|
Gateway::whereIn('id', [1, 3, 7, 11, 15, 20, 39, 46, 55, 50, 57, 52, 58, 59, 60, 62, 63, 64,65])->update(['visible' => 1]);
|
||||||
|
|
||||||
if (Ninja::isHosted()) {
|
if (Ninja::isHosted()) {
|
||||||
Gateway::whereIn('id', [20, 49])->update(['visible' => 0]);
|
Gateway::whereIn('id', [20, 49])->update(['visible' => 0]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user