mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Working on credit card auth response
This commit is contained in:
parent
57e6de2f37
commit
662aa3aed1
@ -54,6 +54,10 @@ class PaymentMethodController extends Controller
|
|||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$gateway = auth()->user()->client->getCreditCardGateway();
|
||||||
|
|
||||||
|
return $gateway->driver(auth()->user()->client)->authorizeCreditCardResponse($request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,10 +109,11 @@ class BasePaymentDriver
|
|||||||
* Refunds a given payment
|
* Refunds a given payment
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function refundPayment()
|
public function refundPayment() {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
public function authorizeCreditCardView($data) {}
|
||||||
|
|
||||||
|
public function authorizeCreditCardResponse($request) {}
|
||||||
|
|
||||||
/************************************* Omnipay ******************************************
|
/************************************* Omnipay ******************************************
|
||||||
authorize($options) - authorize an amount on the customer's card
|
authorize($options) - authorize an amount on the customer's card
|
||||||
|
@ -115,10 +115,77 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
{
|
{
|
||||||
$intent['intent'] = $this->getSetupIntent();
|
$intent['intent'] = $this->getSetupIntent();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return view('portal.default.gateways.stripe.create_customer', array_merge($data, $intent));
|
return view('portal.default.gateways.stripe.create_customer', array_merge($data, $intent));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function authorizeCreditCardResponse($request)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {
|
||||||
|
"id": "seti_1FJHmuKmol8YQE9DdhDgFXhT",
|
||||||
|
"object": "setup_intent",
|
||||||
|
"cancellation_reason": null,
|
||||||
|
"client_secret": "seti_1FJHmuKmol8YQE9DdhDgFXhT_secret_FoveetSB7RewVngU7H6IcrH9dlM1BXd",
|
||||||
|
"created": 1568631032,
|
||||||
|
"description": null,
|
||||||
|
"last_setup_error": null,
|
||||||
|
"livemode": false,
|
||||||
|
"next_action": null,
|
||||||
|
"payment_method": "pm_1FJHvQKmol8YQE9DV19fPXXk",
|
||||||
|
"payment_method_types": [
|
||||||
|
"card"
|
||||||
|
],
|
||||||
|
"status": "succeeded",
|
||||||
|
"usage": "off_session"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
\Stripe\Stripe::setApiKey('sk_test_faU9gVB7Hx19fCTo0e5ggZ0x');
|
||||||
|
|
||||||
|
\Stripe\PaymentMethod::retrieve('pm_1EUmzw2xToAoV8choYUtciXR');
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": "pm_1EUmzw2xToAoV8choYUtciXR",
|
||||||
|
"object": "payment_method",
|
||||||
|
"card": {
|
||||||
|
"brand": "visa",
|
||||||
|
"checks": {
|
||||||
|
"address_line1_check": null,
|
||||||
|
"address_postal_code_check": null,
|
||||||
|
"cvc_check": null
|
||||||
|
},
|
||||||
|
"country": "US",
|
||||||
|
"exp_month": 8,
|
||||||
|
"exp_year": 2020,
|
||||||
|
"fingerprint": "sStRRZt3Xlw0Ec6B",
|
||||||
|
"funding": "credit",
|
||||||
|
"generated_from": null,
|
||||||
|
"last4": "4242",
|
||||||
|
"three_d_secure_usage": {
|
||||||
|
"supported": true
|
||||||
|
},
|
||||||
|
"wallet": null
|
||||||
|
},
|
||||||
|
"created": 1556596276,
|
||||||
|
"customer": "cus_3fAHf0I56s1QFx",
|
||||||
|
"livemode": false,
|
||||||
|
"metadata": {},
|
||||||
|
"type": "card"
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//get the customer or create a new one.
|
||||||
|
//get the payment method
|
||||||
|
//attached payment method to customer
|
||||||
|
//store meta data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,6 +73,15 @@
|
|||||||
$("#card-button").attr("disabled", true);
|
$("#card-button").attr("disabled", true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var form = $(document.createElement('form'));
|
||||||
|
$(form).attr("action", "{{ route('client.payment_methods.store') }}");
|
||||||
|
$(form).attr("method", "POST");
|
||||||
|
|
||||||
|
var input = $("<input>").attr("type", "hidden").attr("name", "mydata").val("bla");
|
||||||
|
$(form).append($(input));
|
||||||
|
$(form).submit();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@endpush
|
@endpush
|
||||||
|
Loading…
x
Reference in New Issue
Block a user