Skip to content

Instantly share code, notes, and snippets.

@slicksammy
slicksammy / spec.rb
Created April 4, 2025 15:22
same event twice
require 'rails_helper'
RSpec.describe ExternalEvents::FinixPlatformController, type: :controller do
let!(:business) { create(:business) }
let!(:business_customer) { create(:business_customer, business: business) }
let!(:checkout) { create(:checkout, business: business, business_customer: business_customer) }
let!(:payment_intent) { create(:payment_intent, :with_charge, checkout: checkout, business: business, business_customer: business_customer) }
let!(:charge) { payment_intent.charges.first }
let(:succeeded_event_type) { "SUCCEEDED" }
@slicksammy
slicksammy / transfer.rb
Last active April 4, 2025 17:29
Declined Transfer with $1.02 transaction amount
# when i do 1.02 with any card
request_body:
{"tags"=>{"charge_id"=>"ch_dMh3YCCXm5W8H84LX2C5fuLfiy5qcYh3"}, "amount"=>102, "source"=>"PIrnjSWBWe9CLX8RxSWcHP1c", "currency"=>"USD", "merchant"=>"MUd3YsPpEp6HRXUXhL8xu3xV", "idempotency_id"=>"ch_dMh3YCCXm5W8H84LX2C5fuLfiy5qcYh3", "fraud_session_id"=>"FSNDIxM2U1NWUtNDEyZC00NzRmLThjNmYtMmRmNzRjYWI2NjZk"},
response_body:
{"total"=>1, "_embedded"=>{"errors"=>[{"code"=>"DECLINED", "_links"=>{"self"=>{"href"=>"https://finix.sandbox-payments-api.com/transfers"}, "transfer"=>{"href"=>"https://finix.sandbox-payments-api.com/transfers/TRrywKbQBCDvjpiicxrW5n6q"}}, "logref"=>"f0f24ddd576149dd", "message"=>"Transfer TRrywKbQBCDvjpiicxrW5n6q was declined. DECLINED", "transfer"=>"TRrywKbQBCDvjpiicxrW5n6q", "failure_code"=>"GENERIC_DECLINE", "failure_message"=>"The transaction was declined for an unknown reason. The account owner needs to contact their issuer for more information."}]}}
# when i do with 4242
id: "f049c6f1-47cb-49e8-96ab-fcf10d74e957",
business_id: "890
@slicksammy
slicksammy / signature.rb
Created April 3, 2025 17:23
verifying finix signature
signature_header = request.headers["HTTP_FINIX_SIGNATURE"]
signing_secret = "ABC" # i saved it when creating the webhook "secret_signing_key" in the response
def get_timestamp_and_signature_parts(signature_header)
parts = signature_header.split(",").map(&:strip)
timestamp_part = parts.find { |p| p.start_with?("timestamp=") }
signature_part = parts.find { |p| p.start_with?("sig=") }
timestamp = timestamp_part.split("=")[1]
received_signature = signature_part.split("=")[1]
@slicksammy
slicksammy / finx.rb
Created April 1, 2025 17:19
3 Updated Events Per Transfer - Why?
# These events are listed order I received, starting with the most recent
# The first event has a parent_transfer which I assume it means moving money into the operator account
# The other 2 transfers have a tag "charge_id" which is my internal refernce ID
# Why are there 2 events?
[{"id"=>"event_o3gYzLdRB8io5pZmwdLfxR",
"type"=>"updated",
"entity"=>"transfer",
"_embedded"=>
{"transfers"=>
[{"id"=>"TRm3wXgnrj1ALv3vqYxEhdQi",
@slicksammy
slicksammy / app.tsx
Created March 14, 2025 19:41
how to create native view
// somehwere you make a request and get back data (which is a checkout)
setCheckoutUrl(`https://wallet.paywithsoap.com/?clientSecret=${data.client_secret}`);
return (
<SafeAreaView style={backgroundStyle}>
<View style={styles.webViewHeader}>
<TouchableOpacity onPress={closeWebView} style={styles.closeButton}>
<Text style={styles.closeButtonText}>✕</Text>
</TouchableOpacity>
<Text style={styles.webViewTitle}>Checkout</Text>
import express from 'express';
import { Request, Response } from 'express';
import { balanceStore } from '../store/balanceStore';
import { modifyBalance } from '../store/balance'; // Add import for the simple balance store
import { config } from '../config';
import crypto from 'crypto';
interface SoapEvent {
customer_id: string;
status: string;
import requests
from urllib.parse import urljoin
import tempfile
import time
import re
class Walle:
def __init__(self, api_key) -> None:
self.api = Api(api_key)
self.Customer = Customer(self)
import walle from walle-python
from playwright.sync_api import sync_playwright
walle.api_key = 'your_api_key'
customer = walle.Customer.create(
email = '[email protected]',
phone_number = '8888888888'
)
function FindProxyForURL(url, host) {
var braintreePattern = new RegExp("braintree-api.com");
var googlePattern = new RegExp("https://www.google.com");
if (braintreePattern.test(url)) {
return "PROXY 127.0.0.1:8080";
}
return "DIRECT";
}
function FindProxyForURL(url, host) {
if (shExpMatch(url, "https://payments.braintree-api.com/graphql") || shExpMatch(url, "deposit.shopifycs.com") ) {
return "PROXY 127.0.0.1:8080";
}
return "DIRECT";
}