protected override void DoStoreAccountData(PaySession session, IActualAccountData accoundData) { lock (s_MockActualAccountDatas) { s_MockActualAccountDatas.RemoveAll(ad => ad.Account == accoundData.Account); s_MockActualAccountDatas.Add(accoundData); } }
public void StoreAccountData(IActualAccountData accoundData) { if (m_AffectedAccounts == null) { m_AffectedAccounts = new Dictionary <Account, IActualAccountData>(); } m_AffectedAccounts[accoundData.Account] = accoundData; }
public IActualAccountData FetchAccountData(Account account) { IActualAccountData result = null; if (m_AffectedAccounts != null && m_AffectedAccounts.ContainsKey(account)) { result = m_AffectedAccounts[account]; } if (result == null) { result = PaySystemHost.DoFetchAccountData(this, account); } return(result); }
private string getPayoutJSONBody(IActualAccountData to, Amount amount, string description) { return(new { sender_batch_header = new { sender_batch_id = generateBatchID(), // maximum length: 30. email_subject = m_PayoutEmailSubject, // maximum of 255 single-byte alphanumeric characters. recipient_type = EMAIL_RECIPIENT_TYPE // EMAIL, PHONE, PAYPAL_ID }, items = new[] { new { recipient_type = EMAIL_RECIPIENT_TYPE, amount = new { currency = amount.CurrencyISO.ToUpperInvariant(), value = string.Format(CURRENCY_FORMAT, amount.Value, CultureInfo.InvariantCulture) }, note = description.IsNullOrWhiteSpace() ? m_PayoutNote : description, receiver = to.PrimaryEMail, sender_item_id = 1 // maximum length: 30. } } }.ToJSON(JSONWritingOptions.Compact)); }
/// <summary> /// The operation is not supported in PayPal payout action. /// </summary> public override PaymentException VerifyPotentialTransaction(PaySession session, ITransactionContext context, bool transfer, IActualAccountData from, IActualAccountData to, Amount amount) { throw new NotSupportedException(); }
public abstract PaymentException VerifyPotentialTransaction(PaySession session, ITransactionContext context, bool transfer, IActualAccountData from, IActualAccountData to, Amount amount);
private string getPayoutJSONBody(IActualAccountData to, Amount amount, string description) { return new { sender_batch_header = new { sender_batch_id = generateBatchID(), // maximum length: 30. email_subject = m_PayoutEmailSubject, // maximum of 255 single-byte alphanumeric characters. recipient_type = EMAIL_RECIPIENT_TYPE // EMAIL, PHONE, PAYPAL_ID }, items = new[] { new { recipient_type = EMAIL_RECIPIENT_TYPE, amount = new { currency = amount.CurrencyISO.ToUpperInvariant(), value = string.Format(CURRENCY_FORMAT, amount.Value, CultureInfo.InvariantCulture) }, note = description.IsNullOrWhiteSpace() ? m_PayoutNote : description, receiver = to.PrimaryEMail, sender_item_id = 1 // maximum length: 30. } } }.ToJSON(JSONWritingOptions.Compact); }
/// <summary> /// Has the same semantics as corresponding PaySystem method executed in context of this session /// </summary> public PaymentException VerifyPotentialTransaction(ITransactionContext context, bool transfer, IActualAccountData from, IActualAccountData to, Amount amount) { return(m_PaySystem.VerifyPotentialTransaction(this, context, transfer, from, to, amount)); }
/// <summary> /// Has the same semantics as corresponding PaySystem method executed in context of this session /// </summary> public PaymentException VerifyPotentialTransaction(ITransactionContext context, bool transfer, IActualAccountData from, IActualAccountData to, Amount amount) { return m_PaySystem.VerifyPotentialTransaction(this, context, transfer, from, to, amount); }
private void fillBodyParametersFromAccount(Dictionary <string, string> bodyPrms, IActualAccountData accountData) { if (!accountData.IsCard) // bank account { bodyPrms.Add(PRM_COUNTRY, accountData.BillingCountry); bodyPrms.Add(PRM_ACCOUNT_NUMBER, accountData.AccountNumber); bodyPrms.Add(PRM_ROUTING_NUMBER, accountData.RoutingNumber); } else { bodyPrms.Add(PRM_CARD_NUMBER, accountData.AccountNumber); bodyPrms.Add(PRM_CARD_EXPYEAR, accountData.CardExpirationYear.ToString("####")); bodyPrms.Add(PRM_CARD_EXPMONTH, accountData.CardExpirationMonth.ToString("##")); if (accountData.CardVC.IsNotNullOrWhiteSpace()) { bodyPrms.Add(PRM_CARD_CVC, accountData.CardVC); } if (accountData.BillingAddress1.IsNotNullOrWhiteSpace()) { bodyPrms.Add(PRM_CARD_ADDRESS_LINE_1, accountData.BillingAddress1); } if (accountData.BillingAddress2.IsNotNullOrWhiteSpace()) { bodyPrms.Add(PRM_CARD_ADDRESS_LINE_2, accountData.BillingAddress2); } if (accountData.BillingCity.IsNotNullOrWhiteSpace()) { bodyPrms.Add(PRM_CARD_ADDRESS_CITY, accountData.BillingCity); } if (accountData.BillingPostalCode.IsNotNullOrWhiteSpace()) { bodyPrms.Add(PRM_CARD_ADDRESS_ZIP, accountData.BillingPostalCode); } if (accountData.BillingRegion.IsNotNullOrWhiteSpace()) { bodyPrms.Add(PRM_CARD_ADDRESS_STATE, accountData.BillingRegion); } if (accountData.BillingCountry.IsNotNullOrWhiteSpace()) { bodyPrms.Add(PRM_CARD_ADDRESS_COUNTRY, accountData.BillingCountry); } } }
protected internal abstract void DoStoreAccountData(PaySession session, IActualAccountData accoundData);
private void fillBodyParametersFromAccount(Dictionary<string, string> bodyPrms, IActualAccountData accountData) { if (!accountData.IsCard) // bank account { bodyPrms.Add(PRM_COUNTRY, accountData.BillingCountry); bodyPrms.Add(PRM_ACCOUNT_NUMBER, accountData.AccountNumber); bodyPrms.Add(PRM_ROUTING_NUMBER, accountData.RoutingNumber); } else { bodyPrms.Add(PRM_CARD_NUMBER, accountData.AccountNumber); bodyPrms.Add(PRM_CARD_EXPYEAR, accountData.CardExpirationYear.ToString("####")); bodyPrms.Add(PRM_CARD_EXPMONTH, accountData.CardExpirationMonth.ToString("##")); if (accountData.CardVC.IsNotNullOrWhiteSpace()) bodyPrms.Add(PRM_CARD_CVC, accountData.CardVC); if (accountData.BillingAddress1.IsNotNullOrWhiteSpace()) bodyPrms.Add(PRM_CARD_ADDRESS_LINE_1, accountData.BillingAddress1); if (accountData.BillingAddress2.IsNotNullOrWhiteSpace()) bodyPrms.Add(PRM_CARD_ADDRESS_LINE_2, accountData.BillingAddress2); if (accountData.BillingCity.IsNotNullOrWhiteSpace()) bodyPrms.Add(PRM_CARD_ADDRESS_CITY, accountData.BillingCity); if (accountData.BillingPostalCode.IsNotNullOrWhiteSpace()) bodyPrms.Add(PRM_CARD_ADDRESS_ZIP, accountData.BillingPostalCode); if (accountData.BillingRegion.IsNotNullOrWhiteSpace()) bodyPrms.Add(PRM_CARD_ADDRESS_STATE, accountData.BillingRegion); if (accountData.BillingCountry.IsNotNullOrWhiteSpace()) bodyPrms.Add(PRM_CARD_ADDRESS_COUNTRY, accountData.BillingCountry); } }