Closed judgej closed 8 years ago
Nice work @judgej - thanks for sorting out some of those issues.
I haven't tested it on my test Sage Pay account yet, so I'll do that before taking it any further.
The overriding card details may need a small rethink, as the card object contains both the CVV and the shipping address as a single object. You may wish to supply a CVV but not change the shipping address on a repeat, and that isn't possible here. Maybe the way to do it is to check all the shipping address fields, and so long as ALL are null, then assume no shipping address has been supplied. I suspect that is what the remote gateway does anyway, so if you supply even ONE shipping field, it will discard the whole saved shipping address and use that single field.
Issue #58
Trying this out on my test instance, and I'm getting a few odd results. Any attempt to do a repeatAuthorize
(REPEATDEFERRED) gives me this error:
4006 : The TxType requested is not supported on this account.
I also get that if I attempt a repeatPayment
on an authorize
before that authorization is captured. My account settings is set to allow REPEATDEFERRED, so I'm sure there is some subtlety that I'm overlooking. I've double checked the documentation, and can't see anything wrong there. I'll raise it with Sage Pay support.
As an aside, the repeat message has introduced this inconsistency with the naming of parameters passed in:
transactionReference
- the related transaction when capturing an authorization.relatedTransactionReference
- the related transaction when performing a repeat payment.I think the first (transactionReference
) should probably be used in both cases, to be more consistent with OmniPay in general, but I have not checked other gateway drivers to see if that is the general consensus.
The REPEATDEFERRED
is documented in the server/direct shared protocol docs, the latest of which are dated 2014-08-01. REPEATDEFERRED
is not mentioned in the server or direct specific protocol docs (both of which indicate you should read the shared docs for REPEAT
payments).
I am wondering if REPEATDEFERRED
is something that was removed in protocol 3.00 years (years!) ago, but got left behind in the documentation? The official PHP SDK does not seem to cover REPEAT
or REPEATDEFERRED
.
All works for me now. Turns out Sage Pay did need to enable this feature on my account - REPEAT
and REPEATDEFERRED
need to be activated on the account separately.
I'm happy this fills in the gaps of PR #66 for issue #58
I'll check whether transactionReference
needs to be an alias for relatedTransactionReference
for consistency, then accept this PR #68 to finish off issue #58
Edit: no other gateway seems to support repeat payments on past transactions, so I cannot find any precedence. If transactionReference
is used to reference the original transaction, then the returned transactionReference
for the new repeat transaction (which would be different) could get a little confusing, so maybe best left as it is for now.
I'll merge this before close today. Please shout if there are any problems with that. There should be no BC breaks in this.
I think the first (transactionReference) should probably be used in both cases, to be more consistent with OmniPay in general, but I have not checked other gateway drivers to see if that is the general consensus.
Agree with this. I'm not aware of many other gateways that do this but I believe that Allied Wallet does and it uses transactionReference.
I'll put transactionReference
in as an alias method for now, and deprecate the old one.
As discussed in Issue #58:
repeatPayment
torepeatPurchase
.repeatAuthorize
to complementrepeatPurchase
.The
repeatPayment
has been deprecated, but left in for now as an alias ofrepeatPurchase
, as it is in use in production.