Comments (10)
Hi,
Yes, it should be TransactionAbstract that is extended.
To use with eloquent, I expect your model would need to be injected with the Laravel transaction model, then you would use that model as a service (if that is the right term) to do the reading and writing.
Strangely enough, I am trying out the omnipay/sagepay package with Laravel now, and created an eloquent model for it yesterday.
Something to bear in mind, is that the PDO model in this package has a separate database column for each field that it needs to store. That is not necessary unless you have a specific need to be able to join or search for any of those columns. The approach I have taken with omnipay/sagepay is to have columns for VendorTxCode (the index), the main status and the notify callback status, and a few message fields. But beyond that, most of the rest of the data (e.g. as returned in the initial call to SagePay and the transaction results provided in the notify callback) are serialised into text fields. Eloquent makes it dead easy to automatically json_encode() and json_decode() that data invisibly as you read and write records.
The eventual idea is that it should be possible to use a single transactions model for ANY gateway that omnipay uses. I am constructing a site that requires several different payment gateways and currencies, which is why I'm trying out omnipay. I'm still finding each gateway is different enough to need custom handling, but if the transaction model can be made general enough to work with any of the gateways, then I could release it as a standalone package that would easily integrate with this gateway, omnipay, or any other gateways run under Laravel.
Best of luck, and let me know if there is anything I can help with or anything above that is not clear.
from sagepay.
Hi judgej,
First of all im sorry i didn't expressed my gratitude for providing this package and thank you for the response. Have you tried integrating it with laravel ?
I did extended the transaction model i created to Model\TransactionAbstract but getting error.
Could you please tell you how you succeeded with integrating laravel.
I would really appreciate.
Many thanks,
Prajwol
from sagepay.
Yes, I have used it with Laravel, but I've just used the PDO model, so that kind of bypasses eloquent.
from sagepay.
Hi judgej.. I decided to use pdo.. as really short on deadline :p btw how do you add discount on basket? I searched on basket model but found nothing. Any reply would be appreciated.
from sagepay.
The basket model is just a repository of the final basket from your application, so it can be sent to SagePay as metadata. It does not have any functionality beyond that. You add product details or ProductLines and it formats itself in the XML format that SagePay expects.
from sagepay.
how am i to send the discounts with this package? Could you add a one line code on the read me itself? as im sure it'll help lot others like me.
from sagepay.
Sorry, I'm not sure I understand what discounts you mean, and how that relates to the payment gateway.
from sagepay.
sending discount fixed amount by xml just like we send shipping charges.
According to sagepay on basket xml
"Displaying on the payment page. It is possible to send through a delivery charge and one or more discounts. The discount is at the
order level rather than item level and is a fixed amount discount. You can however add multiple discounts to the order."
You can check this at :
http://www.sagepay.co.uk/file/1161/download-document/SERVERProtocolandIntegrationGuidelinesV3%200.pdf
for discount check page number 56
from sagepay.
Ah, I see now. The SagePay spec I was working from is a little earlier than the one you linked. and the discount functionality was not documented at that time, so has not been coded. The API version hasn't changed, so it looks like it was just an omission in the first v3.0 spec.
It could be coded like the order lines, allowing you to add discount values or objects to the basket. When formatting as XML, the basket would then expand the discounts in the appropriate place (IIRC the XML elements must be in the same order as documented).
You could start by creating your own basket, extending BasketAbstract, and add those features, then we can look at integrating the code.
from sagepay.
I've moved the discount support to a separate ticket.
from sagepay.
Related Issues (20)
- Create Omnipay Wrapper
- Make sure typehints are interfaces, not abstracts
- Token field may not be send in server-notification HOT 4
- Helper::formatAmount silently sets Amount to Zero HOT 9
- Fields for Refund not picked out HOT 6
- Switch to PSR-4 autoloading HOT 1
- Surcharge XML is too long HOT 9
- Start using constructor injection
- Use Data Mapper model rather than up-side-down Active Record HOT 1
- Support discounts in basket HOT 17
- Sagepay callback function is not taking sagepay tx_model HOT 2
- Passing correct customer data to Sage Pay HOT 9
- Create Omnipay connector
- Is VPSSignature utilised? HOT 4
- VendorTxCode not guaranteed to be unique or unpredictable HOT 3
- MD5 signature - change from Pending to OK for PPRO payments HOT 3
- Handle duplicate notification callbacks HOT 2
- Second CardType does not contain tamper: true HOT 1
- Support 3d Secure v2 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sagepay.